gantree 0.5.5 → 0.5.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: 93e1fc2560310823eff776281bbb89f504e8ccf0
4
- data.tar.gz: 6202b52059da3c876d4c7bb28d21da5d774abf46
3
+ metadata.gz: 87590bdf6a18af8ca085d1d15fced297ad9c2bdf
4
+ data.tar.gz: 632a00ef006d70bad2d6e7e055b6cc2e00030136
5
5
  SHA512:
6
- metadata.gz: 047dd9170aa2e325a51abe1ad122bb5b11311d428b579d7187d2798ef6103790bc55dbdbfa7c35f618bf85e314a4f6e38ff53284175a79b41b2b612048e96e1b
7
- data.tar.gz: a51ebe0952e5182c0364182c327f38f7784a671011ba6d64554235d9e768bc0dd933f392c4c3695f4359c575dd236e3e16b65d1acd6f0aea421ec380e07d4d7f
6
+ metadata.gz: ed60ac21a9d8863a4b0036a6af1708a7b5f68a34c7e4ac5f242bbd794d4e91511ecb31a12c304011431a8c66d88f934562384b340814bad19b00159302e60d76
7
+ data.tar.gz: 9e9b6879f83124fd6d25806e0dbd12bcd519faa99506483ff1e4bc70946fbdacfb8d4a1db7177088eba57236458e24b515ff8d2a07d77aa0a2dc267d4ca41e55
@@ -7,22 +7,29 @@ module Gantree
7
7
  raise "Please set your AWS Environment Variables" unless ENV['AWS_ACCESS_KEY_ID']
8
8
  end
9
9
 
10
- def self.check_for_updates enabled
11
- return if $0.include? "bin/gantree"
12
- latest_version = `gem search gantree | grep gantree | awk '{ print $2 }' | tr -d '()'`.strip
13
- current_version = `gantree -v`.strip
10
+ def self.check_for_updates opts
11
+ puts opts.inspect
12
+ enabled = opts[:auto_updates]
13
+ #return if $0.include? "bin/gantree"
14
+ latest_version = `gem search gantree | grep gantree | awk '{ print $2 }' | tr -d '()'`.strip.to_i
15
+ current_version = VERSION.to_i
14
16
  puts "Auto updates enabled".light_blue if enabled
15
17
  puts "Auto updates disabled".light_blue if !enabled
16
- if latest_version != current_version && enabled
18
+ if current_version < latest_version && enabled
17
19
  puts "Updating from #{current_version} to #{latest_version}...".green
18
- if system("gem update gantree --force")
19
- puts "Gem updated".green
20
- else
21
- puts "Gem failed to update".red
22
- end
20
+ system("gem update gantree --force")
23
21
  else
24
22
  puts "gem already up to date".light_blue
25
23
  end
24
+ update_configuration(opts[:auto_configure]) if opts[:auto_configure]
25
+ end
26
+
27
+ def self.update_configuration repo
28
+ puts "Auto configuring from #{repo}".light_blue
29
+ FileUtils.rm_rf("/tmp/gantreecfg") if File.directory?("/tmp/gantreecfg")
30
+ system("git clone #{repo} /tmp/gantreecfg")
31
+ FileUtils.cp("/tmp/gantreecfg/.gantreecfg","#{ENV['HOME']}/")
32
+ puts "Auto Configured".green
26
33
  end
27
34
 
28
35
  def print_options
@@ -10,7 +10,6 @@ module Gantree
10
10
 
11
11
  desc "deploy APP", "deploy specified APP"
12
12
  long_desc Help.deploy
13
- option :branch, :desc => 'branch to deploy'
14
13
  option :tag, :aliases => "-t", :desc => "set docker tag to deploy", :default => Gantree::Base.new.tag
15
14
  option :ext, :aliases => "-x", :desc => "ebextensions folder/repo"
16
15
  option :ext_role, :desc => "role based extension repo (bleacher specific)"
@@ -20,7 +19,7 @@ module Gantree
20
19
  option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
21
20
  def deploy name
22
21
  opts = merge_defaults(options)
23
- Gantree::Base.check_for_updates(opts[:auto_updates])
22
+ Gantree::Base.check_for_updates(opts)
24
23
  Gantree::Deploy.new(name,opts).run
25
24
  end
26
25
 
@@ -91,7 +90,6 @@ module Gantree
91
90
 
92
91
  desc "ship", "build, push and deploy docker container to elastic beanstalk"
93
92
  long_desc Help.ship
94
- option :branch, :desc => 'branch to deploy'
95
93
  option :tag, :aliases => "-t", :desc => "set docker tag to deploy", :default => Gantree::Base.new.tag
96
94
  option :ext, :aliases => "-x", :desc => "ebextensions folder/repo"
97
95
  option :silent, :aliases => "-s", :desc => "mute notifications"
@@ -101,7 +99,7 @@ module Gantree
101
99
  option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
102
100
  def ship server
103
101
  opts = merge_defaults(options)
104
- Gantree::Base.check_for_updates(opts[:auto_updates])
102
+ Gantree::Base.check_for_updates(opts)
105
103
  docker = Gantree::Docker.new(opts)
106
104
  docker.pull
107
105
  docker.build
@@ -65,7 +65,6 @@ module Gantree
65
65
  @packaged_version = version.run
66
66
  puts @packaged_version
67
67
  upload_to_s3
68
- version.clean_up
69
68
  create_eb_version
70
69
  update_application(envs)
71
70
  if @options[:slack]
@@ -84,6 +83,7 @@ module Gantree
84
83
  `git tag #{tag}`
85
84
  `git push --tags`
86
85
  end
86
+ version.clean_up
87
87
  end
88
88
 
89
89
  def upload_to_s3
@@ -34,7 +34,8 @@ module Gantree
34
34
  end
35
35
 
36
36
  def create_version_files
37
- version = "#{tag}-#{Time.now.strftime("%b-%d-%Y-%a-%H-%M-%S")}"
37
+ clean_up
38
+ version = "#{tag}-#{Time.now.strftime("%m-%d-%Y-%H-%M-%S")}"
38
39
  puts "version: #{version}"
39
40
  set_image_path if @options[:image_path]
40
41
  set_tag_to_deploy
@@ -46,13 +47,10 @@ module Gantree
46
47
  Archive::Zip.archive(zip, ['/tmp/merged_extensions/.ebextensions/', "/tmp/#{@dockerrun_file}"])
47
48
  zip
48
49
  else
49
- new_dockerrun = "#{version}-Dockerrun.aws.json"
50
- FileUtils.cp("Dockerrun.aws.json", new_dockerrun)
50
+ new_dockerrun = "/tmp/#{version}-Dockerrun.aws.json"
51
+ FileUtils.cp("/tmp/Dockerrun.aws.json", new_dockerrun)
51
52
  new_dockerrun
52
53
  end
53
- rescue => e
54
- puts e
55
- clean_up
56
54
  end
57
55
 
58
56
  def ext?
@@ -109,18 +107,15 @@ module Gantree
109
107
  end
110
108
 
111
109
  def clean_up
112
- `rm -rf #{@packaged_version}` if @packaged_version
113
- `git checkout Dockerrun.aws.json` # reverts back to original Dockerrun.aws.json
114
- FileUtils.rm_rf("/tmp/#{@ext.split('/').last}")
115
- FileUtils.rm_rf("/tmp/#{@ext_role.split('/').last}:#{get_role_type}")
116
- FileUtils.rm_rf("/tmp/merged_extensions/")
117
- rescue => e
118
- puts "Warning: had some trouble cleaning up".yellow
119
- puts e
110
+ puts "Cleaning up tmp files".yellow
111
+ FileUtils.rm_rf @packaged_version if @packaged_version
112
+ FileUtils.rm_rf("/tmp/#{@ext.split('/').last}") if File.directory?("/tmp/#{@ext.split('/').last}")
113
+ FileUtils.rm_rf("/tmp/#{@ext_role.split('/').last}:#{get_role_type}") if File.directory?("/tmp/#{@ext_role.split('/').last}:#{get_role_type}")
114
+ FileUtils.rm_rf("/tmp/merged_extensions/") if File.directory? "/tmp/merged_extensions/"
115
+ puts "All tmp files removed".green
120
116
  end
121
117
 
122
118
  def merge_extensions
123
- clean_up
124
119
  FileUtils.mkdir("/tmp/merged_extensions/")
125
120
  FileUtils.mkdir("/tmp/merged_extensions/.ebextensions/")
126
121
  clone_repo @ext if @ext
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.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.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix