lester 1.0.0.pre1 → 1.0.0.pre2

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: c17183ee2fb1a8f5b7001d8dca46b6d14ab655e5
4
- data.tar.gz: 714db6829427e804e423a0012c873eb893c29846
3
+ metadata.gz: d9cd94f15e8e4c24b2865432990ecb938b130bbb
4
+ data.tar.gz: a7e6b43cc55488bfbe5fa6942b531558f03f4b9f
5
5
  SHA512:
6
- metadata.gz: c3f392540c9b2f5a8d8322eb3e69df96ad068cc756e3dd85c55fdc9b50603686496d5485564d76cc4d70e02d5a4a340491f3e184f930e735a331176b1badb089
7
- data.tar.gz: 1acf0d620e036b9d2081af46ec2dda0d3cb708053e102e30cb296515cd73e478a2c6c153fcf1469e0ef69b4d00b5180a6b7e16350169f40545b0e8aa49d73e89
6
+ metadata.gz: 7e00b55bcd24fafe1f087af99e350829e60e59a43a862992126cdd3015e763cb9383dcd243affb02642f815fa5a26db8da34a1c3782f0bee1f63d3673b61d149
7
+ data.tar.gz: ed3b0cbae73e924428625142fa8aa0f13b93c9e9a98ea157c6cb8dd3857332db5d6bc6d1481f4392b8f1a63e4a508276b4565c2f71b8e0317142ca92b6caf4be
@@ -37,7 +37,11 @@ module Lester
37
37
  private
38
38
 
39
39
  def create_store(suffix)
40
- S3Store.new(storage_bucket, sprintf('%s/%s', @config[:domain], suffix), store_options)
40
+ uri = URI(sprintf('s3://%s', @config[:storage_bucket]))
41
+ bucket_name = uri.host
42
+ prefix = sprintf('%s/%s/%s', uri.path, @config[:domain], suffix).sub('/', '')
43
+ bucket = Aws::S3::Bucket.new(bucket_name)
44
+ S3Store.new(bucket, prefix, store_options)
41
45
  end
42
46
 
43
47
  def store_options
@@ -55,10 +59,6 @@ module Lester
55
59
  @site_bucket ||= Aws::S3::Bucket.new(@config[:site_bucket])
56
60
  end
57
61
 
58
- def storage_bucket
59
- @storage_bucket ||= Aws::S3::Bucket.new(@config[:storage_bucket])
60
- end
61
-
62
62
  def iam
63
63
  @iam ||= Aws::IAM::Client.new
64
64
  end
@@ -1,3 +1,3 @@
1
1
  module Lester
2
- VERSION = '1.0.0.pre1'.freeze
2
+ VERSION = '1.0.0.pre2'.freeze
3
3
  end
@@ -11,11 +11,15 @@ describe 'bin/lester init' do
11
11
  [
12
12
  'init',
13
13
  '--domain', 'example.org',
14
- '--storage-bucket', 'example-org-backup',
14
+ '--storage-bucket', storage_bucket_name,
15
15
  '--private-key', private_key_path,
16
16
  ]
17
17
  end
18
18
 
19
+ let :storage_bucket_name do
20
+ 'example-org-backup'
21
+ end
22
+
19
23
  context 'when the private key exists' do
20
24
  it 'stores it' do
21
25
  command.run
@@ -29,6 +33,18 @@ describe 'bin/lester init' do
29
33
  end
30
34
  end
31
35
 
36
+ context 'when --storage-bucket includes a prefix' do
37
+ let :storage_bucket_name do
38
+ 'example-org-backup/lester'
39
+ end
40
+
41
+ it 'stores it under the given prefix' do
42
+ command.run
43
+ object = storage_bucket.object('lester/example.org/account/private_key.json')
44
+ expect { JSON::JWK.new(JSON.parse(object.read)).to_key }.to_not raise_error
45
+ end
46
+ end
47
+
32
48
  context 'when the private key does not exist' do
33
49
  let :private_key_path do
34
50
  'this/should/not/exist.pem'
@@ -13,12 +13,16 @@ describe 'bin/lester renew' do
13
13
  '--domain', 'example.org',
14
14
  '--endpoint', 'http://127.0.0.1:4000',
15
15
  '--site-bucket', 'example-org-site',
16
- '--storage-bucket', 'example-org-backup',
16
+ '--storage-bucket', storage_bucket_name,
17
17
  '--email', 'contact@example.org',
18
18
  '--distribution-id', 'distribution-id',
19
19
  ]
20
20
  end
21
21
 
22
+ let :storage_bucket_name do
23
+ 'example-org-backup'
24
+ end
25
+
22
26
  before do
23
27
  storage_bucket.put_object(key: 'example.org/account/private_key.json', body: Pathname.new(private_key_path))
24
28
  cloudfront.add_config('distribution-id', {
@@ -119,6 +123,22 @@ describe 'bin/lester renew' do
119
123
  end
120
124
  end
121
125
  end
126
+
127
+ context 'when --storage-bucket includes a prefix' do
128
+ let :storage_bucket_name do
129
+ 'example-org-backup/lester'
130
+ end
131
+
132
+ it 'stores everything under given prefix' do
133
+ storage_bucket.put_object(key: 'lester/example.org/account/private_key.json', body: Pathname.new(private_key_path))
134
+ command.run
135
+ keys = storage_bucket.keys.select { |k| k.start_with?('lester') }
136
+ expect(keys).to_not be_empty
137
+ keys.each do |key|
138
+ expect(key).to start_with('lester/example.org')
139
+ end
140
+ end
141
+ end
122
142
  end
123
143
 
124
144
  context 'when verification fails', vcr: { cassette_name: 'verification-fail' } do
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lester
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre1
4
+ version: 1.0.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathias Söderberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-13 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.2
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: acme-client
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +108,48 @@ dependencies:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: tara
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "<"
116
+ - !ruby/object:Gem::Version
117
+ version: '1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "<"
123
+ - !ruby/object:Gem::Version
124
+ version: '1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: github_api
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: '1'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: '1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: mime-types
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3'
97
153
  description: Let's Encrypt certificate renewer for sites hosted on S3
98
154
  email:
99
155
  - mths@sdrbrg.se
@@ -155,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
211
  version: 1.3.1
156
212
  requirements: []
157
213
  rubyforge_project:
158
- rubygems_version: 2.4.5.1
214
+ rubygems_version: 2.4.5
159
215
  signing_key:
160
216
  specification_version: 4
161
217
  summary: Renew Let's Encrypt certificates using S3