Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
91f673f2
Commit
91f673f2
authored
Oct 31, 2012
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apparently copy_to_local_file wasn't in the FS module
parent
d01d58c2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
1 deletions
+20
-1
lib/paperclip/storage/filesystem.rb
+1
-1
lib/paperclip/storage/fog.rb
+0
-0
test/storage/filesystem_test.rb
+8
-0
test/storage/fog_test.rb
+11
-0
No files found.
lib/paperclip/storage/filesystem.rb
View file @
91f673f2
...
@@ -67,11 +67,11 @@ module Paperclip
...
@@ -67,11 +67,11 @@ module Paperclip
end
end
@queued_for_delete
=
[]
@queued_for_delete
=
[]
end
end
end
def
copy_to_local_file
(
style
,
local_dest_path
)
def
copy_to_local_file
(
style
,
local_dest_path
)
FileUtils
.
cp
(
path
(
style
),
local_dest_path
)
FileUtils
.
cp
(
path
(
style
),
local_dest_path
)
end
end
end
end
end
end
end
lib/paperclip/storage/fog.rb
View file @
91f673f2
test/storage/filesystem_test.rb
View file @
91f673f2
...
@@ -41,6 +41,14 @@ class FileSystemTest < Test::Unit::TestCase
...
@@ -41,6 +41,14 @@ class FileSystemTest < Test::Unit::TestCase
assert
paths
.
none?
{
|
path
|
File
.
exists?
(
path
)
},
assert
paths
.
none?
{
|
path
|
File
.
exists?
(
path
)
},
"Expect all the files to be deleted."
"Expect all the files to be deleted."
end
end
should
'copy the file to a known location with copy_to_local_file'
do
tempfile
=
Tempfile
.
new
(
"known_location"
)
@dummy
.
avatar
.
copy_to_local_file
(
:original
,
tempfile
.
path
)
tempfile
.
rewind
assert_equal
@file
.
read
,
tempfile
.
read
tempfile
.
close
end
end
end
context
"with file that has space in file name"
do
context
"with file that has space in file name"
do
...
...
test/storage/fog_test.rb
View file @
91f673f2
...
@@ -149,6 +149,17 @@ class FogTest < Test::Unit::TestCase
...
@@ -149,6 +149,17 @@ class FogTest < Test::Unit::TestCase
"Expect all the files to be deleted."
"Expect all the files to be deleted."
end
end
should
'be able to be copied to a local file'
do
@dummy
.
save
tempfile
=
Tempfile
.
new
(
"known_location"
)
tempfile
.
binmode
@dummy
.
avatar
.
copy_to_local_file
(
:original
,
tempfile
.
path
)
tempfile
.
rewind
assert_equal
@connection
.
directories
.
get
(
@fog_directory
).
files
.
get
(
@dummy
.
avatar
.
path
).
body
,
tempfile
.
read
tempfile
.
close
end
should
"pass the content type to the Fog::Storage::AWS::Files instance"
do
should
"pass the content type to the Fog::Storage::AWS::Files instance"
do
Fog
::
Storage
::
AWS
::
Files
.
any_instance
.
expects
(
:create
).
with
do
|
hash
|
Fog
::
Storage
::
AWS
::
Files
.
any_instance
.
expects
(
:create
).
with
do
|
hash
|
hash
[
:content_type
]
hash
[
:content_type
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment