gantree 0.4.5 → 0.4.6

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: c5d55367e0c3dd995df31bbd401fd051c25e6500
4
- data.tar.gz: a24bb95258212aecd709f6392fb5d3b5391b6819
3
+ metadata.gz: ff66472c33546db57fb72859e6c1d0d914d45aec
4
+ data.tar.gz: a239a2c814966bfe9978291d219449d3352ba51f
5
5
  SHA512:
6
- metadata.gz: c06a362bb8800bcca198aaa4bcb4eda33a04175d30185746499e8030b8acabcd9c8aab1dcd6cbc45ad2cc7cb2fa144fd35022d07639f62c9a89d2a1f1e1d9281
7
- data.tar.gz: efafabd1655dd1ebfd35a2a86180a57e48484e5d50e00f1526f9a2a14a47298de0e45bbcd4bb26eba40416f91bd33a4b0d8411b931e9d4ae2730538ddb7ece3b
6
+ metadata.gz: bedf8c651dc799fd32d75f7ccbde70cb496d783b15f68013ad60c90c7f15c34eb0bb7e705d4098472e7119a3aa53417bb63bcd5517453c53555b2496c025279d
7
+ data.tar.gz: f4ed2f47b20d2177669d6516ed85ef5a9c51ab78a47aad295828a7ebc69ae519d1c4abe8d8bb44b663f594d7c84924b6a030aba384bb3a46653abefaf9099fe1
data/Gemfile CHANGED
@@ -17,6 +17,4 @@ gem "highline"
17
17
  gem "pry"
18
18
  gem "vcr"
19
19
  gem "fakeweb"
20
- gem "colorize"
21
-
22
-
20
+ gem "colorize"
data/lib/gantree/base.rb CHANGED
@@ -25,6 +25,13 @@ module Gantree
25
25
  def eb
26
26
  @eb ||= AWS::ElasticBeanstalk::Client.new
27
27
  end
28
+
29
+ def tag
30
+ origin = `git remote show origin | grep "Push" | cut -f1 -d"/" | cut -d":" -f3`.strip
31
+ branch = `git rev-parse --abbrev-ref HEAD`.strip
32
+ hash = `git rev-parse --verify --short #{branch}`.strip
33
+ "#{origin}-#{branch}-#{hash}"
34
+ end
28
35
  end
29
36
  end
30
37
 
data/lib/gantree/cli.rb CHANGED
@@ -9,7 +9,6 @@ module Gantree
9
9
  desc "deploy APP", "deploy specified APP"
10
10
  option :branch, :desc => 'branch to deploy'
11
11
  method_option :tag, :aliases => "-t", :desc => "set docker tag to deploy"
12
- method_option :env, :aliases => "-e", :desc => "elastic beanstalk environment"
13
12
  method_option :ext, :aliases => "-x", :desc => "ebextensions folder/repo"
14
13
  option :dry_run, :aliases => "-d", :desc => "do not actually deploy the app"
15
14
  option :silent, :aliases => "-s", :desc => "mute notifications"
@@ -60,6 +59,7 @@ module Gantree
60
59
  end
61
60
 
62
61
  desc "build", "build and tag a docker application"
62
+ option :tag, :aliases => "-t", :desc => "set docker tag to build"
63
63
  option :hub, :aliases => "-h", :desc => "hub (docker|quay)"
64
64
  def build
65
65
  Gantree::Docker.new(merge_defaults(options)).build
@@ -67,6 +67,7 @@ module Gantree
67
67
 
68
68
  desc "push", "build and tag a docker application"
69
69
  option :hub, :aliases => "-h", :desc => "hub (docker|quay)"
70
+ option :tag, :aliases => "-t", :desc => "set docker tag to push"
70
71
  def push
71
72
  Gantree::Docker.new(merge_defaults(options)).push
72
73
  end
@@ -76,6 +77,22 @@ module Gantree
76
77
  puts Gantree::Docker.new(merge_defaults(options)).tag
77
78
  end
78
79
 
80
+ desc "shipit", "tag a docker application"
81
+ option :branch, :desc => 'branch to deploy'
82
+ option :tag, :aliases => "-t", :desc => "set docker tag to deploy", :default => Gantree::Base.new.tag
83
+ option :ext, :aliases => "-x", :desc => "ebextensions folder/repo"
84
+ option :dry_run, :aliases => "-d", :desc => "do not actually deploy the app"
85
+ option :silent, :aliases => "-s", :desc => "mute notifications"
86
+ option :autodetect_app_role, :desc => "use naming convention to determin role"
87
+ option :hub, :aliases => "-h", :desc => "hub (docker|quay)"
88
+ option :hush, :desc => "quite puts messages", :default => true
89
+ def shipit server
90
+ docker = Gantree::Docker.new(merge_defaults(options))
91
+ docker.build
92
+ docker.push
93
+ Gantree::Deploy.new(server, merge_defaults(options)).run
94
+ end
95
+
79
96
  protected
80
97
 
81
98
  def merge_defaults(options={})
@@ -68,6 +68,7 @@ module Gantree
68
68
  return true
69
69
  end
70
70
  end
71
+
71
72
  def deploy(envs)
72
73
  print_options
73
74
  check_dir_name(envs) unless @options[:force]
@@ -83,6 +84,7 @@ module Gantree
83
84
  Notification.new(@options[:slack]).say(msg) unless @options[:silent]
84
85
  end
85
86
  end
87
+
86
88
  def upload_to_s3
87
89
  key = File.basename(@packaged_version)
88
90
  check_version_bucket
@@ -9,40 +9,36 @@ module Gantree
9
9
  @options = options
10
10
  @hub = @options[:hub]
11
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
12
  @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
13
+ @tag = @options[:tag] ||= tag
16
14
  end
17
15
 
18
16
  def build
19
17
  puts "Building..."
20
- output = `docker build -t #{@hub}/#{@repo}:#{@origin}-#{@branch}-#{@hash} .`
18
+ output = `docker build -t #{@hub}/#{@repo}:#{@tag} .`
21
19
  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}"
20
+ puts "Image Built: #{@hub}/#{@repo}:#{@tag}".green
21
+ puts "docker push #{@hub}/#{@repo}:#{@tag}" unless @options[:hush]
22
+ puts "gantree deploy app_name -t #{@tag}" unless @options[:hush]
25
23
  else
26
24
  puts "Error: Image was not built successfully".red
27
25
  puts "#{output}"
26
+ exit 1
28
27
  end
29
28
  end
30
29
 
31
30
  def push
32
31
  puts "Pushing..."
33
- output = `docker push #{@hub}/#{@repo}:#{tag}`
32
+ output = `docker push #{@hub}/#{@repo}:#{@tag}`
34
33
  if $?.success?
35
- puts "Image Pushed: #{@hub}/#{@repo}:#{tag}".green
36
- puts "gantree deploy app_name -t #{tag}"
34
+ puts "Image Pushed: #{@hub}/#{@repo}:#{@tag}".green
35
+ puts "gantree deploy app_name -t #{@tag}" unless @options[:hush]
37
36
  else
38
37
  puts "Error: Image was not pushed successfully".red
39
38
  puts "#{output}"
39
+ exit 1
40
40
  end
41
41
  end
42
-
43
- def tag
44
- "#{@origin}-#{@branch}-#{@hash}"
45
- end
46
42
  end
47
43
  end
48
44
 
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
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.5
4
+ version: 0.4.6
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-04 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor