gantree 0.6.5 → 0.6.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: fab5339982cb3099c8b0a393375b0700907f751a
4
- data.tar.gz: d689ccf77086f35f6bea4cc3a7da1b69535029b8
3
+ metadata.gz: c09441aca3f3edcf71fdda17ddcb33a211bb5626
4
+ data.tar.gz: ee0db92cf08dc80d4283e03ff45d11c81d2f5fe8
5
5
  SHA512:
6
- metadata.gz: 72ff98c01a21d02a83960a6dbc5d492f1c0b745fdacb3ecdc4c4339237151c1847657c43d44b020c2989d1cc7f57fa847953d50b9c109937dfcf58d15ff03580
7
- data.tar.gz: e0ea01beb2ef7c3dbd302daf41e3253b54c25802a335afe0d55740fb2cbc5b94bd6160b4a96185ff3b417ce26086d8567cf78a85a4d2ca827f159e138df73fd0
6
+ metadata.gz: fae795326dad9be1d7713b45b84a21842f6ab7c1d819df6265daaf72da3fc0267ddd4d03d580e543f3417c29681a2a031ed1c61318394c758ad4d2aa995e2e2e
7
+ data.tar.gz: b556a99549286699d243004ceccf6cb0ee2cefd48b9ebd79e5d8fc6e2740cb9baf4cdf97c350e4accd5182dabf859ce64759f155532e8149366b9a0bb672a77b
data/lib/gantree.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  $:.unshift(File.expand_path("../", __FILE__))
2
2
  require "gantree/base"
3
+ require "gantree/config"
3
4
  require "gantree/version"
4
5
  require "gantree/deploy"
5
6
  require "gantree/deploy_applications"
data/lib/gantree/base.rb CHANGED
@@ -24,6 +24,7 @@ module Gantree
24
24
  puts "gem already up to date".light_blue
25
25
  end
26
26
  update_configuration(opts[:auto_configure]) if opts[:auto_configure]
27
+ Gantree::Config.merge_defaults(opts)
27
28
  end
28
29
 
29
30
  def self.update_configuration repo
data/lib/gantree/cli.rb CHANGED
@@ -20,8 +20,8 @@ module Gantree
20
20
  option :auth, :desc => "dockerhub authentation, example: bucket/key"
21
21
  option :release_notes_staging, :type => :boolean, :default => false, :desc => "force release notes generation for staging deploys"
22
22
  def deploy name
23
- opts = merge_defaults(options)
24
- Gantree::Base.check_for_updates(opts)
23
+ opts = Gantree::Config.merge_defaults(options)
24
+ opts = Gantree::Base.check_for_updates(opts)
25
25
  Gantree::Deploy.new(name,opts).run
26
26
  end
27
27
 
@@ -45,7 +45,7 @@ module Gantree
45
45
  option :dupe, :alias => "-d", :desc => "copy an existing template into a new template"
46
46
  option :local, :alias => "-l", :desc => "use a local cfn nested template"
47
47
  def create app
48
- Gantree::Create.new(app, merge_defaults(options)).run
48
+ Gantree::Create.new(app, Gantree::Config.merge_defaults(options)).run
49
49
  end
50
50
 
51
51
  desc "update APP", "update a cfn stack"
@@ -54,18 +54,18 @@ module Gantree
54
54
  option :role, :aliases => "-r", :desc => "add an app role (worker|listner|scheduler)"
55
55
  option :solution, :aliases => "-s", :desc => "change solution stack"
56
56
  def update app
57
- Gantree::Update.new(app, merge_defaults(options)).run
57
+ Gantree::Update.new(app, Gantree::Config.merge_defaults(options)).run
58
58
  end
59
59
 
60
60
  desc "delete APP", "delete a cfn stack"
61
61
  option :force, :desc => "do not prompt", :default => false
62
62
  def delete app
63
- Gantree::Delete.new(app, merge_defaults(options)).run
63
+ Gantree::Delete.new(app, Gantree::Config.merge_defaults(options)).run
64
64
  end
65
65
 
66
66
  desc "restart APP", "restart an eb app"
67
67
  def restart app
68
- Gantree::App.new(app, merge_defaults(options)).restart
68
+ Gantree::App.new(app, Gantree::Config.merge_defaults(options)).restart
69
69
  end
70
70
 
71
71
  desc "build", "build and tag a docker application"
@@ -73,7 +73,7 @@ module Gantree
73
73
  option :image_path, :aliases => "-i", :desc => "docker hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
74
74
  option :tag, :aliases => "-t", :desc => "set docker tag to build"
75
75
  def build
76
- docker = Gantree::Docker.new(merge_defaults(options))
76
+ docker = Gantree::Docker.new(Gantree::Config.merge_defaults(options))
77
77
  docker.build
78
78
  end
79
79
 
@@ -83,7 +83,7 @@ module Gantree
83
83
  option :image_path, :aliases => "-i", :desc => "docker hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
84
84
  option :tag, :aliases => "-t", :desc => "set docker tag to push"
85
85
  def push
86
- Gantree::Docker.new(merge_defaults(options)).push
86
+ Gantree::Docker.new(Gantree::Config.merge_defaults(options)).push
87
87
  end
88
88
 
89
89
  desc "tag", "tag a docker application"
@@ -103,8 +103,8 @@ module Gantree
103
103
  option :auth, :desc => "dockerhub authentation, example: bucket/key"
104
104
  option :release_notes_staging, :type => :boolean, :default => false, :desc => "force release notes generation for staging deploys"
105
105
  def ship server
106
- opts = merge_defaults(options)
107
- Gantree::Base.check_for_updates(opts)
106
+ opts = Gantree::Config.merge_defaults(options)
107
+ opts = Gantree::Base.check_for_updates(opts)
108
108
  docker = Gantree::Docker.new(opts)
109
109
  docker.pull
110
110
  docker.build
@@ -118,25 +118,6 @@ module Gantree
118
118
  puts VERSION
119
119
  end
120
120
 
121
- protected
122
-
123
- def merge_defaults(options={})
124
- configs = ["#{ENV['HOME']}/.gantreecfg",".gantreecfg"]
125
- hash = {}
126
- configs.each do |config|
127
- hash.merge!(merge_config(options,config)) if config_exists?(config)
128
- end
129
- Hash[hash.map{ |k, v| [k.to_sym, v] }]
130
- end
131
-
132
- def merge_config options, config
133
- defaults = JSON.parse(File.open(config).read)
134
- defaults.merge(options)
135
- end
136
-
137
- def config_exists? config
138
- File.exist? config
139
- end
140
121
  end
141
122
  end
142
123
 
@@ -0,0 +1,25 @@
1
+ require 'colorize'
2
+
3
+ module Gantree
4
+ class Config
5
+ class << self
6
+ def merge_defaults(options={})
7
+ configs = ["#{ENV['HOME']}/.gantreecfg",".gantreecfg"]
8
+ hash = {}
9
+ configs.each do |config|
10
+ hash.merge!(merge_config(options,config)) if config_exists?(config)
11
+ end
12
+ Hash[hash.map{ |k, v| [k.to_sym, v] }]
13
+ end
14
+
15
+ def merge_config options, config
16
+ defaults = JSON.parse(File.open(config).read)
17
+ defaults.merge(options)
18
+ end
19
+
20
+ def config_exists? config
21
+ File.exist? config
22
+ end
23
+ end
24
+ end
25
+ end
@@ -69,7 +69,7 @@ module Gantree
69
69
  create_eb_version
70
70
  update_application(envs)
71
71
  if @options[:slack]
72
- msg = "#{ENV['USER']} is deploying #{@packaged_version} to #{@app} "
72
+ msg = "#{ENV['USER']} is deploying #{@packaged_version} to #{@app} #{@envs.inspect}"
73
73
  msg += "Tag: #{@options[:tag]}" if @options[:tag]
74
74
  Notification.new(@options[:slack]).say(msg) unless @options[:silent]
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gantree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix
@@ -304,6 +304,7 @@ files:
304
304
  - lib/gantree/cfn/resources.rb
305
305
  - lib/gantree/cli.rb
306
306
  - lib/gantree/cli/help.rb
307
+ - lib/gantree/config.rb
307
308
  - lib/gantree/create.rb
308
309
  - lib/gantree/delete.rb
309
310
  - lib/gantree/deploy.rb