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
ccaaaad6
Commit
ccaaaad6
authored
9 years ago
by
David Chen
Committed by
Jon Yurek
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First pass at making specs run with Aws-v2
parent
9ef9b512
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
lib/paperclip/storage/s3.rb
+14
-6
spec/paperclip/storage/s3_spec.rb
+0
-0
No files found.
lib/paperclip/storage/s3.rb
View file @
ccaaaad6
...
...
@@ -116,7 +116,11 @@ module Paperclip
begin
require
'aws-sdk'
const_set
(
'AWS_CLASS'
,
defined?
(
::
Aws
)
?
::
Aws
:
::
AWS
)
const_set
(
'DEFAULT_PERMISSION'
,
defined?
(
::
AWS
)
?
:
public_read
:
:'public-read'
)
const_set
(
'AWS_BASE_ERROR'
,
defined?
(
::
Aws
)
?
Aws
::
Errors
::
ServiceError
:
AWS
::
Errors
::
Base
)
const_set
(
'DEFAULT_PERMISSION'
,
defined?
(
::
AWS
)
?
:
public_read
:
:'public-read'
)
rescue
LoadError
=>
e
e
.
message
<<
" (You may need to install the aws-sdk gem)"
raise
e
...
...
@@ -253,7 +257,7 @@ module Paperclip
config
[
:proxy_uri
]
=
URI
::
HTTP
.
build
(
proxy_opts
)
end
[
:access_key_id
,
:secret_access_key
,
:credential_provider
].
each
do
|
opt
|
[
:access_key_id
,
:secret_access_key
,
:credential_provider
,
:credentials
].
each
do
|
opt
|
config
[
opt
]
=
s3_credentials
[
opt
]
if
s3_credentials
[
opt
]
end
...
...
@@ -332,7 +336,7 @@ module Paperclip
else
false
end
rescue
AWS_
CLASS
::
Errors
::
Base
=>
e
rescue
AWS_
BASE_ERROR
=>
e
false
end
...
...
@@ -358,7 +362,11 @@ module Paperclip
end
def
create_bucket
s3_interface
.
buckets
.
create
(
bucket_name
)
if
aws_v1?
s3_interface
.
buckets
.
create
(
bucket_name
)
else
s3_interface
.
bucket
(
bucket_name
).
create
end
end
def
flush_writes
#:nodoc:
...
...
@@ -426,7 +434,7 @@ module Paperclip
else
s3_bucket
.
object
(
path
.
sub
(
%r{
\A
/}
,
''
))
end
.
delete
rescue
AWS_
CLASS
::
Errors
::
Base
=>
e
rescue
AWS_
BASE_ERROR
=>
e
# Ignore this.
end
end
...
...
@@ -440,7 +448,7 @@ module Paperclip
local_file
.
write
(
chunk
)
end
end
rescue
AWS_
CLASS
::
Errors
::
Base
=>
e
rescue
AWS_
BASE_ERROR
=>
e
warn
(
"
#{
e
}
- cannot copy
#{
path
(
style
)
}
to local file
#{
local_dest_path
}
"
)
false
end
...
...
This diff is collapsed.
Click to expand it.
spec/paperclip/storage/s3_spec.rb
View file @
ccaaaad6
This diff is collapsed.
Click to expand it.
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