gantree 0.4.4 → 0.4.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 +4 -4
- data/lib/gantree.rb +1 -0
- data/lib/gantree/app.rb +3 -11
- data/lib/gantree/cli.rb +17 -0
- data/lib/gantree/docker.rb +48 -0
- data/lib/gantree/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5d55367e0c3dd995df31bbd401fd051c25e6500
|
4
|
+
data.tar.gz: a24bb95258212aecd709f6392fb5d3b5391b6819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06a362bb8800bcca198aaa4bcb4eda33a04175d30185746499e8030b8acabcd9c8aab1dcd6cbc45ad2cc7cb2fa144fd35022d07639f62c9a89d2a1f1e1d9281
|
7
|
+
data.tar.gz: efafabd1655dd1ebfd35a2a86180a57e48484e5d50e00f1526f9a2a14a47298de0e45bbcd4bb26eba40416f91bd33a4b0d8411b931e9d4ae2730538ddb7ece3b
|
data/lib/gantree.rb
CHANGED
data/lib/gantree/app.rb
CHANGED
@@ -2,25 +2,17 @@ require 'colorize'
|
|
2
2
|
|
3
3
|
module Gantree
|
4
4
|
class App < Base
|
5
|
-
attr_reader :app, :env
|
6
5
|
|
7
|
-
def initialize
|
6
|
+
def initialize env, options
|
8
7
|
check_credentials
|
9
8
|
set_aws_keys
|
10
|
-
@
|
11
|
-
@app = @options[:env] || default_name(app)
|
12
|
-
@env = app
|
9
|
+
@env = env
|
13
10
|
end
|
14
11
|
|
15
12
|
def restart
|
16
|
-
eb.restart_app_server({environment_name: "#{@env}"})
|
13
|
+
eb.restart_app_server({ environment_name: "#{@env}" })
|
17
14
|
puts "App is now restarting".green
|
18
15
|
end
|
19
|
-
|
20
|
-
private
|
21
|
-
def eb
|
22
|
-
@eb ||= AWS::ElasticBeanstalk::Client.new
|
23
|
-
end
|
24
16
|
end
|
25
17
|
end
|
26
18
|
|
data/lib/gantree/cli.rb
CHANGED
@@ -59,6 +59,23 @@ module Gantree
|
|
59
59
|
Gantree::App.new(app, merge_defaults(options)).restart
|
60
60
|
end
|
61
61
|
|
62
|
+
desc "build", "build and tag a docker application"
|
63
|
+
option :hub, :aliases => "-h", :desc => "hub (docker|quay)"
|
64
|
+
def build
|
65
|
+
Gantree::Docker.new(merge_defaults(options)).build
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "push", "build and tag a docker application"
|
69
|
+
option :hub, :aliases => "-h", :desc => "hub (docker|quay)"
|
70
|
+
def push
|
71
|
+
Gantree::Docker.new(merge_defaults(options)).push
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "tag", "tag a docker application"
|
75
|
+
def tag
|
76
|
+
puts Gantree::Docker.new(merge_defaults(options)).tag
|
77
|
+
end
|
78
|
+
|
62
79
|
protected
|
63
80
|
|
64
81
|
def merge_defaults(options={})
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
|
3
|
+
module Gantree
|
4
|
+
class Docker < Base
|
5
|
+
|
6
|
+
def initialize options
|
7
|
+
check_credentials
|
8
|
+
set_aws_keys
|
9
|
+
@options = options
|
10
|
+
@hub = @options[:hub]
|
11
|
+
raise "Please provide a hub name in your .gantreecfg ex { hub : 'bleacher' }" unless @hub
|
12
|
+
@origin = `git remote show origin | grep "Push" | cut -f1 -d"/" | cut -d":" -f3`.strip
|
13
|
+
@repo = `basename $(git rev-parse --show-toplevel)`.strip
|
14
|
+
@branch = `git rev-parse --abbrev-ref HEAD`.strip
|
15
|
+
@hash = `git rev-parse --verify --short #{@branch}`.strip
|
16
|
+
end
|
17
|
+
|
18
|
+
def build
|
19
|
+
puts "Building..."
|
20
|
+
output = `docker build -t #{@hub}/#{@repo}:#{@origin}-#{@branch}-#{@hash} .`
|
21
|
+
if $?.success?
|
22
|
+
puts "Image Built: #{@hub}/#{@repo}:#{tag}".green
|
23
|
+
puts "docker push #{@hub}/#{@repo}:#{tag}"
|
24
|
+
puts "gantree deploy app_name -t #{tag}"
|
25
|
+
else
|
26
|
+
puts "Error: Image was not built successfully".red
|
27
|
+
puts "#{output}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def push
|
32
|
+
puts "Pushing..."
|
33
|
+
output = `docker push #{@hub}/#{@repo}:#{tag}`
|
34
|
+
if $?.success?
|
35
|
+
puts "Image Pushed: #{@hub}/#{@repo}:#{tag}".green
|
36
|
+
puts "gantree deploy app_name -t #{tag}"
|
37
|
+
else
|
38
|
+
puts "Error: Image was not pushed successfully".red
|
39
|
+
puts "#{output}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def tag
|
44
|
+
"#{@origin}-#{@branch}-#{@hash}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
data/lib/gantree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gantree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- lib/gantree/cli.rb
|
277
277
|
- lib/gantree/cli/help.rb
|
278
278
|
- lib/gantree/deploy.rb
|
279
|
+
- lib/gantree/docker.rb
|
279
280
|
- lib/gantree/init.rb
|
280
281
|
- lib/gantree/notification.rb
|
281
282
|
- lib/gantree/stack.rb
|