gantree 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad3d597a9b285fb2978c0584c2ff02556891c532
4
- data.tar.gz: 5e597e24d3bf3db7b990afde79fad0e38966fda9
3
+ metadata.gz: c5d55367e0c3dd995df31bbd401fd051c25e6500
4
+ data.tar.gz: a24bb95258212aecd709f6392fb5d3b5391b6819
5
5
  SHA512:
6
- metadata.gz: cf48001744490b8310ea3ae10cec1fe9c60e5a7ccb2b504c41422313e4f69f208995d22c16cd11924db7c06c77dab52d916140e760967a96a04dceb797aad042
7
- data.tar.gz: 68760de0926b5eabf790a118e67016f1c4e43fc05df6f6aff2466663caddab1d3d469ff0c7a75242144d2d490466bd153d5bad0b42a0d3f77e49fef0f6879ac0
6
+ metadata.gz: c06a362bb8800bcca198aaa4bcb4eda33a04175d30185746499e8030b8acabcd9c8aab1dcd6cbc45ad2cc7cb2fa144fd35022d07639f62c9a89d2a1f1e1d9281
7
+ data.tar.gz: efafabd1655dd1ebfd35a2a86180a57e48484e5d50e00f1526f9a2a14a47298de0e45bbcd4bb26eba40416f91bd33a4b0d8411b931e9d4ae2730538ddb7ece3b
data/lib/gantree.rb CHANGED
@@ -5,6 +5,7 @@ require "gantree/deploy"
5
5
  require "gantree/init"
6
6
  require "gantree/stack"
7
7
  require "gantree/app"
8
+ require "gantree/docker"
8
9
 
9
10
  module Gantree
10
11
  autoload :CLI, 'gantree/cli'
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 app, options
6
+ def initialize env, options
8
7
  check_credentials
9
8
  set_aws_keys
10
- @options = options
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
+
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
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
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-03 00:00:00.000000000 Z
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