gantree 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.travis.yml +4 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +84 -0
- data/Guardfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +57 -0
- data/Rakefile +22 -0
- data/bin/gantree +9 -0
- data/gantree.gemspec +31 -0
- data/lib/gantree.rb +8 -0
- data/lib/gantree/cli.rb +23 -0
- data/lib/gantree/cli/help.rb +13 -0
- data/lib/gantree/deploy.rb +95 -0
- data/lib/gantree/generate.rb +12 -0
- data/lib/gantree/init.rb +63 -0
- data/lib/gantree/version.rb +3 -0
- data/spec/lib/cli_spec.rb +33 -0
- data/spec/spec_helper.rb +46 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 072d861e14657618febc29cbed1187871245f3f4
|
4
|
+
data.tar.gz: 7c8aa419b9765ebdc94064d1382d46e5070ae7fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 304fa850331636d79c26bd3def05194a52e8ff5315f042d8ca0be5e20b79cd519ddef77e673cae43837835d9651ece37f59d8f5b50f0e7cb9678aeec274d5f59
|
7
|
+
data.tar.gz: a168fd6fa44f68fae5a36e911cda1d66b63b64de3a7fca3157315aee2bfb186cc07485fcd708ddcd511ffd3fdf36f8ce009c8be75c0035e5ccc760c53125cc8c
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in gantree.gemspec
|
4
|
+
gem "codeclimate-test-reporter", group: :test, require: nil
|
5
|
+
gem "aws-sdk"
|
6
|
+
gem "guard", group: :test
|
7
|
+
gem "rspec", group: :test
|
8
|
+
gem "rake"
|
9
|
+
gem "guard-rspec", require: false
|
10
|
+
gem "webmock"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.6)
|
5
|
+
aws-sdk (1.52.0)
|
6
|
+
aws-sdk-v1 (= 1.52.0)
|
7
|
+
aws-sdk-v1 (1.52.0)
|
8
|
+
json (~> 1.4)
|
9
|
+
nokogiri (>= 1.4.4)
|
10
|
+
celluloid (0.15.2)
|
11
|
+
timers (~> 1.1.0)
|
12
|
+
codeclimate-test-reporter (0.4.0)
|
13
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
14
|
+
coderay (1.1.0)
|
15
|
+
crack (0.4.2)
|
16
|
+
safe_yaml (~> 1.0.0)
|
17
|
+
diff-lcs (1.2.5)
|
18
|
+
docile (1.1.5)
|
19
|
+
ffi (1.9.3)
|
20
|
+
formatador (0.2.5)
|
21
|
+
guard (2.6.1)
|
22
|
+
formatador (>= 0.2.4)
|
23
|
+
listen (~> 2.7)
|
24
|
+
lumberjack (~> 1.0)
|
25
|
+
pry (>= 0.9.12)
|
26
|
+
thor (>= 0.18.1)
|
27
|
+
guard-rspec (4.3.1)
|
28
|
+
guard (~> 2.1)
|
29
|
+
rspec (>= 2.14, < 4.0)
|
30
|
+
json (1.8.1)
|
31
|
+
listen (2.7.9)
|
32
|
+
celluloid (>= 0.15.2)
|
33
|
+
rb-fsevent (>= 0.9.3)
|
34
|
+
rb-inotify (>= 0.9)
|
35
|
+
lumberjack (1.0.9)
|
36
|
+
method_source (0.8.2)
|
37
|
+
mini_portile (0.6.0)
|
38
|
+
multi_json (1.10.1)
|
39
|
+
nokogiri (1.6.3.1)
|
40
|
+
mini_portile (= 0.6.0)
|
41
|
+
pry (0.10.1)
|
42
|
+
coderay (~> 1.1.0)
|
43
|
+
method_source (~> 0.8.1)
|
44
|
+
slop (~> 3.4)
|
45
|
+
rake (10.3.2)
|
46
|
+
rb-fsevent (0.9.4)
|
47
|
+
rb-inotify (0.9.5)
|
48
|
+
ffi (>= 0.5.0)
|
49
|
+
rspec (3.0.0)
|
50
|
+
rspec-core (~> 3.0.0)
|
51
|
+
rspec-expectations (~> 3.0.0)
|
52
|
+
rspec-mocks (~> 3.0.0)
|
53
|
+
rspec-core (3.0.4)
|
54
|
+
rspec-support (~> 3.0.0)
|
55
|
+
rspec-expectations (3.0.4)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.0.0)
|
58
|
+
rspec-mocks (3.0.4)
|
59
|
+
rspec-support (~> 3.0.0)
|
60
|
+
rspec-support (3.0.4)
|
61
|
+
safe_yaml (1.0.3)
|
62
|
+
simplecov (0.9.0)
|
63
|
+
docile (~> 1.1.0)
|
64
|
+
multi_json
|
65
|
+
simplecov-html (~> 0.8.0)
|
66
|
+
simplecov-html (0.8.0)
|
67
|
+
slop (3.6.0)
|
68
|
+
thor (0.19.1)
|
69
|
+
timers (1.1.0)
|
70
|
+
webmock (1.18.0)
|
71
|
+
addressable (>= 2.3.6)
|
72
|
+
crack (>= 0.3.2)
|
73
|
+
|
74
|
+
PLATFORMS
|
75
|
+
ruby
|
76
|
+
|
77
|
+
DEPENDENCIES
|
78
|
+
aws-sdk
|
79
|
+
codeclimate-test-reporter
|
80
|
+
guard
|
81
|
+
guard-rspec
|
82
|
+
rake
|
83
|
+
rspec
|
84
|
+
webmock
|
data/Guardfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^lib/(.+)\.rb$}) { "spec/gantree_spec.rb" }
|
4
|
+
watch(%r{^lib/gantree/(.+)\.rb$}) { "spec/gantree_spec.rb" }
|
5
|
+
watch('spec/spec_helper.rb') { "spec/gantree_spec.rb" }
|
6
|
+
watch(%r{^lib/gantree/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
end
|
8
|
+
|
9
|
+
guard 'bundler' do
|
10
|
+
watch('Gemfile')
|
11
|
+
watch(/^.+\.gemspec/)
|
12
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Tung Nguyen
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Gantree
|
2
|
+
|
3
|
+
[](https://travis-ci.org/feelobot/gantree)
|
4
|
+
[](https://codeclimate.com/github/feelobot/gantree)
|
5
|
+
[](https://codeclimate.com/github/feelobot/gantree)
|
6
|
+
## Why Gantree?
|
7
|
+
|
8
|
+
The name is derived from the word gantry which is a large crane used in ports to pick up shipping containers and load them on a ship. Gantry was already taken so I spelled it "tree" because the primary use is for elastic beanstalk and I guess a beanstalk is a form of tree?
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
This tool is intended to help you setup a Dockerrun.aws.json which allows you to deploy a prebuilt image of your application to Elastic Beanstalk. This also allows you to do versioned deploys to your Elastic Beanstalk application and create an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
You need to have your AWS_ACCES_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables set in order to use the tool as well as the proper aws permissions for Elastic Beanstalk, and S3 access.
|
17
|
+
|
18
|
+
For the time being you also need to configure your github repo to auto build an image inside of Dockerhub (private or open). In order to do this you need to have a dockerhub account already, login, and select your profile/orginization to add a *Automated Build* to. Select the branch you want to build, location of the docker file and the tag to reference the image that will be built (this will hopefully be automated in the future via dockerhub api).
|
19
|
+
|
20
|
+
Once you have your docker image created you will also need to install docker (if you haven't already)
|
21
|
+
|
22
|
+
*MAC OSX*
|
23
|
+
```
|
24
|
+
brew install docker
|
25
|
+
```
|
26
|
+
|
27
|
+
Generate your login credentials token:
|
28
|
+
```
|
29
|
+
docker login
|
30
|
+
```
|
31
|
+
|
32
|
+
Install the gem
|
33
|
+
```
|
34
|
+
gem install 'gantree'
|
35
|
+
```
|
36
|
+
|
37
|
+
### Initialize
|
38
|
+
|
39
|
+
What this does is create a new Dockerrun.aws.json inside your repository and uploads your docker login credentials to s3 (for private repo access) so you can do deploys. We need the -u to specify a username to rename your .dockercfg and reference it in the Dockerrun.aws.json
|
40
|
+
|
41
|
+
```
|
42
|
+
gantree init -u frodriguez -p 3000 bleacher/cauldron:master
|
43
|
+
```
|
44
|
+
|
45
|
+
### Deploy
|
46
|
+
|
47
|
+
This command renames your Dockerrun.aws.json temporarily to NAME_OF_ENV-GITHUB_HASH-Dockerrun.aws.json, uploads it to a NAME_OF_APP-versions bucket, creates a new elastic beanstalk version, and asks the specified elastic beanstalk environment to update to that new version.
|
48
|
+
|
49
|
+
```
|
50
|
+
gantree deploy stag-cauldron-app-s1
|
51
|
+
```
|
52
|
+
|
53
|
+
You can also specify a new image tag to use for the deploy
|
54
|
+
|
55
|
+
```
|
56
|
+
gantree deploy -t latest stag-cauldon-app-s1
|
57
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
task :default => :spec
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new
|
7
|
+
|
8
|
+
namespace :spec do
|
9
|
+
desc "Run acceptance specs, forces AWS calls by cleaning vcr fixtures first, ~/.br/aws.yml needs to be set up"
|
10
|
+
task :acceptance => %w[clean:vcr] do
|
11
|
+
ENV['LIVE'] = "1"
|
12
|
+
Rake::Task["spec"].invoke
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
task :clean => %w[clean:vcr]
|
17
|
+
namespace :clean do
|
18
|
+
desc "clean vcr_cassettes fixtures"
|
19
|
+
task :vcr do
|
20
|
+
FileUtils.rm_rf('spec/fixtures/vcr_cassettes')
|
21
|
+
end
|
22
|
+
end
|
data/bin/gantree
ADDED
data/gantree.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gantree/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gantree"
|
8
|
+
spec.version = Gantree::VERSION
|
9
|
+
spec.authors = ["Felix"]
|
10
|
+
spec.email = ["felix.a.rod@gmail.com"]
|
11
|
+
spec.description = "cli tool for automating docker deploys to elastic beanstalk"
|
12
|
+
spec.summary = "This tool is intended to help you setup a Dockerrun.aws.json which allows you to deploy a prebuilt image of your application to Elastic Beanstalk. This also allows you to do versioned deploys to your Elastic Beanstalk application and create an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service."
|
13
|
+
spec.homepage = "https://github.com/feelobot/gantree"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "thor"
|
22
|
+
spec.add_dependency "aws-sdk"
|
23
|
+
spec.add_dependency "hashie"
|
24
|
+
spec.add_dependency "colorize"
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
spec.add_development_dependency "guard"
|
29
|
+
spec.add_development_dependency "guard-bundler"
|
30
|
+
spec.add_development_dependency "guard-rspec"
|
31
|
+
end
|
data/lib/gantree.rb
ADDED
data/lib/gantree/cli.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'aws-sdk'
|
3
|
+
require 'gantree/cli/help'
|
4
|
+
|
5
|
+
module Gantree
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
desc "deploy APP", "deploy specified APP"
|
9
|
+
option :branch, :desc => 'branch to deploy'
|
10
|
+
method_option :tag, :aliases => "-t", :desc => "set docker tag to deploy"
|
11
|
+
method_option :environment, :aliases => "-e", :desc => "elastic beanstalk environment"
|
12
|
+
def deploy app
|
13
|
+
Gantree::Deploy.new(app, options).run
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "init IMAGE", "create a dockerrun for your IMAGE"
|
17
|
+
method_option :user, :aliases => "-u", :desc => "user credentials for private repo"
|
18
|
+
method_option :port, :aliases => "-p", :desc => "port of running application"
|
19
|
+
def init image
|
20
|
+
Gantree::Init.new(image,options).run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Gantree
|
2
|
+
class CLI < Thor
|
3
|
+
class Help
|
4
|
+
class << self
|
5
|
+
def hello(action)
|
6
|
+
<<-EOL
|
7
|
+
Adds a remote named <name> for the repository at <url>. The command git fetch <name> can then be used to create and update
|
8
|
+
EOL
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module Gantree
|
2
|
+
class Deploy
|
3
|
+
|
4
|
+
def initialize app,options
|
5
|
+
@options = options
|
6
|
+
AWS.config(
|
7
|
+
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
8
|
+
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'])
|
9
|
+
@app = @options.env || app.match(/^[a-zA-Z]*\-([a-zA-Z]*)\-[a-zA-Z]*\-([a-zA-Z]*\d*)/)[1] + "-" + app.match(/^([a-zA-Z]*)\-([a-zA-Z]*)\-[a-zA-Z]*\-([a-zA-Z]*\d*)/)[1] + '-' + app.match(/^([a-zA-Z]*)\-([a-zA-Z]*)\-[a-zA-Z]*\-([a-zA-Z]*\d*)/)[3]
|
10
|
+
@env = app
|
11
|
+
@version_label = set_version_label
|
12
|
+
@eb = AWS::ElasticBeanstalk::Client.new
|
13
|
+
@s3 = AWS::S3.new
|
14
|
+
@tag = options.tag
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
puts "Deploying #{@app}"
|
19
|
+
upload_to_s3
|
20
|
+
create_version
|
21
|
+
update_application
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def upload_to_s3
|
27
|
+
|
28
|
+
filename = @version_label
|
29
|
+
FileUtils.cp("Dockerrun.aws.json", filename)
|
30
|
+
set_tag_to_deploy if @tag
|
31
|
+
key = File.basename(filename)
|
32
|
+
begin
|
33
|
+
puts "uploading dockerrun to #{@app}-versions"
|
34
|
+
@s3.buckets["#{@app}-versions"].objects[key].write(:file => filename)
|
35
|
+
rescue AWS::S3::Errors::NoSuchBucket
|
36
|
+
puts "bucket didn't exist...creating"
|
37
|
+
bucket = @s3.buckets.create("#{@app}-versions")
|
38
|
+
retry
|
39
|
+
rescue AWS::S3::Errors::AccessDenied
|
40
|
+
puts "Your key is not configured for s3 access, please let your operations team know"
|
41
|
+
FileUtils.rm(filename)
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
FileUtils.rm(filename)
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_version
|
48
|
+
begin
|
49
|
+
@eb.create_application_version({
|
50
|
+
:application_name => @app,
|
51
|
+
:version_label => @version_label,
|
52
|
+
:source_bundle => {
|
53
|
+
:s3_bucket => "#{@app}-versions",
|
54
|
+
:s3_key => @version_label
|
55
|
+
}
|
56
|
+
})
|
57
|
+
rescue AWS::ElasticBeanstalk::Errors::InvalidParameterValue
|
58
|
+
puts "Version already exists, recreating..."
|
59
|
+
begin
|
60
|
+
@eb.delete_application_version({
|
61
|
+
:application_name => @app,
|
62
|
+
:version_label => @version_label,
|
63
|
+
:delete_source_bundle => false
|
64
|
+
})
|
65
|
+
retry
|
66
|
+
rescue AWS::ElasticBeanstalk::Errors::InvalidParameterValue
|
67
|
+
puts "No Application named #{@app} found"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def update_application
|
73
|
+
begin
|
74
|
+
@eb.update_environment({
|
75
|
+
:environment_name => @env,
|
76
|
+
:version_label => @version_label
|
77
|
+
})
|
78
|
+
rescue AWS::ElasticBeanstalk::Errors::InvalidParameterValue
|
79
|
+
puts "#{@env} doesn't exist"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def set_version_label
|
84
|
+
branch = `git rev-parse --abbrev-ref HEAD`
|
85
|
+
hash = `git rev-parse --verify --short #{branch}`.strip
|
86
|
+
"#{@env}-#{hash}-Dockerrun.aws.json"
|
87
|
+
end
|
88
|
+
|
89
|
+
def set_tag_to_deploy
|
90
|
+
docker =JSON.parse(IO.read("Dockerrun.aws.json"))
|
91
|
+
docker["Image"]["Name"].gsub!(/:(.*)$/, ":#{@tag}")
|
92
|
+
IO.write(@version_label,JSON.pretty_generate(docker))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/lib/gantree/init.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
module Gantree
|
5
|
+
|
6
|
+
class Init
|
7
|
+
def initialize image,options
|
8
|
+
@image = image
|
9
|
+
@options = options
|
10
|
+
AWS.config(
|
11
|
+
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
12
|
+
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'])
|
13
|
+
@s3 = AWS::S3.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
puts "initialize image #{@image}"
|
18
|
+
puts "with user #{@options.user}" if @options.user
|
19
|
+
FileUtils.rm("Dockerrun.aws.json") if File.exist?("Dockerrun.aws.json")
|
20
|
+
create_docker_config_folder
|
21
|
+
create_dockerrun
|
22
|
+
upload_docker_config if @options.user
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_docker_config_folder
|
26
|
+
bucket = @s3.buckets.create("docker-cfgs")
|
27
|
+
end
|
28
|
+
|
29
|
+
def dockerrun_object
|
30
|
+
docker = {
|
31
|
+
AWSEBDockerrunVersion: "1",
|
32
|
+
Image: {
|
33
|
+
Name: @image,
|
34
|
+
Update: true
|
35
|
+
},
|
36
|
+
Ports: [
|
37
|
+
{
|
38
|
+
ContainerPort: @options.port
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
if @options.user
|
43
|
+
docker["Authentication"] = {
|
44
|
+
Bucket: "docker-cfgs",
|
45
|
+
Key: "#{@options.user}.dockercfg"
|
46
|
+
}
|
47
|
+
end
|
48
|
+
docker
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_dockerrun
|
52
|
+
IO.write("Dockerrun.aws.json",JSON.pretty_generate(dockerrun_object))
|
53
|
+
end
|
54
|
+
|
55
|
+
def upload_docker_config
|
56
|
+
filename = "#{ENV['HOME']}/#{@options.user}.dockercfg"
|
57
|
+
FileUtils.cp("#{ENV['HOME']}/.dockercfg", "#{ENV['HOME']}/#{@options.user}.dockercfg")
|
58
|
+
key = File.basename(filename)
|
59
|
+
@s3.buckets["docker-cfgs"].objects[key].write(:file => filename)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# to run specs with what's remembered from vcr
|
4
|
+
# $ rake
|
5
|
+
#
|
6
|
+
# to run specs with new fresh data from aws api calls
|
7
|
+
# $ rake clean:vcr ; time rake
|
8
|
+
describe Gantree::CLI do
|
9
|
+
before(:all) do
|
10
|
+
@env = "stag-app-br-s1"
|
11
|
+
@owner = "bleacher"
|
12
|
+
@repo = "cauldron"
|
13
|
+
@tag = "master"
|
14
|
+
@user = "feelobot"
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "gantree" do
|
18
|
+
it "should create a new dockerrun for a private repo" do
|
19
|
+
out = execute("bin/gantree init -u #{@user} #{@owner}/#{@repo}:#{@tag}")
|
20
|
+
expect(out).to include ""
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should create a new dockerrun for a public repo" do
|
24
|
+
out = execute("bin/gantree init #{@owner}/#{@repo}:#{@tag}")
|
25
|
+
expect(out).to include ""
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should deploy images" do
|
29
|
+
out = execute("bin/gantree deploy #{@env}")
|
30
|
+
expect(out).to include("Deploying")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Running specs by default will use VCR.
|
2
|
+
# Can disable via: VCR=0 rake or clean out vcr fixtures via rake clean:vcr.
|
3
|
+
# Using a ENV VCR flag so that both ruby and cli specs always either use
|
4
|
+
# vcr or do not use vcr. It's confusing to only have only ruby use vcr
|
5
|
+
# and cli specs not using vcr and vice versa.
|
6
|
+
ENV['VCR'] ? ENV['VCR'] : ENV['VCR'] = '1'
|
7
|
+
ENV['TEST'] = '1'
|
8
|
+
ENV['CODECLIMATE_REPO_TOKEN'] = ENV['CODECLIMATE_GANTREE_TOKEN']
|
9
|
+
|
10
|
+
require "codeclimate-test-reporter"
|
11
|
+
CodeClimate::TestReporter.start
|
12
|
+
|
13
|
+
require "pp"
|
14
|
+
|
15
|
+
root = File.expand_path('../../', __FILE__)
|
16
|
+
require "#{root}/lib/gantree"
|
17
|
+
|
18
|
+
module Helpers
|
19
|
+
def execute(cmd)
|
20
|
+
puts "Running: #{cmd}" if ENV['DEBUG']
|
21
|
+
out = `#{cmd}`
|
22
|
+
puts out if ENV['DEBUG']
|
23
|
+
out
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.configure do |c|
|
28
|
+
c.include Helpers
|
29
|
+
# Use color in STDOUT
|
30
|
+
c.color = true
|
31
|
+
|
32
|
+
# Use color not only in STDOUT but also in pagers and files
|
33
|
+
c.tty = true
|
34
|
+
|
35
|
+
# Use the specified formatter
|
36
|
+
c.formatter = :documentation # :progress, :html, :textmate
|
37
|
+
#c.around(:each) do |example|
|
38
|
+
# VCR.use_cassette(example.metadata[:full_description], :serialize_with => :json) do
|
39
|
+
# example.run
|
40
|
+
# end if ENV['VCR'] == '1'
|
41
|
+
#end
|
42
|
+
end
|
43
|
+
|
44
|
+
#VCR.configure do |config|
|
45
|
+
# config.ignore_hosts 'codeclimate.com'
|
46
|
+
#end if ENV['VCR'] == '1'
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gantree
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Felix
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
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: aws-sdk
|
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: hashie
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: colorize
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-bundler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: guard-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: cli tool for automating docker deploys to elastic beanstalk
|
140
|
+
email:
|
141
|
+
- felix.a.rod@gmail.com
|
142
|
+
executables:
|
143
|
+
- gantree
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- ".travis.yml"
|
149
|
+
- Gemfile
|
150
|
+
- Gemfile.lock
|
151
|
+
- Guardfile
|
152
|
+
- LICENSE.txt
|
153
|
+
- README.md
|
154
|
+
- Rakefile
|
155
|
+
- bin/gantree
|
156
|
+
- gantree.gemspec
|
157
|
+
- lib/gantree.rb
|
158
|
+
- lib/gantree/cli.rb
|
159
|
+
- lib/gantree/cli/help.rb
|
160
|
+
- lib/gantree/deploy.rb
|
161
|
+
- lib/gantree/generate.rb
|
162
|
+
- lib/gantree/init.rb
|
163
|
+
- lib/gantree/version.rb
|
164
|
+
- spec/lib/cli_spec.rb
|
165
|
+
- spec/spec_helper.rb
|
166
|
+
homepage: https://github.com/feelobot/gantree
|
167
|
+
licenses:
|
168
|
+
- MIT
|
169
|
+
metadata: {}
|
170
|
+
post_install_message:
|
171
|
+
rdoc_options: []
|
172
|
+
require_paths:
|
173
|
+
- lib
|
174
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
requirements: []
|
185
|
+
rubyforge_project:
|
186
|
+
rubygems_version: 2.2.2
|
187
|
+
signing_key:
|
188
|
+
specification_version: 4
|
189
|
+
summary: This tool is intended to help you setup a Dockerrun.aws.json which allows
|
190
|
+
you to deploy a prebuilt image of your application to Elastic Beanstalk. This also
|
191
|
+
allows you to do versioned deploys to your Elastic Beanstalk application and create
|
192
|
+
an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service.
|
193
|
+
test_files:
|
194
|
+
- spec/lib/cli_spec.rb
|
195
|
+
- spec/spec_helper.rb
|