middleman-aws 0.0.5
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 +7 -0
- data/.gitignore +7 -0
- data/.rvmrc +1 -0
- data/Gemfile +19 -0
- data/LICENSE +21 -0
- data/README.md +74 -0
- data/Rakefile +15 -0
- data/features/support/env.rb +4 -0
- data/lib/middleman-aws.rb +5 -0
- data/lib/middleman-aws/tasks/aws.rake +95 -0
- data/middleman-aws.gemspec +32 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7b1c91da6c20bd09bdd3deb9d8af1e144761303f
|
4
|
+
data.tar.gz: 9173e8f0f7504f905045a099bd88b43a07a6cffb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3e4664820bef0a0de6b97055bde8382a55ad10c321c191da047fa4e701d07250f03fd6841b6034e34cfe9ebee70cac9fd24b12649aacc6a584e612f55dfec1fa
|
7
|
+
data.tar.gz: a1711687dfaaaa2a749b9524adedba8f09ec11c361f1b4090370f198420633639563732a3d0fecaf5b70896b62ef47ffd87eba901e38043700bbea1e7c8ec278
|
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-2.0.0@middleman-aws --create
|
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# If you have OpenSSL installed, we recommend updating
|
2
|
+
# the following line to use "https"
|
3
|
+
source 'http://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in middleman-aws.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'fivemat'
|
17
|
+
gem 'aruba'
|
18
|
+
gem 'rspec'
|
19
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 AlienFast, LLC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
middleman-aws
|
2
|
+
=============
|
3
|
+
|
4
|
+
Simple set of [middleman](http://middlemanapp.com/) rake tasks to build and deploy to AWS using s3_sync and cloudfront invalidation.
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
|
8
|
+
## Step 1: Require this gem in the `Gemfile`:
|
9
|
+
gem 'middleman-aws'
|
10
|
+
|
11
|
+
## Step 2: Require this gem in the `Rakefile`:
|
12
|
+
gem 'middleman-aws'
|
13
|
+
|
14
|
+
# Configuration
|
15
|
+
|
16
|
+
## Step 1: Add your aws credentials e.g. ~/.aws/acme.yml
|
17
|
+
This should contain the access and secret keys generated from the selected IAM user. This is the only file that will need to reside
|
18
|
+
outside the repository. `acme` is equivalent to the directory name for your project. Don't worry, validation will make sure you have it right.
|
19
|
+
|
20
|
+
access_key_id: XXXXXX
|
21
|
+
secret_access_key: XXXXXX
|
22
|
+
|
23
|
+
## Step 2: Add the necessary s3_sync and Cloudfront sections to your config
|
24
|
+
This is a sample of how a common config is setup with variables extracted:
|
25
|
+
|
26
|
+
# Configuration variables specific to each project
|
27
|
+
#------------------------------------------------------------------------
|
28
|
+
AWS_BUCKET = 'acme.alienfast.com'
|
29
|
+
AWS_CLOUDFRONT_DISTRIBUTION_ID = 'xxxxxx'
|
30
|
+
|
31
|
+
# Variables: Sent in on CLI by rake task via ENV
|
32
|
+
#------------------------------------------------------------------------
|
33
|
+
AWS_ACCESS_KEY = ENV['AWS_ACCESS_KEY']
|
34
|
+
AWS_SECRET = ENV['AWS_SECRET']
|
35
|
+
|
36
|
+
# https://github.com/fredjean/middleman-s3_sync
|
37
|
+
activate :s3_sync do |s3_sync|
|
38
|
+
s3_sync.bucket = AWS_BUCKET # The name of the S3 bucket you are targeting. This is globally unique.
|
39
|
+
s3_sync.aws_access_key_id = AWS_ACCESS_KEY
|
40
|
+
s3_sync.aws_secret_access_key = AWS_SECRET
|
41
|
+
s3_sync.delete = false # We delete stray files by default.
|
42
|
+
end
|
43
|
+
|
44
|
+
# https://github.com/andrusha/middleman-cloudfront
|
45
|
+
activate :cloudfront do |cf|
|
46
|
+
cf.access_key_id = AWS_ACCESS_KEY
|
47
|
+
cf.secret_access_key = AWS_SECRET
|
48
|
+
cf.distribution_id = AWS_CLOUDFRONT_DISTRIBUTION_ID
|
49
|
+
# cf.filter = /\.html$/i
|
50
|
+
end
|
51
|
+
|
52
|
+
# Usage
|
53
|
+
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.
|
54
|
+
See the available rake tasks below or run `rake -T`
|
55
|
+
|
56
|
+
# Available Rake Tasks
|
57
|
+
|
58
|
+
rake mm:build # Compile all files in the build directory
|
59
|
+
rake mm:clobber # Remove all files in the build direcory
|
60
|
+
rake mm:deploy # Deploy to S3 and invalidate Cloudfront after a Git commit/push
|
61
|
+
rake mm:preview # Run the preview server at http://localhost:4567
|
62
|
+
rake mm:publish # One step clobber, build, deploy
|
63
|
+
rake mm:show_config # Show config
|
64
|
+
|
65
|
+
## Contributing
|
66
|
+
1. Fork it
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create new Pull Request
|
71
|
+
|
72
|
+
## Copyright
|
73
|
+
|
74
|
+
Copyright (c) 2014 AlienFast, LLC. See MIT LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
# require 'bundler'
|
3
|
+
# Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
# require 'cucumber/rake/task'
|
6
|
+
#
|
7
|
+
# Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
8
|
+
# t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# require 'rake/clean'
|
12
|
+
#
|
13
|
+
# task test: ['cucumber']
|
14
|
+
#
|
15
|
+
# task default: :test
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#------------------------------------------------------------------------
|
2
|
+
# Rakefile
|
3
|
+
#------------------------------------------------------------------------
|
4
|
+
require 'yaml'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
namespace :mm do
|
8
|
+
|
9
|
+
desc 'Remove all files in the build directory'
|
10
|
+
task :clobber do |t, args|
|
11
|
+
# kill the old package dir
|
12
|
+
rm_r 'build' rescue nil
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Compile all files into the build directory'
|
16
|
+
task :build do
|
17
|
+
puts '## Compiling static pages'
|
18
|
+
status = system 'bundle exec middleman build'
|
19
|
+
puts status ? 'Build successful.' : 'Build failed.'
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Deploy to S3 and invalidate Cloudfront after a Git commit/push'
|
23
|
+
task :deploy do
|
24
|
+
|
25
|
+
puts '## Deploy starting...'
|
26
|
+
cd 'build' do
|
27
|
+
# system 'git add .'
|
28
|
+
system 'git add -u'
|
29
|
+
message = "Site updated at #{Time.now}"
|
30
|
+
puts "## Commiting: #{message}"
|
31
|
+
system "git commit -m \"#{message}\""
|
32
|
+
# puts "## Pushing generated website"
|
33
|
+
# system "git push origin master"
|
34
|
+
# puts "## Github Pages deploy complete"
|
35
|
+
end
|
36
|
+
|
37
|
+
credentials!
|
38
|
+
aws_env = "AWS_ACCESS_KEY=#{credentials['access_key_id']} AWS_SECRET=#{credentials['secret_access_key']}"
|
39
|
+
puts '## Syncing to S3...'
|
40
|
+
system "#{aws_env} bundle exec middleman s3_sync"
|
41
|
+
puts '## Invalidating cloudfront...'
|
42
|
+
system "#{aws_env} bundle exec middleman invalidate"
|
43
|
+
puts '## Deploy complete.'
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'One step clobber, build, deploy'
|
47
|
+
task :publish => [:clobber, :build, :deploy] do
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
desc 'Run the preview server at http://localhost:4567'
|
52
|
+
task :preview do
|
53
|
+
system 'middleman server'
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Show config'
|
57
|
+
task :show_config do |t, args|
|
58
|
+
|
59
|
+
credentials!
|
60
|
+
|
61
|
+
puts "\n----------------------------------------------------------------------------------"
|
62
|
+
puts 'Configuration:'
|
63
|
+
puts "\t:working directory: #{Rake.original_dir}"
|
64
|
+
puts "\t:project: #{project}"
|
65
|
+
puts "\t:aws_secrets_file: #{aws_secrets_file}"
|
66
|
+
puts "\t:access_key_id: #{credentials['access_key_id']}"
|
67
|
+
puts "----------------------------------------------------------------------------------\n"
|
68
|
+
end
|
69
|
+
|
70
|
+
# validate file exists
|
71
|
+
def credentials!
|
72
|
+
raise "\nFailed to load AWS secrets: #{aws_secrets_file}.\nFile contents should look like:\naccess_key_id: XXXX\nsecret_access_key: XXXX\n\n" unless File.exists?(aws_secrets_file)
|
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?
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# load from a user directory i.e. ~/.aws/acme.yml
|
82
|
+
def credentials
|
83
|
+
# load secrets from the user home directory
|
84
|
+
@credentials = YAML::load_file(aws_secrets_file) if @credentials.nil?
|
85
|
+
@credentials
|
86
|
+
end
|
87
|
+
|
88
|
+
def aws_secrets_file
|
89
|
+
File.expand_path("~/.aws/#{project}.yml")
|
90
|
+
end
|
91
|
+
|
92
|
+
def project
|
93
|
+
File.basename(Rake.original_dir)
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'middleman-aws'
|
6
|
+
s.version = '0.0.5'
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
|
9
|
+
s.authors = ['Kevin Ross']
|
10
|
+
s.email = ['kevin.ross@alienfast.com']
|
11
|
+
s.description = <<-TEXT
|
12
|
+
Simple set of middleman rake tasks to build and deploy to AWS using s3_sync and cloudfront invalidation
|
13
|
+
TEXT
|
14
|
+
s.summary = <<-TEXT
|
15
|
+
Simple set of middleman rake tasks to build and deploy to AWS using s3_sync and cloudfront invalidation
|
16
|
+
TEXT
|
17
|
+
s.homepage = 'https://github.com/alienfast/middleman-aws'
|
18
|
+
s.license = 'MIT'
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ['lib']
|
24
|
+
|
25
|
+
# The version of middleman-core your extension depends on
|
26
|
+
# s.add_runtime_dependency 'middleman-core', ['>= 3.3.3']
|
27
|
+
|
28
|
+
s.add_runtime_dependency 'middleman-s3_sync' # https://github.com/fredjean/middleman-s3_sync
|
29
|
+
s.add_runtime_dependency 'middleman-cloudfront' # https://github.com/andrusha/middleman-cloudfront
|
30
|
+
|
31
|
+
s.add_dependency 'rake'
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-aws
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin Ross
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-s3_sync
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: middleman-cloudfront
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: |2
|
56
|
+
Simple set of middleman rake tasks to build and deploy to AWS using s3_sync and cloudfront invalidation
|
57
|
+
email:
|
58
|
+
- kevin.ross@alienfast.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .rvmrc
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- features/support/env.rb
|
70
|
+
- lib/middleman-aws.rb
|
71
|
+
- lib/middleman-aws/tasks/aws.rake
|
72
|
+
- middleman-aws.gemspec
|
73
|
+
homepage: https://github.com/alienfast/middleman-aws
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.0.3
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Simple set of middleman rake tasks to build and deploy to AWS using s3_sync
|
97
|
+
and cloudfront invalidation
|
98
|
+
test_files:
|
99
|
+
- features/support/env.rb
|
100
|
+
has_rdoc:
|