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
825e1f15
Commit
825e1f15
authored
Sep 23, 2011
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove whitespaces
parent
4661cefa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
lib/paperclip/storage/s3.rb
+5
-6
test/storage_test.rb
+2
-2
No files found.
lib/paperclip/storage/s3.rb
View file @
825e1f15
...
@@ -95,12 +95,12 @@ module Paperclip
...
@@ -95,12 +95,12 @@ module Paperclip
@url
=
":s3_path_url"
@url
=
":s3_path_url"
end
end
@url
=
":asset_host"
if
@options
[
:url
].
to_s
==
":asset_host"
@url
=
":asset_host"
if
@options
[
:url
].
to_s
==
":asset_host"
@http_proxy
=
@options
[
:http_proxy
]
||
nil
@http_proxy
=
@options
[
:http_proxy
]
||
nil
if
@http_proxy
if
@http_proxy
@s3_options
.
merge!
({
:proxy
=>
@http_proxy
})
@s3_options
.
merge!
({
:proxy
=>
@http_proxy
})
end
end
AWS
::
S3
::
Base
.
establish_connection!
(
@s3_options
.
merge
(
AWS
::
S3
::
Base
.
establish_connection!
(
@s3_options
.
merge
(
:access_key_id
=>
@s3_credentials
[
:access_key_id
],
:access_key_id
=>
@s3_credentials
[
:access_key_id
],
:secret_access_key
=>
@s3_credentials
[
:secret_access_key
]
:secret_access_key
=>
@s3_credentials
[
:secret_access_key
]
...
@@ -127,11 +127,11 @@ module Paperclip
...
@@ -127,11 +127,11 @@ module Paperclip
def
bucket_name
def
bucket_name
@bucket
@bucket
end
end
def
using_http_proxy?
def
using_http_proxy?
!!
@http_proxy
!!
@http_proxy
end
end
def
http_proxy_host
def
http_proxy_host
using_http_proxy?
?
@http_proxy
[:
host
]
:
nil
using_http_proxy?
?
@http_proxy
[:
host
]
:
nil
end
end
...
@@ -139,7 +139,7 @@ module Paperclip
...
@@ -139,7 +139,7 @@ module Paperclip
def
http_proxy_port
def
http_proxy_port
using_http_proxy?
?
@http_proxy
[:
port
]
:
nil
using_http_proxy?
?
@http_proxy
[:
port
]
:
nil
end
end
def
http_proxy_user
def
http_proxy_user
using_http_proxy?
?
@http_proxy
[:
user
]
:
nil
using_http_proxy?
?
@http_proxy
[:
user
]
:
nil
end
end
...
@@ -147,7 +147,6 @@ module Paperclip
...
@@ -147,7 +147,6 @@ module Paperclip
def
http_proxy_password
def
http_proxy_password
using_http_proxy?
?
@http_proxy
[:
password
]
:
nil
using_http_proxy?
?
@http_proxy
[:
password
]
:
nil
end
end
def
s3_host_name
def
s3_host_name
@s3_host_name
||
"s3.amazonaws.com"
@s3_host_name
||
"s3.amazonaws.com"
...
...
test/storage_test.rb
View file @
825e1f15
...
@@ -70,7 +70,7 @@ class StorageTest < Test::Unit::TestCase
...
@@ -70,7 +70,7 @@ class StorageTest < Test::Unit::TestCase
rails_env
(
"not really an env"
)
rails_env
(
"not really an env"
)
assert_equal
({
:test
=>
"12345"
},
@avatar
.
parse_credentials
(
:test
=>
"12345"
))
assert_equal
({
:test
=>
"12345"
},
@avatar
.
parse_credentials
(
:test
=>
"12345"
))
end
end
should
"support HTTP proxy settings"
do
should
"support HTTP proxy settings"
do
rails_env
(
"development"
)
rails_env
(
"development"
)
assert_equal
(
true
,
@avatar
.
using_http_proxy?
)
assert_equal
(
true
,
@avatar
.
using_http_proxy?
)
...
@@ -79,7 +79,7 @@ class StorageTest < Test::Unit::TestCase
...
@@ -79,7 +79,7 @@ class StorageTest < Test::Unit::TestCase
assert_equal
(
@proxy_settings
[
:user
],
@avatar
.
http_proxy_user
)
assert_equal
(
@proxy_settings
[
:user
],
@avatar
.
http_proxy_user
)
assert_equal
(
@proxy_settings
[
:password
],
@avatar
.
http_proxy_password
)
assert_equal
(
@proxy_settings
[
:password
],
@avatar
.
http_proxy_password
)
end
end
end
end
context
""
do
context
""
do
...
...
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