gantree 0.5.5 → 0.5.6
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/base.rb +17 -10
- data/lib/gantree/cli.rb +2 -4
- data/lib/gantree/deploy.rb +1 -1
- data/lib/gantree/deploy_version.rb +10 -15
- data/lib/gantree/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87590bdf6a18af8ca085d1d15fced297ad9c2bdf
|
4
|
+
data.tar.gz: 632a00ef006d70bad2d6e7e055b6cc2e00030136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed60ac21a9d8863a4b0036a6af1708a7b5f68a34c7e4ac5f242bbd794d4e91511ecb31a12c304011431a8c66d88f934562384b340814bad19b00159302e60d76
|
7
|
+
data.tar.gz: 9e9b6879f83124fd6d25806e0dbd12bcd519faa99506483ff1e4bc70946fbdacfb8d4a1db7177088eba57236458e24b515ff8d2a07d77aa0a2dc267d4ca41e55
|
data/lib/gantree/base.rb
CHANGED
@@ -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
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
18
|
+
if current_version < latest_version && enabled
|
17
19
|
puts "Updating from #{current_version} to #{latest_version}...".green
|
18
|
-
|
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
|
data/lib/gantree/cli.rb
CHANGED
@@ -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
|
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
|
102
|
+
Gantree::Base.check_for_updates(opts)
|
105
103
|
docker = Gantree::Docker.new(opts)
|
106
104
|
docker.pull
|
107
105
|
docker.build
|
data/lib/gantree/deploy.rb
CHANGED
@@ -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
|
-
|
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 = "
|
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
|
-
|
113
|
-
|
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
|
-
|
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
|
data/lib/gantree/version.rb
CHANGED