relishable 0.34 → 0.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a70e4d1a3c96659d9c564e9d3fa70dba6c313c0f
4
- data.tar.gz: c855d50881f69eeca76aa6339fcb350ab3c44dcf
3
+ metadata.gz: 8bf410339f64a0e2526441a2717017414062e45d
4
+ data.tar.gz: f7f11bf1ac673c8a73de78967a1152c86c358ab1
5
5
  SHA512:
6
- metadata.gz: 280a16f779a35851f5dac62e0eecadb0e3daf66e8d4476d95f75a610f791a69f2707aab6262b12136da0d1e9e01070d30889b24351352a90aed520735b5d27b1
7
- data.tar.gz: 57eb798a8ea51d7dbd7ca959ec8c597fb47821fef17023ac325daa52d519b8c9b6ce578f096bb42f2a357b73a1dfa3bef18ea2374f0da48f0baa7741f6942a14
6
+ metadata.gz: 9a3dd84d20f1bed8e335ddf3999569dc005e7a8a05ba015d6b28f51326ee5431a7aa53589c753889e867f457a8feac0e620181bf508f7d97dff406916571f310
7
+ data.tar.gz: c0e8e81b5bf9b9555c75640db400b5888e768cbbabaa4af24cae118b69cd1a9d180428a6f33a1266cdfec418235433389634e297a4743c8d13eeb5c40510fc19
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relishable (0.34)
4
+ relishable (0.35)
5
5
  fog (~> 1.23.0)
6
6
  legacy-fernet (~> 1.6.3)
7
7
 
@@ -25,17 +25,15 @@ GEM
25
25
  fog-core (~> 1.22)
26
26
  fog-json
27
27
  inflecto (~> 0.0.2)
28
- fog-core (1.32.1)
28
+ fog-core (1.33.0)
29
29
  builder
30
30
  excon (~> 0.45)
31
31
  formatador (~> 0.2)
32
32
  mime-types
33
- net-scp (~> 1.1)
34
- net-ssh (>= 2.1.3)
35
33
  fog-json (1.0.2)
36
34
  fog-core (~> 1.0)
37
35
  multi_json (~> 1.10)
38
- fog-softlayer (1.0.0)
36
+ fog-softlayer (1.0.2)
39
37
  fog-core
40
38
  fog-json
41
39
  formatador (0.2.5)
@@ -46,11 +44,9 @@ GEM
46
44
  mime-types (2.6.2)
47
45
  mini_portile (0.6.2)
48
46
  multi_json (1.11.2)
49
- net-scp (1.2.1)
50
- net-ssh (>= 2.6.5)
51
- net-ssh (3.0.1)
52
47
  nokogiri (1.6.6.2)
53
48
  mini_portile (~> 0.6.0)
49
+ power_assert (0.2.2)
54
50
  rake (10.4.2)
55
51
  rspec (3.1.0)
56
52
  rspec-core (~> 3.1.0)
@@ -65,6 +61,8 @@ GEM
65
61
  rspec-support (~> 3.1.0)
66
62
  rspec-support (3.1.2)
67
63
  safe_yaml (1.0.4)
64
+ test-unit (3.0.8)
65
+ power_assert
68
66
  webmock (1.19.0)
69
67
  addressable (>= 2.3.6)
70
68
  crack (>= 0.3.2)
@@ -76,6 +74,7 @@ DEPENDENCIES
76
74
  rake (> 0)
77
75
  relishable!
78
76
  rspec (~> 3.1.0)
77
+ test-unit
79
78
  webmock (~> 1.19.0)
80
79
 
81
80
  BUNDLED WITH
data/lib/relish.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "relish/dynamo_helper"
2
- require "relish/cloudfront_helper"
3
2
  require "relish/s3_helper"
4
3
  require "relish/encryption_helper"
5
4
  require "relish/release"
@@ -18,6 +18,7 @@ class Relish
18
18
  :route_id => :S,
19
19
  :slug_uuid => :S,
20
20
  :slug_id => :S,
21
+ :slug_checksum => :S,
21
22
  :slug_version => :N,
22
23
  :stack => :S,
23
24
  :language_pack => :S,
@@ -1,5 +1,5 @@
1
1
  class Relish
2
- VERSION = "0.34"
2
+ VERSION = "0.35"
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relishable
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.34'
4
+ version: '0.35'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Fine
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-10-26 00:00:00.000000000 Z
14
+ date: 2015-12-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog
@@ -69,6 +69,20 @@ dependencies:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: 3.1.0
72
+ - !ruby/object:Gem::Dependency
73
+ name: test-unit
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
72
86
  - !ruby/object:Gem::Dependency
73
87
  name: webmock
74
88
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +110,6 @@ files:
96
110
  - Gemfile
97
111
  - Gemfile.lock
98
112
  - lib/relish.rb
99
- - lib/relish/cloudfront_helper.rb
100
113
  - lib/relish/dynamo_helper.rb
101
114
  - lib/relish/encryption_helper.rb
102
115
  - lib/relish/release.rb
@@ -126,4 +139,3 @@ signing_key:
126
139
  specification_version: 4
127
140
  summary: releases
128
141
  test_files: []
129
- has_rdoc:
@@ -1,65 +0,0 @@
1
- # Adapted from https://github.com/stlondemand/aws_cf_signer
2
- # Modified to support in-memory instead of on-disk signing keys
3
- require 'openssl'
4
- require 'time'
5
- require 'base64'
6
-
7
- class Relish
8
- class CloudFrontHelper
9
-
10
- attr_reader :key_pair_id
11
-
12
- def initialize(pem, key_pair_id)
13
- @key = OpenSSL::PKey::RSA.new(pem)
14
- @key_pair_id = key_pair_id
15
- end
16
-
17
- def sign(url_to_sign, policy_options = {})
18
- separator = url_to_sign =~ /\?/ ? '&' : '?'
19
- if policy_options[:policy_file]
20
- policy = IO.read(policy_options[:policy_file])
21
- "#{url_to_sign}#{separator}Policy=#{encode_policy(policy)}&Signature=#{create_signature(policy)}&Key-Pair-Id=#{@key_pair_id}"
22
- else
23
- raise ArgumentError.new("'ending' argument is required") if policy_options[:ending].nil?
24
- if policy_options.keys.size == 1
25
- # Canned Policy - shorter URL
26
- expires_at = epoch_time(policy_options[:ending])
27
- policy = %({"Statement":[{"Resource":"#{url_to_sign}","Condition":{"DateLessThan":{"AWS:EpochTime":#{expires_at}}}}]})
28
- "#{url_to_sign}#{separator}Expires=#{expires_at}&Signature=#{create_signature(policy)}&Key-Pair-Id=#{@key_pair_id}"
29
- else
30
- # Custom Policy
31
- resource = policy_options[:resource] || url_to_sign
32
- policy = generate_custom_policy(resource, policy_options)
33
- "#{url_to_sign}#{separator}Policy=#{encode_policy(policy)}&Signature=#{create_signature(policy)}&Key-Pair-Id=#{@key_pair_id}"
34
- end
35
- end
36
- end
37
-
38
- def generate_custom_policy(resource, options)
39
- conditions = ["\"DateLessThan\":{\"AWS:EpochTime\":#{epoch_time(options[:ending])}}"]
40
- conditions << "\"DateGreaterThan\":{\"AWS:EpochTime\":#{epoch_time(options[:starting])}}" if options[:starting]
41
- conditions << "\"IpAddress\":{\"AWS:SourceIp\":\"#{options[:ip_range]}\"" if options[:ip_range]
42
- %({"Statement":[{"Resource":"#{resource}","Condition":{#{conditions.join(',')}}}}]})
43
- end
44
-
45
- def epoch_time(timelike)
46
- case timelike
47
- when String then Time.parse(timelike).to_i
48
- when Time then timelike.to_i
49
- else raise ArgumentError.new("Invalid argument - String or Time required - #{timelike.class} passed.")
50
- end
51
- end
52
-
53
- def encode_policy(policy)
54
- url_safe(Base64.encode64(policy))
55
- end
56
-
57
- def create_signature(policy)
58
- url_safe(Base64.encode64(@key.sign(OpenSSL::Digest::SHA1.new, (policy))))
59
- end
60
-
61
- def url_safe(s)
62
- s.gsub('+','-').gsub('=','_').gsub('/','~').gsub(/\n/,'').gsub(' ','')
63
- end
64
- end
65
- end