s3lurp 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,16 +26,16 @@ to the helper via a hash.
26
26
  There are three options required for buckets that are not public-write:
27
27
 
28
28
  * `s3_bucket` - The name of the bucket where files go
29
- * `s3_access_key` - This is your AWS Access Key ID
30
- * `s3_secret_ley` - Your AWS Secret Accss Key
29
+ * `aws_access_key` - This is your AWS Access Key ID
30
+ * `aws_secret_key` - Your AWS Secret Accss Key
31
31
 
32
32
 
33
33
  These three options can be set via a yaml config file, an initializer, or ENV vars.
34
34
 
35
35
 
36
36
  ENV['S3_BUCKET']
37
- ENV['S3_ACCESS_KEY']
38
- ENV['S3_SECRET_KEY']
37
+ ENV['AWS_ACCESS_KEY']
38
+ ENV['AWS_SECRET_KEY']
39
39
 
40
40
  Another way to set up these options is to us an initializer.
41
41
 
@@ -44,8 +44,8 @@ In config/initializers/s3lurp.rb
44
44
  ```ruby
45
45
  S3lurp.configure do |config|
46
46
  config.s3_bucket = "bucket_of_holding"
47
- config.s3_access_key = "some_acces_key"
48
- config.s3_secret_key = "keep_it_secret"
47
+ config.aws_access_key = "some_acces_key"
48
+ config.aws_secret_key = "keep_it_secret"
49
49
  ```
50
50
 
51
51
  Finally you can use use a yaml file to load the configuration.
@@ -58,12 +58,12 @@ end
58
58
  # config/s3lurp.yml
59
59
  development:
60
60
  s3_bucket: "dev_bucket"
61
- s3_access_key: "dev_key"
62
- s3_secret_key: "dev_secret"
61
+ aws_access_key: "dev_key"
62
+ aws_secret_key: "dev_secret"
63
63
  production:
64
64
  s3_bucket: "prod_bucket"
65
- s3_access_key: "prod_key"
66
- s3_secret_key: "prod_secret"
65
+ aws_access_key: "prod_key"
66
+ aws_secret_key: "prod_secret"
67
67
  ```
68
68
 
69
69
  Using a yaml conifg file allows you to use different settings for different
@@ -78,9 +78,9 @@ Setup your ENV variables for heroku and for local use.
78
78
  For more on Heroku config see here: https://devcenter.heroku.com/articles/config-vars
79
79
 
80
80
  ```
81
- $ heroku config:add S3_KEY=asdfg12345 S3_SECRET=qwertyu0987622`
82
- $ export S3_KEY=asdfg12345
83
- $ export S3_SECRET=qwertyu0987622
81
+ $ heroku config:add AWS_ACCESS_KEY=asdfg12345 AWS_SECRET=qwertyu0987622`
82
+ $ export AWS_ACCESS_KEY=asdfg12345
83
+ $ export AWS_SECRET=qwertyu0987622
84
84
  ```
85
85
 
86
86
  Set up some defaults with an initialzer
@@ -114,8 +114,8 @@ to the helper in a hash.
114
114
  |--------------------------|-------------|
115
115
  |__:file__ | Name of yaml file located in the config directory. Contains any of the options listed in this table. Should be set inside a configuration block via an initializer. |
116
116
  |__:s3\_bucket__ | AWS S3 bucket name where files will stored. Can also be configured via ENV['S3_BUCKET']. __Required__|
117
- |__:s3\_access\_key__ | AWS Access Key. Can also be configured via ENV['S3_ACCESS_KEY']. __Required for buckets that are not public-write.__|
118
- |__:s3\_secret\_key__ | AWS AWS Secret Accss Key. Can also be configured via ENV['S3_SECRET_KEY']. __Required for buckets that are not public-write.__|
117
+ |__:aws\_access\_key__ | AWS Access Key. Can also be configured via ENV['AWS_ACCESS_KEY']. __Required for buckets that are not public-write.__|
118
+ |__:aws\_secret\_key__ | AWS AWS Secret Accss Key. Can also be configured via ENV['AWS_SECRET_KEY']. __Required for buckets that are not public-write.__|
119
119
  |__:key__ | This is the key for the S3 object. To use the filename of the upload, use the vairable ${filename} (see example). __Required__|
120
120
  |__:acl__ | Sepecies an S3 access control list. Valid values: `private` `public-read` `public-read-write` `authenticated-read` `bucket-owner-read` `bucket-owner-full-control`. _Default_: `private` |
121
121
  |__:cache\_control__ | Refer to [S3 PUT Object documentation](http://docs.aws.amazon.com/AmazonS3/2006-03-01/API/RESTObjectPUT.html)|
@@ -4,7 +4,7 @@ require 's3lurp/railtie' if defined? ::Rails::Railtie
4
4
 
5
5
  module S3lurp
6
6
  VALID_CONFIG_KEYS = [
7
- :s3_bucket, :s3_access_key, :s3_secret_key, :acl, :cache_control,
7
+ :s3_bucket, :aws_access_key, :aws_secret_key, :acl, :cache_control,
8
8
  :content_type, :content_disposition, :content_encoding, :expires,
9
9
  :success_action_redirect, :success_action_status,
10
10
  :min_file_size, :max_file_size,
@@ -37,8 +37,8 @@ module S3lurp
37
37
 
38
38
  def initialize
39
39
  @s3_bucket = ENV['S3_BUCKET'] || "S3_BUCKET"
40
- @s3_access_key = ENV['S3_ACCESS_KEY'] || "S3_KEY"
41
- @s3_secret_key = ENV['S3_SECRET_KEY'] || "S3_SECRET"
40
+ @aws_access_key = ENV['AWS_ACCESS_KEY'] || "AWS_KEY"
41
+ @aws_secret_key = ENV['AWS_SECRET_KEY'] || "AWS_SECRET"
42
42
  @min_file_size = 0
43
43
  @max_file_size = 10485760
44
44
  @minutes_valid = 360
@@ -1,3 +1,3 @@
1
1
  module S3lurp
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -6,7 +6,7 @@ module S3lurp
6
6
  module ViewHelpers
7
7
  HIDDEN_FIELD_MAP= {
8
8
  :key => 'key',
9
- :s3_access_key => 'AWSAccessKeyId',
9
+ :aws_access_key => 'AWSAccessKeyId',
10
10
  :acl => 'acl',
11
11
  :cache_control => 'Cache-Control',
12
12
  :content_type => 'Content-Type',
@@ -16,7 +16,7 @@ module S3lurp
16
16
  :success_action_redirect => 'success_action_redirect',
17
17
  :success_action_status => 'success_action_status'
18
18
  }
19
- NON_FIELD_OPTIONS = %w( s3_bucket s3_secret_key
19
+ NON_FIELD_OPTIONS = %w( s3_bucket aws_secret_key
20
20
  max_file_size min_file_size
21
21
  amz_meta_tags minutes_valid
22
22
  form_html_options file_field_tag_accept
@@ -39,7 +39,7 @@ module S3lurp
39
39
  expiration_date = minutes.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')
40
40
 
41
41
  security_fields = {}
42
- if hidden_fields[:s3_access_key] # only generate security fields when necessary
42
+ if hidden_fields[:aws_access_key] # only generate security fields when necessary
43
43
  security_fields[:policy] = Base64.encode64(
44
44
  s3_generate_policy(
45
45
  hidden_fields.clone,
@@ -53,7 +53,7 @@ module S3lurp
53
53
  security_fields[:signature] = Base64.encode64(
54
54
  OpenSSL::HMAC.digest(
55
55
  OpenSSL::Digest::Digest.new('sha1'),
56
- options[:s3_secret_key], security_fields[:policy])
56
+ options[:aws_secret_key], security_fields[:policy])
57
57
  ).gsub(/\n/,'')
58
58
  end
59
59
 
@@ -71,7 +71,7 @@ module S3lurp
71
71
  end
72
72
 
73
73
  def s3_generate_policy(fields = {}, options = {})
74
- fields.delete(:s3_access_key)
74
+ fields.delete(:aws_access_key)
75
75
  conditions = [
76
76
  { :bucket => options[:s3_bucket]},
77
77
  ['content-length-range', options[:min_file_size], options[:max_file_size]],
@@ -14,8 +14,8 @@ describe S3lurp::ViewHelpers do
14
14
 
15
15
  it "should return a form with a minimum set of hidden fields for public buckets" do
16
16
  S3lurp.configure do |config|
17
- config.s3_access_key = nil
18
- config.s3_secret_key = nil
17
+ config.aws_access_key = nil
18
+ config.aws_secret_key = nil
19
19
  end
20
20
  form = view.s3_direct_form_tag({:key => '/files/s3lurp/lib/s3lurp.rb'})
21
21
  (!!form.match(/<form.*?>/)).should be_true
@@ -26,8 +26,8 @@ describe S3lurp::ViewHelpers do
26
26
  it "should return a form with a policy and signature and my meta tags" do
27
27
  S3lurp.configure do |config|
28
28
  config.s3_bucket = "bucket_o_stuff"
29
- config.s3_access_key = 'oingoboingo'
30
- config.s3_secret_key = "qwerty5678_"
29
+ config.aws_access_key = 'oingoboingo'
30
+ config.aws_secret_key = "qwerty5678_"
31
31
  end
32
32
  form = view.s3_direct_form_tag({
33
33
  :key => '/some/key.pl',
@@ -104,24 +104,24 @@ describe S3lurp do
104
104
  it 'should configure with options' do
105
105
  S3lurp.configure do |config|
106
106
  config.s3_bucket = @bucket
107
- config.s3_access_key = @key
108
- config.s3_secret_key = @secret
107
+ config.aws_access_key = @key
108
+ config.aws_secret_key = @secret
109
109
  end
110
110
  S3lurp.config.s3_bucket.should == @bucket
111
- S3lurp.config.s3_access_key.should == @key
112
- S3lurp.config.s3_secret_key.should == @secret
111
+ S3lurp.config.aws_access_key.should == @key
112
+ S3lurp.config.aws_secret_key.should == @secret
113
113
  end
114
114
 
115
115
  it 'should should always use ENV first for config' do
116
116
  ENV['S3_BUCKET'] = @bucket
117
- ENV['S3_ACCESS_KEY'] = @key
118
- ENV['S3_SECRET_KEY'] = @secret
117
+ ENV['AWS_ACCESS_KEY'] = @key
118
+ ENV['AWS_SECRET_KEY'] = @secret
119
119
  S3lurp.configure do |config|
120
120
  # nothing
121
121
  end
122
122
  S3lurp.config.s3_bucket.should == @bucket
123
- S3lurp.config.s3_access_key.should == @key
124
- S3lurp.config.s3_secret_key.should == @secret
123
+ S3lurp.config.aws_access_key.should == @key
124
+ S3lurp.config.aws_secret_key.should == @secret
125
125
 
126
126
  end
127
127
 
@@ -130,8 +130,8 @@ describe S3lurp do
130
130
  config.file = 's3.yml'
131
131
  end
132
132
  S3lurp.config.s3_bucket.should == 'yml_bucket'
133
- S3lurp.config.s3_access_key.should == 'yml_key'
134
- S3lurp.config.s3_secret_key.should == 'yml_secret'
133
+ S3lurp.config.aws_access_key.should == 'yml_key'
134
+ S3lurp.config.aws_secret_key.should == 'yml_secret'
135
135
  end
136
136
  end
137
137
 
@@ -1,4 +1,4 @@
1
1
  s3_bucket: "yml_bucket"
2
- s3_access_key: "yml_key"
3
- s3_secret_key: "yml_secret"
2
+ aws_access_key: "yml_key"
3
+ aws_secret_key: "yml_secret"
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3lurp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-26 00:00:00.000000000 Z
12
+ date: 2013-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: -741012443240584985
130
+ hash: 3054736488437017560
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  none: false
133
133
  requirements:
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  segments:
138
138
  - 0
139
- hash: -741012443240584985
139
+ hash: 3054736488437017560
140
140
  requirements: []
141
141
  rubyforge_project:
142
142
  rubygems_version: 1.8.25