cloudfront-signer 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -1,5 +1,4 @@
1
- cloudfront-signer
2
- =================
1
+ # cloudfront-signer
3
2
 
4
3
  A fork and re-write of Dylan Vaughn's [signing gem](https://github.com/stlondemand/aws_cf_signer).
5
4
 
@@ -9,8 +8,7 @@ This version uses all class methods and a configure method to set options.
9
8
 
10
9
  Seperate helper methods exist for safe signing of urls and stream paths, each of which has slightly different requirements. For example, urls must not contain any spaces, whereas a stream path can. Also we might not want to html escape a url or path if it is being supplied to a JavaScript block or Flash object.
11
10
 
12
- Installation
13
- ------------
11
+ ## Installation
14
12
 
15
13
  The original gem was published as `aws_cf_signer`. Use `gem install aws_cf_signer` to install that version.
16
14
 
@@ -18,23 +16,15 @@ This gem has been publised as `cloudfront-signer`. Use `gem install cloudfront-s
18
16
 
19
17
  Alternatively, place a copy of cloudfront-signer.rb (and the cloundfront-signer sub directory) in your lib directory.
20
18
 
21
- In either case the signing class must be configured - supplying the path to a signing key.
19
+ In either case the signing class must be configured - supplying the path to a signing key. Create the initializer by running:
22
20
 
23
- In a Rails app this can be done by creating an initializer script in the /config/initializers directory.
21
+ ```
22
+ bundle exec rails g cloudfront:install
23
+ ```
24
24
 
25
- e.g.
25
+ and customizing the resulting `config/initializers/cloudfront-signer.rb` file.
26
26
 
27
- require 'cloudfront-signer'
28
-
29
- AWS::CF::Signer.configure do |config|
30
- config.key_path = key_path
31
- config.key_pair_id = "XXYYZZ"
32
- config.default_expires = 3600
33
- end
34
-
35
-
36
- Usage
37
- -----
27
+ ## Usage
38
28
 
39
29
  Call the class `sign_url` or `sign_path` method with optional policy settings.
40
30
 
@@ -80,8 +70,7 @@ You can also pass in a path to a policy file. This will supersede any other poli
80
70
  url = AWS::CF::Signer.sign_url('http://d84l721fxaaqy9.cloudfront.net/downloads/pictures.tgz', :policy_file => '/path/to/policy/file.txt')
81
71
 
82
72
 
83
- Patches/Pull Requests
84
- -------------------------------------------------------------------------
73
+ ## Patches/Pull Requests
85
74
 
86
75
  * Fork the project.
87
76
  * Make your feature addition or bug fix.
@@ -89,8 +78,7 @@ Patches/Pull Requests
89
78
  * Commit
90
79
  * Send me a pull request. Bonus points for topic branches.
91
80
 
92
- Attributions
93
- ------------
81
+ ## Attributions
94
82
 
95
83
  Parts of signing code taken from a question on Stack Overflow asked by Ben Wiseley, and answered by Blaz Lipuscek and Manual M:
96
84
 
@@ -99,6 +87,9 @@ Parts of signing code taken from a question on Stack Overflow asked by Ben Wisel
99
87
  * [http://stackoverflow.com/users/267804/blaz-lipuscek](http://stackoverflow.com/users/267804/blaz-lipuscek)
100
88
  * [http://stackoverflow.com/users/327914/manuel-m](http://stackoverflow.com/users/327914/manuel-m)
101
89
 
90
+ Note: Dylan blazed a trail here - however, after several attempts, I was unable to contact Dylan in order to suggest that we combine our efforts to produce a single gem - hence the re-write and new gem here.
91
+
92
+
102
93
  License
103
94
  -------
104
95
 
@@ -151,7 +151,7 @@ module AWS
151
151
  # Returns a String
152
152
  def self.sign(subject, configuration_options = {}, policy_options = {})
153
153
 
154
- raise "Configure using AWS::CF.Signer.configure! before signing." unless self.is_configured?
154
+ raise "Configure using AWS::CF::Signer.configure before signing." unless self.is_configured?
155
155
 
156
156
  # If the url or stream path already has a query string parameter - append to that.
157
157
  separator = subject =~ /\?/ ? '&' : '?'
@@ -1,5 +1,5 @@
1
1
  module AWS
2
2
  module CF
3
- VERSION = "2.0.1"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -0,0 +1,14 @@
1
+ require 'rails'
2
+ require 'rails/generators'
3
+
4
+ module Cloudfront
5
+ class InstallGenerator < Rails::Generators::Base
6
+ source_root File.expand_path("../templates", __FILE__)
7
+
8
+ desc "This generator creates an initializer file at config/initializers"
9
+ def add_initializer
10
+ template "cloudfront-signer.rb", "config/initializers/cloudfront-signer.rb"
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,5 @@
1
+ AWS::CF::Signer.configure do |config|
2
+ config.key_path = '/path/to/keyfile.pem'
3
+ config.key_pair_id = "XXYYZZ"
4
+ config.default_expires = 3600
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfront-signer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
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: 2012-05-25 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -45,6 +45,8 @@ files:
45
45
  - cloudfront-signer.gemspec
46
46
  - lib/cloudfront-signer.rb
47
47
  - lib/cloudfront-signer/version.rb
48
+ - lib/generators/cloudfront/install/install_generator.rb
49
+ - lib/generators/cloudfront/install/templates/cloudfront-signer.rb
48
50
  - spec/keys/pk-APKAIKUROOUNR2BAFUUU.pem
49
51
  - spec/keys/rsa-APKAIKUROOUNR2BAFUUU.pem
50
52
  - spec/signer_spec.rb
@@ -78,3 +80,4 @@ test_files:
78
80
  - spec/keys/rsa-APKAIKUROOUNR2BAFUUU.pem
79
81
  - spec/signer_spec.rb
80
82
  - spec/spec_helper.rb
83
+ has_rdoc: