middleman-aws 0.0.8 → 1.0.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 +4 -4
- data/.rvmrc +1 -1
- data/README.md +50 -31
- data/lib/middleman-aws/tasks/middleman-aws.rake +17 -25
- data/middleman-aws.gemspec +2 -2
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 128306ee099cc7965b6dbfabbffaff57afe0fcee
|
4
|
+
data.tar.gz: 3916fad18988c321d16fa35e2a00f4a81058fd50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc5ac87054c46363924561ead0edfdca6af601cdc57a356eb06f561a8c7e61b76821dedc341e13dc175437d0607b73ecf6f16714fde12d3ee4b9b364bb3eb976
|
7
|
+
data.tar.gz: e8c5ce3f8456906bee8243e4a2a799abd89ac48ba124a8e8374fb6a0c2fd52476ac4c02139885acc3487aaae3fff5743390a023b710eee5884367ab578afde75
|
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm use ruby-2.
|
1
|
+
rvm use ruby-2.2.0@middleman-aws --create
|
data/README.md
CHANGED
@@ -13,46 +13,61 @@ Simple set of [middleman](http://middlemanapp.com/) rake tasks to build and depl
|
|
13
13
|
|
14
14
|
require 'middleman-aws'
|
15
15
|
|
16
|
+
# Even though already required by the middleman-aws gem, it appears middleman does not
|
17
|
+
# pick up transitive dependency extensions early enough to avoid the
|
18
|
+
# "== Unknown Extension:" error. Add these to your main project
|
19
|
+
# (I wish this was unnecessary but don't know how to work around it)
|
20
|
+
gem 'middleman-s3_sync'
|
21
|
+
gem 'middleman-cloudfront'
|
22
|
+
|
23
|
+
|
16
24
|
### Step 3: Add your aws credentials
|
17
25
|
e.g. `~/.aws/acme.yml`
|
18
26
|
|
19
|
-
This should contain the access and secret keys generated from the selected IAM user. This is the only file that will need to reside
|
20
|
-
outside the repository. `acme` is equivalent to the directory name for your project.
|
27
|
+
This should contain the access and secret keys generated from the selected IAM user. This is the only file that will need to reside
|
28
|
+
outside the repository. `acme` is equivalent to the directory name for your project.
|
29
|
+
Don't worry, validation will make sure you have the path right.
|
21
30
|
|
22
|
-
|
23
|
-
|
31
|
+
```ruby
|
32
|
+
access_key_id: XXXXXX
|
33
|
+
secret_access_key: XXXXXX
|
34
|
+
```
|
35
|
+
|
36
|
+
If you don't create config file, then environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` will be used. If there are no such variables, then request to AWS will fail (unless middleman-aws is used on EC2 instance with correct IAM role, then AWS will take care of authorising requests).
|
24
37
|
|
25
38
|
### Step 4: Add the necessary s3_sync and Cloudfront sections to your config
|
26
39
|
This is a sample of how a common config is setup with variables extracted:
|
27
40
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
41
|
+
```ruby
|
42
|
+
# Configuration variables specific to each project
|
43
|
+
#------------------------------------------------------------------------
|
44
|
+
AWS_BUCKET = 'acme.alienfast.com'
|
45
|
+
AWS_CLOUDFRONT_DISTRIBUTION_ID = 'xxxxxx'
|
46
|
+
|
47
|
+
# Variables: Sent in on CLI by rake task via ENV
|
48
|
+
#------------------------------------------------------------------------
|
49
|
+
AWS_ACCESS_KEY = ENV['AWS_ACCESS_KEY']
|
50
|
+
AWS_SECRET = ENV['AWS_SECRET']
|
51
|
+
|
52
|
+
# https://github.com/fredjean/middleman-s3_sync
|
53
|
+
activate :s3_sync do |s3_sync|
|
54
|
+
s3_sync.bucket = AWS_BUCKET # The name of the S3 bucket you are targeting. This is globally unique.
|
55
|
+
s3_sync.aws_access_key_id = AWS_ACCESS_KEY
|
56
|
+
s3_sync.aws_secret_access_key = AWS_SECRET
|
57
|
+
s3_sync.delete = false # We delete stray files by default.
|
58
|
+
end
|
59
|
+
|
60
|
+
# https://github.com/andrusha/middleman-cloudfront
|
61
|
+
activate :cloudfront do |cf|
|
62
|
+
cf.access_key_id = AWS_ACCESS_KEY
|
63
|
+
cf.secret_access_key = AWS_SECRET
|
64
|
+
cf.distribution_id = AWS_CLOUDFRONT_DISTRIBUTION_ID
|
65
|
+
# cf.filter = /\.html$/i
|
66
|
+
end
|
67
|
+
```
|
53
68
|
|
54
69
|
# Usage
|
55
|
-
Run the desired rake task. It's as simple as `rake mm:publish` in one step, or you can choose to do things one step at a time.
|
70
|
+
Run the desired rake task. It's as simple as `rake mm:publish` in one step, or you can choose to do things one step at a time.
|
56
71
|
See the available rake tasks below or run `rake -T`
|
57
72
|
|
58
73
|
# Available Rake Tasks
|
@@ -64,6 +79,10 @@ See the available rake tasks below or run `rake -T`
|
|
64
79
|
rake mm:publish # One step clobber, build, deploy
|
65
80
|
rake mm:show_config # Show config
|
66
81
|
|
82
|
+
# Real World Sample
|
83
|
+
If you are just getting started with middleman and want to get a quick jumpstart on your `Gemfile` and `congfig.rb`,
|
84
|
+
check out the source in the `samples` directory for a set of commonly used configurations/gems/extensions.
|
85
|
+
|
67
86
|
## Contributing
|
68
87
|
1. Fork it
|
69
88
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
@@ -73,4 +92,4 @@ See the available rake tasks below or run `rake -T`
|
|
73
92
|
|
74
93
|
## Copyright
|
75
94
|
|
76
|
-
Copyright (c) 2014 AlienFast, LLC. See MIT LICENSE.txt for further details.
|
95
|
+
Copyright (c) 2014 AlienFast, LLC. See MIT LICENSE.txt for further details.
|
@@ -24,22 +24,17 @@ namespace :mm do
|
|
24
24
|
|
25
25
|
puts '## Deploy starting...'
|
26
26
|
cd 'build' do
|
27
|
-
# system 'git add .'
|
28
27
|
system 'git add -u'
|
29
28
|
message = "Site updated at #{Time.now}"
|
30
29
|
puts "## Commiting: #{message}"
|
31
30
|
system "git commit -m \"#{message}\""
|
32
|
-
# puts "## Pushing generated website"
|
33
|
-
# system "git push origin master"
|
34
|
-
# puts "## Github Pages deploy complete"
|
35
31
|
end
|
36
32
|
|
37
|
-
credentials
|
38
|
-
aws_env = "AWS_ACCESS_KEY=#{credentials['access_key_id']} AWS_SECRET=#{credentials['secret_access_key']}"
|
33
|
+
aws_env = "AWS_ACCESS_KEY=#{credentials[:access_key_id]} AWS_SECRET=#{credentials[:secret_access_key]}"
|
39
34
|
puts '## Syncing to S3...'
|
40
35
|
system "#{aws_env} bundle exec middleman s3_sync"
|
41
36
|
puts '## Invalidating cloudfront...'
|
42
|
-
system "#{aws_env}
|
37
|
+
system "#{aws_env} bundle exec middleman invalidate"
|
43
38
|
puts '## Deploy complete.'
|
44
39
|
end
|
45
40
|
|
@@ -56,33 +51,30 @@ namespace :mm do
|
|
56
51
|
desc 'Show config'
|
57
52
|
task :show_config do |t, args|
|
58
53
|
|
59
|
-
credentials!
|
60
|
-
|
61
54
|
puts "\n----------------------------------------------------------------------------------"
|
62
55
|
puts 'Configuration:'
|
63
56
|
puts "\t:working directory: #{Rake.original_dir}"
|
64
57
|
puts "\t:project: #{project}"
|
65
58
|
puts "\t:aws_secrets_file: #{aws_secrets_file}"
|
66
|
-
puts "\t:access_key_id: #{credentials[
|
59
|
+
puts "\t:access_key_id: #{credentials[:access_key_id]}"
|
67
60
|
puts "----------------------------------------------------------------------------------\n"
|
68
61
|
end
|
69
62
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
credentials
|
74
|
-
|
75
|
-
['access_key_id', 'secret_access_key'].each do |key|
|
76
|
-
value = credentials[key]
|
77
|
-
raise "\nThe #{key} must be specified in the #{aws_secrets_file}.\n\n" if value.nil?
|
63
|
+
def credentials
|
64
|
+
unless File.exists?(aws_secrets_file)
|
65
|
+
puts "\nWarning: Config file is missing: #{aws_secrets_file}.\nFile contents should look like:\naccess_key_id: XXXX\nsecret_access_key: XXXX\n\n."
|
78
66
|
end
|
79
|
-
end
|
80
67
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
68
|
+
# load from a user directory i.e. ~/.aws/acme.yml
|
69
|
+
credentials = File.exists?(aws_secrets_file) ? YAML::load_file(aws_secrets_file) : {}
|
70
|
+
|
71
|
+
access_key_id = credentials.fetch('access_key_id') { ENV['AWS_ACCESS_KEY_ID'] }
|
72
|
+
secret_access_key = credentials.fetch('secret_access_key') { ENV['AWS_SECRET_ACCESS_KEY'] }
|
73
|
+
|
74
|
+
{
|
75
|
+
access_key_id: access_key_id
|
76
|
+
secret_access_key: secret_access_key
|
77
|
+
}
|
86
78
|
end
|
87
79
|
|
88
80
|
def aws_secrets_file
|
@@ -92,4 +84,4 @@ namespace :mm do
|
|
92
84
|
def project
|
93
85
|
File.basename(Rake.original_dir)
|
94
86
|
end
|
95
|
-
end
|
87
|
+
end
|
data/middleman-aws.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 = 'middleman-aws'
|
6
|
-
s.version = '0.0
|
6
|
+
s.version = '1.0.0'
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
|
9
9
|
s.authors = ['Kevin Ross']
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.homepage = 'https://github.com/alienfast/middleman-aws'
|
18
18
|
s.license = 'MIT'
|
19
19
|
|
20
|
-
s.files = `git ls-files`.split(
|
20
|
+
s.files = `git ls-files`.split($/).reject { |f| f =~ /^samples\// }
|
21
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
23
|
s.require_paths = ['lib']
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ross
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-s3_sync
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: middleman-cloudfront
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: |2
|
@@ -60,8 +60,8 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .gitignore
|
64
|
-
- .rvmrc
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rvmrc"
|
65
65
|
- Gemfile
|
66
66
|
- LICENSE
|
67
67
|
- README.md
|
@@ -80,17 +80,17 @@ require_paths:
|
|
80
80
|
- lib
|
81
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.5
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Simple set of middleman rake tasks to build and deploy to AWS using s3_sync
|