s3_website 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
3
  - 1.9.3
5
4
  - 2.0.0
data/README.md CHANGED
@@ -308,6 +308,12 @@ If you are not sure how to test your pull request, you can ask the [gem owners
308
308
  However, by including proper tests, you increase the chances of your pull
309
309
  request being incorporated into future releases.
310
310
 
311
+ #### Checklist for new features
312
+
313
+ * Is it tested?
314
+ * Is it documented in README?
315
+ * Is it mentioned in `resources/configuration_file_template.yml`?
316
+
311
317
  ## License
312
318
 
313
319
  MIT. See the LICENSE file for more information.
data/changelog.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 0.4.0
6
+
7
+ * Include the available configs in the sample s3_website.yml file
8
+
5
9
  ## 0.3.0
6
10
 
7
11
  * Add Nanoc support
@@ -0,0 +1,55 @@
1
+ Feature: displaying help text in the command-line interface
2
+
3
+ As a user
4
+ I want to see the available commands and options right on CLI
5
+ So that I don't have to browse the documentation on the web
6
+
7
+ @starts-new-os-process
8
+ Scenario: User wants to know what he can do with s3_website
9
+ When I run `s3_website`
10
+ Then the output should contain:
11
+ """
12
+ Commands:
13
+ s3_website cfg SUBCOMMAND ...ARGS # Operate on the config file
14
+ s3_website help [COMMAND] # Describe available commands or one spe...
15
+ s3_website push # Push local files with the S3 website
16
+ """
17
+
18
+ @starts-new-os-process
19
+ Scenario: User wants to know what the push command does
20
+ When I run `s3_website help push`
21
+ Then the output should contain:
22
+ """
23
+ Usage:
24
+ s3_website push
25
+ """
26
+
27
+ @starts-new-os-process
28
+ Scenario: User wants to know what the cfg command does
29
+ When I run `s3_website cfg`
30
+ Then the output should contain:
31
+ """
32
+ Commands:
33
+ s3_website cfg apply # Apply the configuration on the AWS services
34
+ s3_website cfg create # Create a config file with placeholder values
35
+ s3_website cfg help [COMMAND] # Describe subcommands or one specific subco...
36
+ """
37
+
38
+ @starts-new-os-process
39
+ Scenario: User wants to know what the cfg apply command does
40
+ When I run `s3_website cfg help apply`
41
+ Then the output should contain:
42
+ """
43
+ Usage:
44
+ s3_website apply
45
+ """
46
+
47
+ @starts-new-os-process
48
+ @wip
49
+ Scenario: User wants to know what the cfg create command does
50
+ When I run `s3_website cfg help create`
51
+ Then the output should contain:
52
+ """
53
+ Usage:
54
+ s3_website create
55
+ """
@@ -55,6 +55,47 @@ Feature: Instructions for a new user
55
55
  s3_bucket: your.blog.bucket.com
56
56
  """
57
57
 
58
+ @starts-new-os-process
59
+ Scenario: The user wants to know the available configurations by looking at the cfg file
60
+ Given a directory named "_site"
61
+ When I run `s3_website push`
62
+ Then the file "s3_website.yml" should contain:
63
+ """
64
+ # max_age:
65
+ """
66
+ Then the file "s3_website.yml" should contain:
67
+ """
68
+ # gzip:
69
+ """
70
+ Then the file "s3_website.yml" should contain:
71
+ """
72
+ # s3_endpoint:
73
+ """
74
+ Then the file "s3_website.yml" should contain:
75
+ """
76
+ # ignore_on_server:
77
+ """
78
+ Then the file "s3_website.yml" should contain:
79
+ """
80
+ # s3_reduced_redundancy:
81
+ """
82
+ Then the file "s3_website.yml" should contain:
83
+ """
84
+ # cloudfront_distribution_id:
85
+ """
86
+ Then the file "s3_website.yml" should contain:
87
+ """
88
+ # cloudfront_distribution_config:
89
+ """
90
+ Then the file "s3_website.yml" should contain:
91
+ """
92
+ # redirects:
93
+ """
94
+ Then the file "s3_website.yml" should contain:
95
+ """
96
+ # routing_rules:
97
+ """
98
+
58
99
  @starts-new-os-process
59
100
  Scenario: Run s3_website with a malformed configuration file
60
101
  Given a directory named "_site"
@@ -8,6 +8,12 @@ Feature: upload a Jekyll site
8
8
  """
9
9
  Deploying features/support/test_site_dirs/jekyllrb.com/_site/* to s3-website-test.net
10
10
  Uploading 2 new file(s)
11
+ """
12
+ And the output should contain
13
+ """
11
14
  Upload css/styles.css: Success!
15
+ """
16
+ And the output should contain
17
+ """
12
18
  Upload index.html: Success!
13
19
  """
@@ -8,6 +8,12 @@ Feature: upload a Nanoc site
8
8
  """
9
9
  Deploying features/support/test_site_dirs/nanoc.ws/public/output/* to s3-website-test.net
10
10
  Uploading 2 new file(s)
11
+ """
12
+ And the output should contain
13
+ """
11
14
  Upload css/styles.css: Success!
15
+ """
16
+ And the output should contain
17
+ """
12
18
  Upload index.html: Success!
13
19
  """
@@ -12,7 +12,13 @@ Feature: upload S3 website to S3
12
12
  """
13
13
  Deploying features/support/test_site_dirs/my.blog.com/_site/* to s3-website-test.net
14
14
  Uploading 2 new file(s)
15
+ """
16
+ And the output should contain
17
+ """
15
18
  Upload css/styles.css: Success!
19
+ """
20
+ And the output should contain
21
+ """
16
22
  Upload index.html: Success!
17
23
  """
18
24
 
@@ -1,11 +1,6 @@
1
1
  module S3Website
2
2
  class ConfigLoader
3
3
  CONFIGURATION_FILE = 's3_website.yml'
4
- CONFIGURATION_FILE_TEMPLATE = <<-EOF
5
- s3_id: YOUR_AWS_S3_ACCESS_KEY_ID
6
- s3_secret: YOUR_AWS_S3_SECRET_ACCESS_KEY
7
- s3_bucket: your.blog.bucket.com
8
- EOF
9
4
 
10
5
  def self.check_project(site_dir)
11
6
  raise NoWebsiteDirectoryFound unless File.directory?(site_dir)
@@ -20,6 +15,11 @@ s3_bucket: your.blog.bucket.com
20
15
  end
21
16
  end
22
17
 
18
+ def self.read_configuration_file_template
19
+ path = File.dirname(__FILE__) + '/../../resources/configuration_file_template.yml'
20
+ cfg_template = File.open(path).read
21
+ end
22
+
23
23
  private
24
24
 
25
25
  # Load configuration from s3_website.yml
@@ -31,7 +31,7 @@ s3_bucket: your.blog.bucket.com
31
31
 
32
32
  def self.create_template_configuration_file(file)
33
33
  File.open(file, 'w') { |f|
34
- f.write(CONFIGURATION_FILE_TEMPLATE)
34
+ f.write(read_configuration_file_template)
35
35
  }
36
36
  end
37
37
 
@@ -21,7 +21,7 @@ module S3Website
21
21
  end
22
22
 
23
23
  class MalformedConfigurationFileError < S3WebsiteError
24
- def initialize(message = "I can't parse the file s3_website.yml. It should look like this:\n#{ConfigLoader::CONFIGURATION_FILE_TEMPLATE}")
24
+ def initialize(message = "I can't parse the file s3_website.yml. It should look like this:\n#{ConfigLoader.read_configuration_file_template}")
25
25
  super(message)
26
26
  end
27
27
  end
@@ -6,27 +6,37 @@ module S3Website
6
6
 
7
7
  def self.infer_site_path(candidate_path, pwd = Dir.pwd)
8
8
  if candidate_path == 'infer automatically'
9
- site_path = site_paths.
10
- map do |site_path|
11
- pwd + '/' + site_path
12
- end.
9
+ infer_automatically pwd
10
+ else
11
+ candidate_path_if_exists candidate_path
12
+ end
13
+ rescue NoWebsiteDirectoryFound => e
14
+ puts e.message
15
+ exit 1
16
+ end
17
+
18
+ private
19
+
20
+ def self.candidate_path_if_exists(candidate_path)
21
+ raise NoWebsiteDirectoryFound.new(
22
+ "Can't find a website in " + candidate_path
23
+ ) unless File.exists? candidate_path
24
+ candidate_path
25
+ end
26
+
27
+ def self.infer_automatically(pwd)
28
+ site_path = site_paths.
29
+ map do |site_path|
30
+ pwd + '/' + site_path
31
+ end.
13
32
  find do |site_path|
14
- File.exists? site_path
33
+ File.exists? site_path
15
34
  end
16
35
  if site_path
17
36
  site_path
18
37
  else
19
38
  raise NoPredefinedWebsiteDirectoryFound
20
39
  end
21
- else
22
- raise NoWebsiteDirectoryFound.new(
23
- "Can't find a website in " + candidate_path
24
- ) unless File.exists? candidate_path
25
- candidate_path
26
- end
27
- rescue NoWebsiteDirectoryFound => e
28
- puts e.message
29
- exit 1
30
40
  end
31
41
  end
32
42
  end
@@ -0,0 +1,44 @@
1
+ s3_id: YOUR_AWS_S3_ACCESS_KEY_ID
2
+ s3_secret: YOUR_AWS_S3_SECRET_ACCESS_KEY
3
+ s3_bucket: your.blog.bucket.com
4
+
5
+ # Below are examples of all the available configurations.
6
+ # See README for more detailed info on each of them.
7
+
8
+ # max_age:
9
+ # "assets/*": 6000
10
+ # "*": 300
11
+
12
+ # gzip:
13
+ # - .html
14
+ # - .css
15
+ # - .md
16
+
17
+ # s3_endpoint: ap-northeast-1
18
+
19
+ # ignore_on_server: that_folder_of_stuff_i_dont_keep_locally
20
+
21
+ # s3_reduced_redundancy: true
22
+
23
+ # cloudfront_distribution_id: your-dist-id
24
+
25
+ # cloudfront_distribution_config:
26
+ # default_cache_behavior:
27
+ # min_TTL: <%= 60 * 60 * 24 %>
28
+ # aliases:
29
+ # quantity: 1
30
+ # items:
31
+ # CNAME: your.website.com
32
+
33
+ # redirects:
34
+ # index.php: /
35
+ # about.php: about.html
36
+ # music-files/promo.mp4: http://www.youtube.com/watch?v=dQw4w9WgXcQ
37
+
38
+ # routing_rules:
39
+ # - condition:
40
+ # key_prefix_equals: blog/some_path
41
+ # redirect:
42
+ # host_name: blog.example.com
43
+ # replace_key_prefix_with: some_new_path/
44
+ # http_redirect_code: 301
data/s3_website.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "s3_website"
6
- s.version = "0.3.0"
6
+ s.version = "0.4.0"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Lauri Lehmijoki"]
9
9
  s.email = ["lauri.lehmijoki@iki.fi"]
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_website
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Lauri Lehmijoki
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-06-25 00:00:00.000000000 Z
12
+ date: 2013-06-26 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: aws-sdk
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: filey-diff
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: simple-cloudfront-invalidator
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ~>
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: erubis
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - ~>
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - ~>
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: mime-types
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - '='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - '='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: thor
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - '='
88
100
  - !ruby/object:Gem::Version
@@ -90,6 +102,7 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - '='
95
108
  - !ruby/object:Gem::Version
@@ -97,6 +110,7 @@ dependencies:
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: configure-s3-website
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
115
  - - ~>
102
116
  - !ruby/object:Gem::Version
@@ -104,6 +118,7 @@ dependencies:
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
123
  - - ~>
109
124
  - !ruby/object:Gem::Version
@@ -111,48 +126,55 @@ dependencies:
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: rspec
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - '>='
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: '0'
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - '>='
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: '0'
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: rspec-expectations
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - '>='
147
+ - - ! '>='
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - '>='
155
+ - - ! '>='
137
156
  - !ruby/object:Gem::Version
138
157
  version: '0'
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: cucumber
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
- - - '>='
163
+ - - ! '>='
144
164
  - !ruby/object:Gem::Version
145
165
  version: '0'
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - '>='
171
+ - - ! '>='
151
172
  - !ruby/object:Gem::Version
152
173
  version: '0'
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: aruba
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
179
  - - ~>
158
180
  - !ruby/object:Gem::Version
@@ -160,6 +182,7 @@ dependencies:
160
182
  type: :development
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
187
  - - ~>
165
188
  - !ruby/object:Gem::Version
@@ -167,20 +190,23 @@ dependencies:
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: rake
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
- - - '>='
195
+ - - ! '>='
172
196
  - !ruby/object:Gem::Version
173
197
  version: '0'
174
198
  type: :development
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
- - - '>='
203
+ - - ! '>='
179
204
  - !ruby/object:Gem::Version
180
205
  version: '0'
181
206
  - !ruby/object:Gem::Dependency
182
207
  name: vcr
183
208
  requirement: !ruby/object:Gem::Requirement
209
+ none: false
184
210
  requirements:
185
211
  - - ~>
186
212
  - !ruby/object:Gem::Version
@@ -188,6 +214,7 @@ dependencies:
188
214
  type: :development
189
215
  prerelease: false
190
216
  version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
191
218
  requirements:
192
219
  - - ~>
193
220
  - !ruby/object:Gem::Version
@@ -195,6 +222,7 @@ dependencies:
195
222
  - !ruby/object:Gem::Dependency
196
223
  name: webmock
197
224
  requirement: !ruby/object:Gem::Requirement
225
+ none: false
198
226
  requirements:
199
227
  - - ~>
200
228
  - !ruby/object:Gem::Version
@@ -202,11 +230,12 @@ dependencies:
202
230
  type: :development
203
231
  prerelease: false
204
232
  version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
205
234
  requirements:
206
235
  - - ~>
207
236
  - !ruby/object:Gem::Version
208
237
  version: 1.8.0
209
- description: "\n Sync website files, set redirects, use HTTP performance optimisations,
238
+ description: ! "\n Sync website files, set redirects, use HTTP performance optimisations,
210
239
  deliver via\n CloudFront.\n "
211
240
  email:
212
241
  - lauri.lehmijoki@iki.fi
@@ -235,6 +264,7 @@ files:
235
264
  - features/cassettes/cucumber_tags/s3-and-cloudfront-when-updating-a-file.yml
236
265
  - features/cassettes/cucumber_tags/s3-and-cloudfront.yml
237
266
  - features/cloudfront.feature
267
+ - features/command-line-help.feature
238
268
  - features/delete.feature
239
269
  - features/instructions-for-new-user.feature
240
270
  - features/jekyll-support.feature
@@ -307,6 +337,7 @@ files:
307
337
  - lib/s3_website/tasks.rb
308
338
  - lib/s3_website/upload.rb
309
339
  - lib/s3_website/uploader.rb
340
+ - resources/configuration_file_template.yml
310
341
  - s3_website.gemspec
311
342
  - spec/lib/config_loader_spec.rb
312
343
  - spec/lib/endpoint_spec.rb
@@ -327,26 +358,33 @@ files:
327
358
  - spec/spec_helper.rb
328
359
  homepage: https://github.com/laurilehmijoki/s3_website
329
360
  licenses: []
330
- metadata: {}
331
361
  post_install_message:
332
362
  rdoc_options: []
333
363
  require_paths:
334
364
  - lib
335
365
  required_ruby_version: !ruby/object:Gem::Requirement
366
+ none: false
336
367
  requirements:
337
- - - '>='
368
+ - - ! '>='
338
369
  - !ruby/object:Gem::Version
339
370
  version: '0'
371
+ segments:
372
+ - 0
373
+ hash: 4345283461830250761
340
374
  required_rubygems_version: !ruby/object:Gem::Requirement
375
+ none: false
341
376
  requirements:
342
- - - '>='
377
+ - - ! '>='
343
378
  - !ruby/object:Gem::Version
344
379
  version: '0'
380
+ segments:
381
+ - 0
382
+ hash: 4345283461830250761
345
383
  requirements: []
346
384
  rubyforge_project:
347
- rubygems_version: 2.0.3
385
+ rubygems_version: 1.8.25
348
386
  signing_key:
349
- specification_version: 4
387
+ specification_version: 3
350
388
  summary: Manage your S3 website
351
389
  test_files:
352
390
  - features/as-library.feature
@@ -360,6 +398,7 @@ test_files:
360
398
  - features/cassettes/cucumber_tags/s3-and-cloudfront-when-updating-a-file.yml
361
399
  - features/cassettes/cucumber_tags/s3-and-cloudfront.yml
362
400
  - features/cloudfront.feature
401
+ - features/command-line-help.feature
363
402
  - features/delete.feature
364
403
  - features/instructions-for-new-user.feature
365
404
  - features/jekyll-support.feature
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 58f0b0262858ded1fa65316ca84b921529f02302
4
- data.tar.gz: 882765a34ba7e488ef2f08e2838f3c9f1d9f93f3
5
- SHA512:
6
- metadata.gz: a209de0e13692763cf9901e8a6f8bf235e8ca90a8dee600495d738ae2992ed27c286fd7138b4ba4fd375afd565b8bbd6bdbcfd97ab149a3fac76e77c56561361
7
- data.tar.gz: 0eacf9898f13c40904bd089f5f933dc173a6e955f806be1cdcb15262bc471d1bd634502cf8bf6cebcae8652b34be48444c7bfbeb08d7130a9bfa5782b4ebdbbd