paperclip-s3 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,20 +20,16 @@ If you are using "Heroku":http://heroku.com, it's really easy to do this, just
20
20
  heroku config:add S3_SECRET=your_secret_key
21
21
  </pre>
22
22
 
23
- Ok, if you're really lazy, you can do that in one line:
23
+ If you are using *https* as the S3 Protocol, you can also specify it as a Heroku environment variable.
24
24
 
25
25
  <pre>
26
- heroku config:add S3_BUCKET=your_bucket_name S3_KEY=your_access_key S3_SECRET=your_secret_key
26
+ heroku config:add S3_PROTOCOL=https
27
27
  </pre>
28
28
 
29
- After you've done this, you can use paperclip normally. The gem just extends this methods and changes the options to force the S3 Storage. You can *even* use the same options (like path, default_style, etc.)
30
-
29
+ `Notice that the S3 protocol will default to *http*`
31
30
 
31
+ After you've done this, you can use paperclip normally. The gem just extends this methods and changes the options to force the S3 Storage. You can *even* use the same options (like path, default_style, etc.)
32
32
 
33
33
  h2. Contribute
34
34
 
35
35
  Feel free to fork, fix/patch/extend this. Everything is welcome.
36
-
37
- h3. TODO
38
-
39
- * Clean the Railtie, specially the Rails.env part.
@@ -6,7 +6,7 @@ require 'paperclip-s3/railtie'
6
6
  module Paperclip
7
7
  module S3
8
8
 
9
- # Use Paperclip::S3::Glue to keep the original gems style
9
+ # Use Paperclip::S3::Glue to keep the original gem style
10
10
  module Glue
11
11
  def self.included base
12
12
  base.extend ClassMethods
@@ -17,9 +17,11 @@ module Paperclip
17
17
  # Extends the paperclips has_attached_file method
18
18
  # It will use S3 Storage. The credentials will be read from the environment
19
19
  def has_attached_file(name, options = {})
20
+ s3_protocol = !!ENV["S3_PROTOCOL"] ? ENV["S3_PROTOCOL"] : "http"
20
21
  options[:storage] = :s3
21
22
  options[:path] ||= "/:class-:attachment/:id/:style-:basename.:extension"
22
23
  options[:bucket] ||= ENV["S3_BUCKET"]
24
+ options[:s3_protocol] ||= s3_protocol
23
25
  options[:s3_credentials] ||= {
24
26
  :access_key_id => ENV['S3_KEY'],
25
27
  :secret_access_key => ENV['S3_SECRET']
@@ -1,5 +1,5 @@
1
1
  module Paperclip
2
2
  module S3
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: paperclip
16
- requirement: &70300983208200 !ruby/object:Gem::Requirement
16
+ requirement: &70133354315620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.4'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70300983208200
24
+ version_requirements: *70133354315620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: aws-sdk
27
- requirement: &70300983200960 !ruby/object:Gem::Requirement
27
+ requirement: &70133354315120 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.5
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70300983200960
35
+ version_requirements: *70133354315120
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70300983199380 !ruby/object:Gem::Requirement
38
+ requirement: &70133354314660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.9.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70300983199380
46
+ version_requirements: *70133354314660
47
47
  description: The gem will simply extend the has_attached_file to make it store on
48
48
  Amazon S3 when the application is on production. Great for Heroku applications.
49
49
  email:
@@ -76,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  segments:
78
78
  - 0
79
- hash: 1150494502619914125
79
+ hash: -1628456512744789545
80
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  segments:
87
87
  - 0
88
- hash: 1150494502619914125
88
+ hash: -1628456512744789545
89
89
  requirements: []
90
90
  rubyforge_project: paperclip-s3
91
91
  rubygems_version: 1.8.10