gantree 0.5.0.3 → 0.5.4

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: 3bf98bc9b304d88f1c0ee9c012239333bea4f06a
4
- data.tar.gz: 161750ff6a62c5bb886c80b88800cd9d51b75702
3
+ metadata.gz: c242782702e57708410c762edd84b13c08082398
4
+ data.tar.gz: e2c1ba2f4cb50e511700472625b9251eb4752e3f
5
5
  SHA512:
6
- metadata.gz: 438ee215aa01d6ff678415159f214e75d25c887f73ad485c2db1c7999a2df5c1f8d33fda84e1d8329f85596fcfa2c25298f8e506f8f05603563b736177cb13cf
7
- data.tar.gz: b2ae88c49c0c617bb11fdb90a2f01b97110d5de8dd24f7aa308b4987a69639e614c62f2a7d7051a5dc1c1b55bb6c08a54b4444feef032acb835bb90bf5434b4b
6
+ metadata.gz: 6de1cebaddcf3fbcd1c78b06976064cd8297e4f4879ec96c8b534394cb6084bdc8fb7fb18e62350c11e084e8ae8f5a18be6147515adc46f2cdbec477a125f2e2
7
+ data.tar.gz: b3f18845e6d20e3f950a4ab924cf1ee7298379ab539900fc2d6f045cdc373c0ba53f4397d902b3314ca6350057f8450307d677c55e28c0cea7c555bb4de338c3
data/Gemfile CHANGED
@@ -17,4 +17,6 @@ gem "highline"
17
17
  gem "pry"
18
18
  gem "vcr"
19
19
  gem "fakeweb"
20
- gem "colorize"
20
+ gem "colorize"
21
+ gem "librato-metrics"
22
+ gem "aws-sdk", "~>2.0.29"
@@ -1,81 +1,111 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- addressable (2.3.6)
4
+ addressable (2.3.8)
5
+ aggregate (0.2.2)
5
6
  archive-zip (0.7.0)
6
7
  io-like (~> 0.3.0)
8
+ aws-sdk (2.0.34)
9
+ aws-sdk-resources (= 2.0.34)
10
+ aws-sdk-core (2.0.34)
11
+ builder (~> 3.0)
12
+ jmespath (~> 1.0)
13
+ multi_json (~> 1.0)
14
+ aws-sdk-resources (2.0.34)
15
+ aws-sdk-core (= 2.0.34)
7
16
  aws-sdk-v1 (1.55.0)
8
17
  json (~> 1.4)
9
18
  nokogiri (>= 1.4.4)
19
+ builder (3.2.2)
10
20
  celluloid (0.16.0)
11
21
  timers (~> 4.0.0)
12
22
  cloudformation-ruby-dsl (0.4.6)
13
23
  detabulator
14
- codeclimate-test-reporter (0.4.2)
24
+ codeclimate-test-reporter (0.4.7)
15
25
  simplecov (>= 0.7.1, < 1.0.0)
16
26
  coderay (1.1.0)
17
- colorize (0.7.3)
27
+ colorize (0.7.5)
18
28
  crack (0.4.2)
19
29
  safe_yaml (~> 1.0.0)
20
30
  detabulator (0.1.0)
21
31
  diff-lcs (1.2.5)
22
32
  docile (1.1.5)
23
33
  fakeweb (1.3.0)
24
- ffi (1.9.6)
34
+ faraday (0.9.1)
35
+ multipart-post (>= 1.2, < 3)
36
+ ffi (1.9.8)
25
37
  formatador (0.2.5)
26
- guard (2.10.1)
38
+ guard (2.12.5)
27
39
  formatador (>= 0.2.4)
28
40
  listen (~> 2.7)
29
41
  lumberjack (~> 1.0)
42
+ nenv (~> 0.1)
43
+ notiffany (~> 0.0)
30
44
  pry (>= 0.9.12)
45
+ shellany (~> 0.0)
31
46
  thor (>= 0.18.1)
32
- guard-bundler (2.0.0)
47
+ guard-bundler (2.1.0)
33
48
  bundler (~> 1.0)
34
49
  guard (~> 2.2)
35
- guard-rspec (4.3.1)
50
+ guard-compat (~> 1.1)
51
+ guard-compat (1.2.1)
52
+ guard-rspec (4.5.0)
36
53
  guard (~> 2.1)
37
- rspec (>= 2.14, < 4.0)
38
- highline (1.6.21)
54
+ guard-compat (~> 1.1)
55
+ rspec (>= 2.99.0, < 4.0)
56
+ highline (1.7.1)
39
57
  hitimes (1.2.2)
40
58
  io-like (0.3.0)
41
- json (1.8.1)
42
- listen (2.8.3)
43
- celluloid (>= 0.15.2)
59
+ jmespath (1.0.2)
60
+ multi_json (~> 1.0)
61
+ json (1.8.2)
62
+ librato-metrics (1.5.0)
63
+ aggregate (~> 0.2.2)
64
+ faraday (~> 0.7)
65
+ multi_json
66
+ listen (2.10.0)
67
+ celluloid (~> 0.16.0)
44
68
  rb-fsevent (>= 0.9.3)
45
69
  rb-inotify (>= 0.9)
46
70
  lumberjack (1.0.9)
47
71
  method_source (0.8.2)
48
- mini_portile (0.6.1)
49
- multi_json (1.10.1)
72
+ mini_portile (0.6.2)
73
+ multi_json (1.11.0)
50
74
  multipart-post (2.0.0)
51
- nokogiri (1.6.5)
75
+ nenv (0.2.0)
76
+ nokogiri (1.6.6.2)
52
77
  mini_portile (~> 0.6.0)
78
+ notiffany (0.0.6)
79
+ nenv (~> 0.1)
80
+ shellany (~> 0.0)
53
81
  pry (0.10.1)
54
82
  coderay (~> 1.1.0)
55
83
  method_source (~> 0.8.1)
56
84
  slop (~> 3.4)
57
- rake (10.4.0)
85
+ rake (10.4.2)
58
86
  rb-fsevent (0.9.4)
59
87
  rb-inotify (0.9.5)
60
88
  ffi (>= 0.5.0)
61
- rspec (3.1.0)
62
- rspec-core (~> 3.1.0)
63
- rspec-expectations (~> 3.1.0)
64
- rspec-mocks (~> 3.1.0)
65
- rspec-core (3.1.7)
66
- rspec-support (~> 3.1.0)
67
- rspec-expectations (3.1.2)
89
+ rspec (3.2.0)
90
+ rspec-core (~> 3.2.0)
91
+ rspec-expectations (~> 3.2.0)
92
+ rspec-mocks (~> 3.2.0)
93
+ rspec-core (3.2.2)
94
+ rspec-support (~> 3.2.0)
95
+ rspec-expectations (3.2.0)
96
+ diff-lcs (>= 1.2.0, < 2.0)
97
+ rspec-support (~> 3.2.0)
98
+ rspec-mocks (3.2.1)
68
99
  diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.1.0)
70
- rspec-mocks (3.1.3)
71
- rspec-support (~> 3.1.0)
72
- rspec-support (3.1.2)
100
+ rspec-support (~> 3.2.0)
101
+ rspec-support (3.2.2)
73
102
  safe_yaml (1.0.4)
74
- simplecov (0.9.1)
103
+ shellany (0.0.1)
104
+ simplecov (0.9.2)
75
105
  docile (~> 1.1.0)
76
106
  multi_json (~> 1.0)
77
- simplecov-html (~> 0.8.0)
78
- simplecov-html (0.8.0)
107
+ simplecov-html (~> 0.9.0)
108
+ simplecov-html (0.9.0)
79
109
  slackr (0.0.6)
80
110
  multipart-post (~> 2.0.0)
81
111
  slop (3.6.0)
@@ -83,7 +113,7 @@ GEM
83
113
  timers (4.0.1)
84
114
  hitimes
85
115
  vcr (2.9.3)
86
- webmock (1.20.4)
116
+ webmock (1.21.0)
87
117
  addressable (>= 2.3.6)
88
118
  crack (>= 0.3.2)
89
119
 
@@ -92,6 +122,7 @@ PLATFORMS
92
122
 
93
123
  DEPENDENCIES
94
124
  archive-zip (~> 0.7.0)
125
+ aws-sdk (~> 2.0.29)
95
126
  aws-sdk-v1 (~> 1.55.0)
96
127
  cloudformation-ruby-dsl (= 0.4.6)
97
128
  codeclimate-test-reporter
@@ -102,6 +133,7 @@ DEPENDENCIES
102
133
  guard-rspec
103
134
  highline
104
135
  json
136
+ librato-metrics
105
137
  pry
106
138
  rake
107
139
  rspec
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Gantree
2
2
 
3
+ [![Join the chat at https://gitter.im/feelobot/gantree](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/feelobot/gantree?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+
3
5
  [![Circle CI](https://circleci.com/gh/feelobot/gantree/tree/master.svg?style=svg)](https://circleci.com/gh/feelobot/gantree/tree/master)
4
6
  [![Test Coverage](https://codeclimate.com/github/feelobot/gantree/badges/coverage.svg)](https://codeclimate.com/github/feelobot/gantree)
5
7
  [![Code Climate](https://codeclimate.com/github/feelobot/gantree/badges/gpa.svg)](https://codeclimate.com/github/feelobot/gantree)
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "thor"
22
22
  spec.add_dependency "aws-sdk-v1", "~>1.55.0"
23
+ spec.add_dependency "aws-sdk"
23
24
  spec.add_dependency "hashie"
24
25
  spec.add_dependency "colorize"
25
26
  spec.add_dependency "rubyzip"
@@ -29,6 +30,7 @@ Gem::Specification.new do |spec|
29
30
  spec.add_dependency "slackr","0.0.6"
30
31
  spec.add_dependency "highline"
31
32
  spec.add_dependency "pry"
33
+ spec.add_dependency "librato-metrics"
32
34
 
33
35
  spec.add_development_dependency "bundler", "~> 1.3"
34
36
  spec.add_development_dependency "rake"
@@ -1,4 +1,5 @@
1
1
  require "colorize"
2
+ require 'librato/metrics'
2
3
  module Gantree
3
4
  class Base
4
5
  def check_credentials
@@ -34,9 +35,11 @@ module Gantree
34
35
 
35
36
  def tag
36
37
  origin = `git config --get remote.origin.url`.match("com(.*)\/")[1].gsub(":","").gsub("/","").strip
37
- branch = `git rev-parse --abbrev-ref HEAD`.gsub("/", "_").strip.downcase
38
+ branch = `git rev-parse --abbrev-ref HEAD`.strip
38
39
  hash = `git rev-parse --verify --short #{branch}`.strip
39
- "#{origin}-#{branch}-#{hash}"
40
+ "#{origin}-#{branch.gsub('-','')}-#{hash}".gsub("/", "").downcase
41
+ rescue
42
+ puts "ERROR: Using outside of a git repository".red
40
43
  end
41
44
 
42
45
  def create_default_env
@@ -47,6 +50,12 @@ module Gantree
47
50
  raise "Please Set Envinronment Name with -e"
48
51
  end
49
52
  end
53
+
54
+ def authenticate_librato
55
+ if @options[:librato]
56
+ Librato::Metrics.authenticate @options[:librato][:email], @options[:librato][:token]
57
+ end
58
+ end
50
59
 
51
60
  def env_type
52
61
  if @options[:env].include?("prod")
@@ -11,8 +11,9 @@ module Gantree
11
11
  desc "deploy APP", "deploy specified APP"
12
12
  long_desc Help.deploy
13
13
  option :branch, :desc => 'branch to deploy'
14
- option :tag, :aliases => "-t", :desc => "set docker tag to deploy"
14
+ option :tag, :aliases => "-t", :desc => "set docker tag to deploy", :default => Gantree::Base.new.tag
15
15
  option :ext, :aliases => "-x", :desc => "ebextensions folder/repo"
16
+ option :ext_role, :desc => "role based extension repo (bleacher specific)"
16
17
  option :silent, :aliases => "-s", :desc => "mute notifications"
17
18
  option :image_path, :aliases => "-i", :desc => "docker hub image path ex. (bleacher/cms | quay.io/bleacherreport/cms)"
18
19
  option :autodetect_app_role, :desc => "use naming convention to determin role (true|false)", :type => :boolean, :default => true
@@ -83,7 +84,7 @@ module Gantree
83
84
 
84
85
  desc "tag", "tag a docker application"
85
86
  def tag
86
- puts Gantree::Docker.new(merge_defaults(options)).tag
87
+ puts Gantree::Base::new.tag
87
88
  end
88
89
 
89
90
  desc "ship", "build, push and deploy docker container to elastic beanstalk"
@@ -98,6 +99,7 @@ module Gantree
98
99
  option :eb_bucket, :desc => "bucket to store elastic beanstalk versions"
99
100
  def ship server
100
101
  docker = Gantree::Docker.new(merge_defaults(options))
102
+ docker.pull
101
103
  docker.build
102
104
  docker.push
103
105
  Gantree::Deploy.new(server, merge_defaults(options)).run
@@ -1,12 +1,13 @@
1
1
  require 'json'
2
2
  require 'archive/zip'
3
3
  require 'colorize'
4
+ require 'librato/metrics'
5
+ require_relative 'release_notes'
4
6
  require_relative 'notification'
5
7
 
6
8
  module Gantree
7
9
  class Deploy < Base
8
10
  attr_reader :name
9
-
10
11
  def initialize name, options
11
12
  check_credentials
12
13
  set_aws_keys
@@ -57,10 +58,12 @@ module Gantree
57
58
  end
58
59
 
59
60
  def deploy(envs)
61
+ @envs = envs
60
62
  check_dir_name(envs) unless @options[:force]
61
63
  return if @options[:dry_run]
62
- version = DeployVersion.new(@options)
64
+ version = DeployVersion.new(@options, envs[0])
63
65
  @packaged_version = version.run
66
+ puts @packaged_version
64
67
  upload_to_s3
65
68
  version.clean_up
66
69
  create_eb_version
@@ -70,6 +73,17 @@ module Gantree
70
73
  msg += "Tag: #{@options[:tag]}" if @options[:tag]
71
74
  Notification.new(@options[:slack]).say(msg) unless @options[:silent]
72
75
  end
76
+ if @options[:librato]
77
+ puts "Found Librato Key"
78
+ Librato::Metrics.authenticate @options[:librato]["email"], @options[:librato]["token"]
79
+ Librato::Metrics.annotate :deploys, "deploys",:source => "#{@app}", :start_time => Time.now.to_i
80
+ puts "Librato metric submitted"
81
+ end
82
+ if @options[:release_notes_wiki] && prod_deploy?
83
+ ReleaseNotes.new(@options[:release_notes_wiki], @app, new_hash).create
84
+ `git tag #{tag}`
85
+ `git push --tags`
86
+ end
73
87
  end
74
88
 
75
89
  def upload_to_s3
@@ -131,6 +145,12 @@ module Gantree
131
145
  "eb-bucket-#{unique_hash}"
132
146
  end
133
147
 
148
+ def prod_deploy?
149
+ @envs.first.split("-").first == "prod"
150
+ end
151
+ def new_hash
152
+ @packaged_version.split("-")[2]
153
+ end
134
154
  end
135
155
  end
136
156
 
@@ -6,10 +6,12 @@ require_relative 'notification'
6
6
  module Gantree
7
7
  class DeployVersion < Deploy
8
8
 
9
- def initialize options
9
+ def initialize options, env
10
10
  @options = options
11
11
  @ext = @options[:ext]
12
+ @ext_role = @options[:ext_role]
12
13
  @dockerrun_file = "Dockerrun.aws.json"
14
+ @env = env
13
15
  end
14
16
 
15
17
  def run
@@ -20,14 +22,14 @@ module Gantree
20
22
  docker = JSON.parse(IO.read(@dockerrun_file))
21
23
  image = docker["Image"]["Name"]
22
24
  image.gsub!(/:(.*)$/, ":#{@options[:tag]}")
23
- IO.write(@dockerrun_file, JSON.pretty_generate(docker))
25
+ IO.write("/tmp/#{@dockerrun_file}", JSON.pretty_generate(docker))
24
26
  end
25
27
 
26
28
  def set_image_path
27
29
  docker = JSON.parse(IO.read(@dockerrun_file))
28
30
  image = docker["Image"]["Name"]
29
31
  image.gsub!(/(.*):/, "#{@options[:image_path]}:")
30
- IO.write(@dockerrun_file, JSON.pretty_generate(docker))
32
+ IO.write("/tmp/#{@dockerrun_file}", JSON.pretty_generate(docker))
31
33
  image
32
34
  end
33
35
 
@@ -35,17 +37,22 @@ module Gantree
35
37
  version = "#{tag}-#{Time.now.strftime("%b-%d-%Y-%a-%H-%M-%S")}"
36
38
  puts "version: #{version}"
37
39
  set_image_path if @options[:image_path]
38
- set_tag_to_deploy if @options[:tag]
39
- unless ext?
40
+ set_tag_to_deploy
41
+ if File.directory?(".ebextensions/") || @ext || @ext_role
42
+ zip = "#{version}.zip"
43
+ merge_extensions
44
+ puts "The following files are being zipped".yellow
45
+ system('ls -l /tmp/merged_extensions/.ebextensions/')
46
+ Archive::Zip.archive(zip, ['/tmp/merged_extensions/.ebextensions/', "/tmp/#{@dockerrun_file}"])
47
+ zip
48
+ else
40
49
  new_dockerrun = "#{version}-Dockerrun.aws.json"
41
50
  FileUtils.cp("Dockerrun.aws.json", new_dockerrun)
42
51
  new_dockerrun
43
- else
44
- zip = "#{version}.zip"
45
- clone_repo if repo?
46
- Archive::Zip.archive(zip, ['.ebextensions/', @dockerrun_file])
47
- zip
48
52
  end
53
+ rescue => e
54
+ puts e
55
+ clean_up
49
56
  end
50
57
 
51
58
  def ext?
@@ -65,43 +72,63 @@ module Gantree
65
72
  end
66
73
  end
67
74
 
68
- def local?
69
- File.directory?(@ext)
75
+ def local_extensions?
76
+ File.directory?(".ebextensions/")
70
77
  end
71
78
 
72
- def get_ext_repo
73
- if ext_branch?
74
- @ext.sub(":#{get_ext_branch}", '')
79
+ def get_ext_repo repo
80
+ if ext_branch? repo
81
+ repo.sub(":#{get_ext_branch repo}", '')
75
82
  else
76
- @ext
83
+ repo
77
84
  end
78
85
  end
79
86
 
80
- def ext_branch?
81
- if @ext.count(":") == 2
87
+ def ext_branch? repo
88
+ if repo.count(":") == 2
82
89
  true
83
90
  else
84
91
  false
85
92
  end
86
93
  end
87
94
 
88
- def get_ext_branch
89
- branch = @ext.match(/:.*(:.*)$/)[1]
95
+ def get_ext_branch repo
96
+ branch = repo.match(/:.*(:.*)$/)[1]
90
97
  branch.tr(':','')
91
98
  end
92
99
 
93
- def clone_repo
94
- if ext_branch?
95
- `git clone -b #{get_ext_branch} #{get_ext_repo}`
100
+ def clone_repo repo
101
+ repo_name = repo.split('/').last
102
+ FileUtils.mkdir("/tmp/#{repo_name}")
103
+ if ext_branch? repo
104
+ `git clone -b #{get_ext_branch repo} #{get_ext_repo repo} /tmp/#{repo_name}/`
96
105
  else
97
- `git clone #{get_ext_repo}`
106
+ `git clone #{get_ext_repo repo} /tmp/#{repo_name}/`
98
107
  end
108
+ FileUtils.cp_r "/tmp/#{repo_name}/.", "/tmp/merged_extensions/.ebextensions/"
99
109
  end
100
110
 
101
111
  def clean_up
102
- FileUtils.rm_rf(@packaged_version)
112
+ `rm -rf #{@packaged_version}` if @packaged_version
103
113
  `git checkout Dockerrun.aws.json` # reverts back to original Dockerrun.aws.json
104
- `rm -rf .ebextensions/` if ext?
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
120
+ end
121
+
122
+ def merge_extensions
123
+ clean_up
124
+ FileUtils.mkdir("/tmp/merged_extensions/")
125
+ FileUtils.mkdir("/tmp/merged_extensions/.ebextensions/")
126
+ clone_repo @ext if @ext
127
+ clone_repo "#{@ext_role}:#{get_role_type}" if @ext_role
128
+ FileUtils.cp_r('.ebextensions/.','/tmp/merged_extensions/.ebextensions') if File.directory? ".ebextensions/"
129
+ end
130
+ def get_role_type
131
+ @env.split('-')[2]
105
132
  end
106
133
  end
107
134
  end
@@ -10,6 +10,18 @@ module Gantree
10
10
  @image_path = @options[:image_path]
11
11
  raise "Please provide an image path name in .gantreecfg ex. { 'image_path' : 'bleacher/cms' }" unless @image_path
12
12
  @tag = @options[:tag] ||= tag
13
+ @base_image_tag = @options[:base_image_tag]
14
+ end
15
+
16
+ def pull
17
+ puts "Pulling Image First..."
18
+ if @base_image_tag
19
+ puts "Pulled Image: #{@image_path}:#{@base_image_tag}".green if system("docker pull #{i@image_path}:#{@base_image_tag}")
20
+ elsif system("docker pull #{@image_path}")
21
+ puts "Pulled Image: #{@image_path}".green
22
+ else
23
+ puts "Failed to Pull Image #{@image_path}".red
24
+ end
13
25
  end
14
26
 
15
27
  def build
@@ -0,0 +1,57 @@
1
+ require 'aws-sdk'
2
+ module Gantree
3
+ class ReleaseNotes
4
+ def initialize wiki, app, hash
5
+ @application = app
6
+ @new_hash = hash
7
+ @wiki_url = wiki
8
+ end
9
+
10
+ def create
11
+ get_release_notes
12
+ write_release_notes
13
+ commit_release_notes
14
+ end
15
+
16
+ def get_release_notes
17
+ rl_dir = "/tmp/wiki_release_notes"
18
+ FileUtils.rm_rf(rl_dir) if File.directory? rl_dir
19
+ `git clone #{@wiki_url} /tmp/wiki_release_notes/`
20
+ end
21
+
22
+ def write_release_notes
23
+ wiki_dir = "/tmp/wiki_release_notes/"
24
+ release_notes_file = "Release-notes-br-#{@application}.md"
25
+ path_to_wiki_file = "#{wiki_dir}#{release_notes_file}"
26
+ `touch #{path_to_wiki_file}` unless File.exist? "#{path_to_wiki_file}"
27
+ `printf "#{release_notes}\n\n" | cat - #{path_to_wiki_file} > #{path_to_wiki_file}.tmp && mv #{path_to_wiki_file}.tmp #{path_to_wiki_file}`
28
+ end
29
+
30
+ def release_notes
31
+ time = Time.now.strftime("%a, %e %b %Y %H:%M:%S %z")
32
+ "#{time} [#{last_deployed_hash}...#{@new_hash}](https://github.com/br/#{@application}/compare/#{last_deployed_hash}...#{@new_hash})"
33
+ end
34
+
35
+ def last_deployed_hash
36
+ get_latest_tag.split("-").last
37
+ end
38
+
39
+ def get_latest_tag
40
+ Aws.config[:credentials]
41
+ beanstalk = Aws::ElasticBeanstalk::Client.new
42
+ resp = beanstalk.describe_application_versions(
43
+ application_name: @application,
44
+ )
45
+ label = resp["application_versions"].select {|version| version["version_label"].include?("br-master") }.first
46
+ if label
47
+ label["version_label"].split("-")[0..2].join('-')
48
+ else
49
+ raise "No Master Tags Deployed:\n #{resp["application_versions"].inspect}"
50
+ 500
51
+ end
52
+ end
53
+ def commit_release_notes
54
+ `cd /tmp/wiki_release_notes && git add . && git commit -am "Updated release notes" && git push origin master`
55
+ end
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.5.0.3"
2
+ VERSION = "0.5.4"
3
3
  end
@@ -0,0 +1,25 @@
1
+
2
+ require "spec_helper"
3
+ require "pry"
4
+
5
+ describe Gantree::ReleaseNotes do
6
+ before(:all) do
7
+ @app = "cms"
8
+ @hash = "9ef330b"
9
+ @wiki = "git@github.com:br/dev.wiki.git"
10
+ @release_notes = Gantree::ReleaseNotes.new(@wiki,@app,@hash)
11
+ @release_notes.instance_variable_set("@beanstalk", Aws::ElasticBeanstalk::Client.new(stub_responses: true))
12
+ end
13
+
14
+ it "can retrieve the latest deployed master tag" do
15
+ expect(@release_notes.send(:get_latest_tag)).to include "br-master"
16
+ end
17
+
18
+ it "can get the last deployed hash" do
19
+ expect(@release_notes.send(:last_deployed_hash).length).to eq 7
20
+ end
21
+
22
+ it "can show release notes" do
23
+ expect(@release_notes.send(:release_notes)).to include "github.com/br/#{@app}/compare/#{@release_notes.send(:last_deployed_hash)}..."
24
+ end
25
+ end
@@ -3,8 +3,6 @@ require "pry"
3
3
 
4
4
  describe Gantree::Deploy do
5
5
  before(:all) do
6
- ENV['AWS_ACCESS_KEY_ID'] = 'FAKE_AWS_ACCESS_KEY'
7
- ENV['AWS_SECRET_ACCESS_KEY'] = 'FAKE_AWS_SECRET_ACCESS_KEY'
8
6
 
9
7
  @stack_name = "knarr-stag-s1"
10
8
  @env = "stag-knarr-app-s1"
@@ -16,15 +14,17 @@ describe Gantree::Deploy do
16
14
 
17
15
  it "returns branch name of repo url" do
18
16
  options = { ext: "git@github.com:br/.ebextensions:basic" }
19
- expect(Gantree::DeployVersion.new(options).send(:get_ext_branch)).to eq "basic"
17
+ expect(Gantree::DeployVersion.new(options, @env).send(:get_ext_branch,options[:ext])).to eq "basic"
20
18
  end
21
19
 
22
20
  it "returns just the repo url" do
23
21
  options = { ext: "git@github.com:br/.ebextensions:basic" }
24
- expect(Gantree::DeployVersion.new(options).send(:get_ext_repo)).to eq "git@github.com:br/.ebextensions"
22
+ expect(Gantree::DeployVersion.new(options,@env).send(:get_ext_repo, options[:ext])).to eq "git@github.com:br/.ebextensions"
25
23
  end
26
-
24
+
27
25
  it "AWS gets the correct keys" do
26
+ ENV['AWS_ACCESS_KEY_ID'] = 'FAKE_AWS_ACCESS_KEY'
27
+ ENV['AWS_SECRET_ACCESS_KEY'] = 'FAKE_AWS_SECRET_ACCESS_KEY'
28
28
  gd = Gantree::Deploy.new(
29
29
  "image_name",
30
30
  :env => "cauldron-stag-s1"
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.5.0.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.55.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: aws-sdk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: hashie
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +178,20 @@ dependencies:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: librato-metrics
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: bundler
169
197
  requirement: !ruby/object:Gem::Requirement
@@ -284,8 +312,10 @@ files:
284
312
  - lib/gantree/docker.rb
285
313
  - lib/gantree/init.rb
286
314
  - lib/gantree/notification.rb
315
+ - lib/gantree/release_notes.rb
287
316
  - lib/gantree/update.rb
288
317
  - lib/gantree/version.rb
318
+ - spec/lib/gantree/1_release_notes_spec.rb
289
319
  - spec/lib/gantree/cli_spec.rb
290
320
  - spec/lib/gantree/deploy_spec.rb
291
321
  - spec/lib/gantree/docker_spec.rb
@@ -319,6 +349,7 @@ summary: This tool is intended to help you setup a Dockerrun.aws.json which allo
319
349
  allows you to do versioned deploys to your Elastic Beanstalk application and create
320
350
  an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service.
321
351
  test_files:
352
+ - spec/lib/gantree/1_release_notes_spec.rb
322
353
  - spec/lib/gantree/cli_spec.rb
323
354
  - spec/lib/gantree/deploy_spec.rb
324
355
  - spec/lib/gantree/docker_spec.rb