s3_website 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abf40795dc9d2a58f7c49cdca9aa4afe08719c83
4
- data.tar.gz: 49ece41b838b6ca727f0f7f801633c732c4cf414
3
+ metadata.gz: a9306932139b739b36781d1d9adabc156bf77071
4
+ data.tar.gz: 8f7ab21fa137972d9e57319d537612d6ce925bed
5
5
  SHA512:
6
- metadata.gz: dce2b656e14459f9cdc879ef1a37035ba97b33f9627c3b5404bc2e1a7945d79d3af9a5e5f32b532f9725488e010d76073e74d3a9d7ca70e108d3c27f5d1bfb8f
7
- data.tar.gz: b494dc93e43b2c6656c7bc5495320fdd275d1ba803deb593250795e5f20a845ba32b227b8e0eec8197c1d07611ec26c810c9812c6bc548a3cf2bb5a111a48c83
6
+ metadata.gz: f8d6a5fc7492d1528db84043a3c565c5f637274aac5557cddf5d264dd0f62c7f5386ae48c75f067e0e108f249ee75ec9e67a5b61190ae6f1eb8d2d5d6b32feae
7
+ data.tar.gz: 3ffe1003b8e80128e4919434a38d1854203b2fec73702c53e1565daf06f563a886e4d9d782c870f4608a67978ed53401a3c2d3567b3bfcb2e0a9fd6bb2e83978
data/README.md CHANGED
@@ -1,40 +1,40 @@
1
- # s3_website – Deploy your website to S3.
1
+ # Deploy your website to S3
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/laurilehmijoki/s3_website.png)] (http://travis-ci.org/laurilehmijoki/s3_website)
3
+ [![Build Status](https://travis-ci.org/laurilehmijoki/s3_website.png?branch=master)](https://travis-ci.org/laurilehmijoki/s3_website)
4
4
  [![Gem Version](https://fury-badge.herokuapp.com/rb/s3_website.png)](http://badge.fury.io/rb/s3_website)
5
5
 
6
- ## What s3_website can do for you
6
+ ## What `s3_website` can do for you
7
7
 
8
- * Upload your site to AWS S3
8
+ * Create and configure an S3 website for you
9
+ * Upload your static website to AWS S3
9
10
  * Help you use AWS Cloudfront to distribute your website
10
- * Create an S3 website for you
11
11
  * Improve page speed with HTTP cache control and gzipping
12
12
  * Set HTTP redirects for your website
13
13
  * (for other features, see the documentation below)
14
14
 
15
15
  ## Install
16
16
 
17
+ <span style="color: yellow">This project is still on beta level. Expect backward
18
+ incompatible changes.</span>
19
+
17
20
  gem install s3_website
18
21
 
19
22
  ## Usage
20
23
 
24
+ Here's how you can get started:
25
+
21
26
  * Go to your website directory
22
- * Run `s3_website cfg create`. It generates a configuration file called `s3_website.yml` that looks like this:
23
- <pre>
24
- s3_id: YOUR_AWS_S3_ACCESS_KEY_ID
25
- s3_secret: YOUR_AWS_S3_SECRET_ACCESS_KEY
26
- s3_bucket: your.blog.bucket.com
27
- </pre>
27
+ * Run `s3_website cfg create`. It generates a configuration file called `s3_website.yml`
28
28
  * Edit it with your details (you can use [ERB](http://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html) in the file)
29
- * Run `configure-s3-website --config-file s3_website.yml` This will configure
29
+ * Run `s3_website cfg apply` This will configure
30
30
  your bucket to function as an S3 website. If the bucket does not exist,
31
- `configure-s3-website` will create it for you.
32
-
31
+ `s3_website cfg apply` will create it for you.
33
32
  * Run `s3_website push` to push your website to S3. Congratulations! You are live.
34
33
 
35
- (If you are using `s3_website` on an [EC2 instance with IAM
36
- roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UsingIAM.html#UsingIAMrolesWithAmazonEC2Instances),
37
- you can omit the `s3_id` and `s3_secret` keys in the config file.)
34
+ `s3_website` attempts to be a command-line interface tool that is easy to
35
+ understand and use. For example, `s3_website --help` should print you all the
36
+ things it can perform. Please create an issue if you think the tool is
37
+ incomprehensible or inconsistent.
38
38
 
39
39
  ### Using environment variables
40
40
 
@@ -46,9 +46,15 @@ s3_secret: <%= ENV['S3_SECRET'] %>
46
46
  s3_bucket: blog.example.com
47
47
  ```
48
48
 
49
+ (If you are using `s3_website` on an [EC2 instance with IAM
50
+ roles](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UsingIAM.html#UsingIAMrolesWithAmazonEC2Instances),
51
+ you can omit the `s3_id` and `s3_secret` keys in the config file.)
52
+
49
53
  ## Project goals
50
54
 
51
55
  * Provide a command-line interface tool for deploying and managing S3 websites
56
+ * Create commands such as `s3_website push`, `s3_website cfg create` and
57
+ `s3_website cfg apply`
52
58
  * Let the user have all the S3 website configurations in a file
53
59
  * Minimise or remove the need to use the AWS Console
54
60
  * Allow the user to deliver the website via CloudFront
@@ -148,13 +154,9 @@ It is easy to deliver your S3-based web site via Cloudfront, the CDN of Amazon.
148
154
 
149
155
  #### Creating a new CloudFront distribution
150
156
 
151
- When you run the command `configure-s3-website`, it will ask you whether you
152
- want to deliver your website via CloudFront. If you answer yes,
153
- `configure-s3-website` will create a CloudFront distribution for you.
154
-
155
- This feature was added into the version 1.3.0 of the `configure-s3-website` gem.
156
- For more information, see the [gem's
157
- documentation](https://github.com/laurilehmijoki/configure-s3-website).
157
+ When you run the command `s3_website cfg apply`, it will ask you whether you
158
+ want to deliver your website via CloudFront. If you answer yes, command will
159
+ create a CloudFront distribution for you.
158
160
 
159
161
  #### Using your existing CloudFront distribution
160
162
 
@@ -168,8 +170,7 @@ thus force the CDN system to reload the changes from your website S3 bucket.
168
170
 
169
171
  #### Specifying custom settings for your CloudFront distribution
170
172
 
171
- The gem `configure-s3-website`, which is a dependency of `s3_website`, lets you
172
- define custom settings for your CloudFront distribution.
173
+ `s3_website` lets you define custom settings for your CloudFront distribution.
173
174
 
174
175
  For example, like this you can define a your own TTL and CNAME:
175
176
 
@@ -183,9 +184,8 @@ cloudfront_distribution_config:
183
184
  CNAME: your.website.com
184
185
  ```
185
186
 
186
- See the [gem's
187
- documentation](https://github.com/laurilehmijoki/configure-s3-website) for more
188
- info.
187
+ Once you've saved the configuration into `s3_website.yml`, you can apply them by
188
+ running `s3_website cfg apply`.
189
189
 
190
190
  ### The headless mode
191
191
 
@@ -194,8 +194,7 @@ s3_website has a headless mode, where human interactions are disabled.
194
194
  In the headless mode, `s3_website` will automatically delete the files on the S3
195
195
  bucket that are not on your local computer.
196
196
 
197
- Enable the headless mode by adding the `--headless` or `-h` argument after
198
- `s3_website`.
197
+ Enable the headless mode by adding the `--headless` argument after `s3_website`.
199
198
 
200
199
  ### Configuring redirects on your S3 website
201
200
 
@@ -235,13 +234,13 @@ routing_rules:
235
234
  http_redirect_code: 301
236
235
  ```
237
236
 
238
- After adding the configuration, run the command `configure-s3-website --config
239
- s3_website.yml` on your command-line interface. This will apply the routing
240
- rules on your S3 bucket.
237
+ After adding the configuration, run the command `s3_website cfg apply` on your
238
+ command-line interface. This will apply the routing rules on your S3 bucket.
241
239
 
242
240
  For more information on configuring redirects, see the documentation of the
243
241
  [configure-s3-website](https://github.com/laurilehmijoki/configure-s3-website#configuring-redirects)
244
- gem, which comes as a transitive dependency of the `s3_website` gem.
242
+ gem, which comes as a transitive dependency of the `s3_website` gem. (The
243
+ command `s3_website cfg apply` internally calls the `configure-s3-website` gem.)
245
244
 
246
245
  ### Using `s3_website` as a library
247
246
 
data/bin/s3_website CHANGED
@@ -5,12 +5,26 @@ require File.dirname(__FILE__) + '/../lib/s3_website'
5
5
  class Cfg < Thor
6
6
  desc 'create', 'Create a config file with placeholder values'
7
7
  def create
8
- S3Website::Tasks.config_create parent_options[:site]
8
+ S3Website::Tasks.config_create Dir.pwd
9
+ end
10
+
11
+ desc 'apply', 'Apply the configuration on the AWS services'
12
+ long_desc <<-LONGDESC
13
+ `s3_website cfg apply` will apply the configuration the S3 bucket.
14
+
15
+ In addition, if you CloudFront related settings, this command will apply them on the CloudFront distribution.
16
+
17
+ If the S3 bucket does not exist, this command will create it
18
+ and configure it to function as a website.
19
+ LONGDESC
20
+ def apply
21
+ puts 'Applying the configurations in s3_website.yml on the AWS services ...'
22
+ puts `configure-s3-website --config-file s3_website.yml`
9
23
  end
10
24
  end
11
25
 
12
26
  class Cli < Thor
13
- class_option(
27
+ option(
14
28
  :site,
15
29
  :type => :string,
16
30
  :default => '_site',
data/changelog.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
- ## HEAD
5
+ ## 0.2.1
6
6
 
7
- * TBA
7
+ * Remove Gemfile.lock
8
+ * Rename gemspec file
9
+
10
+ ## 0.2.0
11
+
12
+ * Add command `s3_website cfg apply`
13
+
14
+ ## 0.1.0
15
+
16
+ * First version
@@ -12,13 +12,18 @@ s3_bucket: your.blog.bucket.com
12
12
  end
13
13
 
14
14
  # Raise NoConfigurationFileError if the configuration file does not exists
15
- def self.check_s3_configuration(site_dir)
16
- unless File.exists?(get_configuration_file(site_dir))
17
- create_template_configuration_file site_dir
15
+ def self.check_s3_configuration(dir)
16
+ config_file = dir + '/' + CONFIGURATION_FILE
17
+ unless File.exists?(config_file)
18
+ create_template_configuration_file config_file
18
19
  raise NoConfigurationFileError
19
20
  end
20
21
  end
21
22
 
23
+ def self.get_configuration_file(site_dir)
24
+ "#{site_dir}/../#{CONFIGURATION_FILE}"
25
+ end
26
+
22
27
  private
23
28
 
24
29
  # Load configuration from s3_website.yml
@@ -28,8 +33,8 @@ s3_bucket: your.blog.bucket.com
28
33
  return config
29
34
  end
30
35
 
31
- def self.create_template_configuration_file(site_dir)
32
- File.open(get_configuration_file(site_dir), 'w') { |f|
36
+ def self.create_template_configuration_file(file)
37
+ File.open(file, 'w') { |f|
33
38
  f.write(CONFIGURATION_FILE_TEMPLATE)
34
39
  }
35
40
  end
@@ -48,9 +53,5 @@ s3_bucket: your.blog.bucket.com
48
53
  }
49
54
  config
50
55
  end
51
-
52
- def self.get_configuration_file(site_dir)
53
- "#{site_dir}/../#{CONFIGURATION_FILE}"
54
- end
55
56
  end
56
57
  end
@@ -2,7 +2,7 @@ module S3Website
2
2
  class Tasks
3
3
  def self.push(site_dir, in_headless_mode = false)
4
4
  ConfigLoader.check_project site_dir
5
- ConfigLoader.check_s3_configuration site_dir
5
+ ConfigLoader.check_s3_configuration site_dir + '/../'
6
6
  config = S3Website::ConfigLoader.load_configuration site_dir
7
7
  new_files_count, changed_files_count, deleted_files_count, changed_files, changed_redirects =
8
8
  Uploader.run(site_dir, config, in_headless_mode)
@@ -20,8 +20,8 @@ module S3Website
20
20
  exit 1
21
21
  end
22
22
 
23
- def self.config_create(site_dir)
24
- ConfigLoader.check_s3_configuration site_dir
23
+ def self.config_create(dir)
24
+ ConfigLoader.check_s3_configuration dir
25
25
  rescue S3WebsiteError => e
26
26
  puts e.message
27
27
  exit 1
@@ -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.1.0"
6
+ s.version = "0.2.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_website
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lauri Lehmijoki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-24 00:00:00.000000000 Z
11
+ date: 2013-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -218,7 +218,6 @@ files:
218
218
  - .gitignore
219
219
  - .travis.yml
220
220
  - Gemfile
221
- - Gemfile.lock
222
221
  - LICENSE
223
222
  - README.md
224
223
  - Rakefile
@@ -297,7 +296,7 @@ files:
297
296
  - lib/s3_website/tasks.rb
298
297
  - lib/s3_website/upload.rb
299
298
  - lib/s3_website/uploader.rb
300
- - s3-website.gemspec
299
+ - s3_website.gemspec
301
300
  - spec/lib/config_loader_spec.rb
302
301
  - spec/lib/endpoint_spec.rb
303
302
  - spec/lib/keyboard_spec.rb
data/Gemfile.lock DELETED
@@ -1,81 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- s3_website (0.1.0)
5
- aws-sdk (~> 1.8.5)
6
- configure-s3-website (~> 1)
7
- erubis (~> 2.7.0)
8
- filey-diff (~> 1)
9
- mime-types (= 1.19)
10
- simple-cloudfront-invalidator (~> 1)
11
- thor (= 0.18.1)
12
-
13
- GEM
14
- remote: http://rubygems.org/
15
- specs:
16
- addressable (2.3.4)
17
- aruba (0.5.3)
18
- childprocess (>= 0.3.6)
19
- cucumber (>= 1.1.1)
20
- rspec-expectations (>= 2.7.0)
21
- aws-sdk (1.8.5)
22
- json (~> 1.4)
23
- nokogiri (>= 1.4.4)
24
- uuidtools (~> 2.1)
25
- builder (3.2.2)
26
- childprocess (0.3.9)
27
- ffi (~> 1.0, >= 1.0.11)
28
- colored (1.2)
29
- configure-s3-website (1.4.0)
30
- deep_merge (= 1.0.0)
31
- crack (0.4.0)
32
- safe_yaml (~> 0.9.0)
33
- cucumber (1.3.2)
34
- builder (>= 2.1.2)
35
- diff-lcs (>= 1.1.3)
36
- gherkin (~> 2.12.0)
37
- multi_json (~> 1.3)
38
- deep_merge (1.0.0)
39
- diff-lcs (1.2.4)
40
- erubis (2.7.0)
41
- ffi (1.9.0)
42
- filey-diff (1.2.1)
43
- gherkin (2.12.0)
44
- multi_json (~> 1.3)
45
- json (1.8.0)
46
- mime-types (1.19)
47
- mini_portile (0.5.0)
48
- multi_json (1.7.7)
49
- nokogiri (1.6.0)
50
- mini_portile (~> 0.5.0)
51
- rake (10.1.0)
52
- rspec (2.13.0)
53
- rspec-core (~> 2.13.0)
54
- rspec-expectations (~> 2.13.0)
55
- rspec-mocks (~> 2.13.0)
56
- rspec-core (2.13.1)
57
- rspec-expectations (2.13.0)
58
- diff-lcs (>= 1.1.3, < 2.0)
59
- rspec-mocks (2.13.1)
60
- safe_yaml (0.9.3)
61
- simple-cloudfront-invalidator (1.0.0)
62
- colored (= 1.2)
63
- thor (0.18.1)
64
- uuidtools (2.1.4)
65
- vcr (2.5.0)
66
- webmock (1.8.11)
67
- addressable (>= 2.2.7)
68
- crack (>= 0.1.7)
69
-
70
- PLATFORMS
71
- ruby
72
-
73
- DEPENDENCIES
74
- aruba (~> 0.5.1)
75
- cucumber
76
- rake
77
- rspec
78
- rspec-expectations
79
- s3_website!
80
- vcr (~> 2.5.0)
81
- webmock (~> 1.8.0)