gantree 0.1.3 → 0.1.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: daac40fc78c4d167ac70cea2e09855067b8ed912
4
- data.tar.gz: 23e44ef2b8b76ca7be0c9dc31bd7041f34411cfa
3
+ metadata.gz: 0f48e2e22a4ed8c5c3f2bbeae9e2625c3392addb
4
+ data.tar.gz: 837ccf109dbdb37e60c8bf4ec81f9a3091020e14
5
5
  SHA512:
6
- metadata.gz: 07af7b7d78fc3efe1da1109526c9b8fe03b5979e244228f98834ef66137d66afde53dcbf7bd0cc2bffddb992abb020db6558a34173219b4a4a89086b3910e3e4
7
- data.tar.gz: b26c9f67e3a77550d7bc9c2d36d5fbb0f8d445dd59822a067483c4a42dd50e76cfee0395f490303bd04d0c03478b71cb3756719a17c346af60496b5a6637d729
6
+ metadata.gz: 7e6e2bf6e3916fa30814bbdf3d0201a95bfc19323014707dba2403eeb1f10064f6415ce3f0e3bbb264a92e9d91275c01aecf90c29365dbfcb7c7b595e22e6a0b
7
+ data.tar.gz: 2f898c102abe776eb5ab8dbe71bd9ecf1e6a8278b79ca061232a8bf3739147d0459f000c1c54cd0051e318b1c05071d397f97fa26a8e3639b805304ff4764f82
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gem "codeclimate-test-reporter", group: :test, require: nil
5
5
  gem "aws-sdk"
6
6
  gem "guard", group: :test
7
+ gem "guard-bundler", group: :test
7
8
  gem "rspec", group: :test
8
9
  gem "rake"
9
10
  gem "guard-rspec", require: false
data/Gemfile.lock CHANGED
@@ -29,6 +29,9 @@ GEM
29
29
  lumberjack (~> 1.0)
30
30
  pry (>= 0.9.12)
31
31
  thor (>= 0.18.1)
32
+ guard-bundler (2.0.0)
33
+ bundler (~> 1.0)
34
+ guard (~> 2.2)
32
35
  guard-rspec (4.3.1)
33
36
  guard (~> 2.1)
34
37
  rspec (>= 2.14, < 4.0)
@@ -86,6 +89,7 @@ DEPENDENCIES
86
89
  cloudformation-ruby-dsl
87
90
  codeclimate-test-reporter
88
91
  guard
92
+ guard-bundler
89
93
  guard-rspec
90
94
  json
91
95
  rake
data/Guardfile CHANGED
@@ -1,7 +1,7 @@
1
1
  guard :rspec, cmd: 'bundle exec rspec' do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
- watch(%r{^lib/(.+)\.rb$}) { "spec/gantree_spec.rb" }
4
- watch(%r{^lib/gantree/(.+)\.rb$}) { "spec/gantree_spec.rb" }
3
+ watch(%r{^lib/(.+)\.rb$}) { "spec/cli_spec.rb" }
4
+ watch(%r{^lib/gantree/(.+)\.rb$}) { "spec/cli_spec.rb" }
5
5
  watch('spec/spec_helper.rb') { "spec/gantree_spec.rb" }
6
6
  watch(%r{^lib/gantree/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
7
  end
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/feelobot/gantree.svg)](https://travis-ci.org/feelobot/gantree)
4
4
  [![Test Coverage](https://codeclimate.com/github/feelobot/gantree/badges/coverage.svg)](https://codeclimate.com/github/feelobot/gantree)
5
5
  [![Code Climate](https://codeclimate.com/github/feelobot/gantree/badges/gpa.svg)](https://codeclimate.com/github/feelobot/gantree)
6
+ [![Gem Version](https://badge.fury.io/rb/gantree.svg)](http://badge.fury.io/rb/gantree)
6
7
  ## Why Gantree?
7
8
 
8
9
  The name is derived from the word gantry which is a large crane used in ports to pick up shipping containers and load them on a ship. Gantry was already taken so I spelled it "tree" because the primary use is for elastic beanstalk and I guess a beanstalk is a form of tree?
@@ -14,7 +14,6 @@ module Gantree
14
14
  @env = app
15
15
  @eb = AWS::ElasticBeanstalk::Client.new
16
16
  @s3 = AWS::S3.new
17
- @tag = options.tag
18
17
  end
19
18
 
20
19
  def run
@@ -79,7 +78,7 @@ module Gantree
79
78
  version = "#{@env}-#{hash}"
80
79
  puts "version: #{version}"
81
80
  dockerrun = "Dockerrun.aws.json"
82
- set_tag_to_deploy(dockerrun) if @tag
81
+ set_tag_to_deploy(dockerrun) if @options[:tag]
83
82
  unless ext?
84
83
  new_dockerrun = "#{version}-Dockerrun.aws.json"
85
84
  FileUtils.cp("Dockerrun.aws.json", new_dockerrun)
@@ -94,7 +93,7 @@ module Gantree
94
93
 
95
94
  def set_tag_to_deploy file
96
95
  docker = JSON.parse(IO.read(file))
97
- docker["Image"]["Name"].gsub!(/:(.*)$/, ":#{@tag}")
96
+ docker["Image"]["Name"].gsub!(/:(.*)$/, ":#{@options[:tag]}")
98
97
  IO.write(file,JSON.pretty_generate(docker))
99
98
  end
100
99
 
@@ -120,7 +119,7 @@ module Gantree
120
119
 
121
120
  def get_ext_repo
122
121
  if ext_branch?
123
- repo = @ext.sub.(get_ext_branch)
122
+ repo = @ext.sub(":#{get_ext_branch}", '')
124
123
  else
125
124
  @ext
126
125
  end
@@ -135,7 +134,8 @@ module Gantree
135
134
  end
136
135
 
137
136
  def get_ext_branch
138
- branch = @ext.match(/:.*(:.*)$/)[0]
137
+ branch = @ext.match(/:.*(:.*)$/)[1]
138
+ branch.tr(':','')
139
139
  end
140
140
 
141
141
  def clone_repo
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/spec/lib/cli_spec.rb CHANGED
@@ -34,6 +34,14 @@ describe Gantree::CLI do
34
34
  out = execute("bin/gantree deploy #{@env}")
35
35
  expect(out).to include("Deploying")
36
36
  end
37
+ it "should deploy images with remote extensions" do
38
+ out = execute("bin/gantree deploy #{@env} -x 'git@github.com:br/.ebextensions'")
39
+ expect(out).to include("Deploying")
40
+ end
41
+ it "should deploy images with remote extensions on a branch" do
42
+ out = execute("bin/gantree deploy #{@env} -x 'git@github.com:br/.ebextensions:feature'")
43
+ expect(out).to include("Deploying")
44
+ end
37
45
  end
38
46
 
39
47
  describe "create" do
@@ -42,4 +50,4 @@ describe Gantree::CLI do
42
50
  expect(out).to include "All templates created"
43
51
  end
44
52
  end
45
- end
53
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+ require_relative '../../lib/gantree/deploy'
3
+
4
+ describe "#Deploy" do
5
+ before(:all) do
6
+ @env = "stag-app-knarr-s1"
7
+ @owner = "bleacher"
8
+ @repo = "cauldron"
9
+ @tag = "master"
10
+ @user = "feelobot"
11
+ end
12
+
13
+ describe ".get_ext_branch" do
14
+ it "returns branch name of repo url" do
15
+ options = { ext: "git@github.com:br/.ebextensions:feature" }
16
+ deploy = Gantree::Deploy.new(@env,options)
17
+ expect(deploy.instance_eval { get_ext_branch }).to eq "feature"
18
+ end
19
+ end
20
+
21
+ describe ".get_ext_repo" do
22
+ it "returns just the repo url" do
23
+ options = { ext: "git@github.com:br/.ebextensions:feature" }
24
+ deploy = Gantree::Deploy.new(@env,options)
25
+ puts deploy.instance_eval { get_ext_repo }
26
+ end
27
+ end
28
+ 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.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix
@@ -222,6 +222,7 @@ files:
222
222
  - lib/gantree/init.rb
223
223
  - lib/gantree/version.rb
224
224
  - spec/lib/cli_spec.rb
225
+ - spec/lib/deploy_spec.rb
225
226
  - spec/spec_helper.rb
226
227
  homepage: https://github.com/feelobot/gantree
227
228
  licenses:
@@ -252,4 +253,5 @@ summary: This tool is intended to help you setup a Dockerrun.aws.json which allo
252
253
  an archive of every versioned Dockerrun.aws.json in amazons s3 bucket service.
253
254
  test_files:
254
255
  - spec/lib/cli_spec.rb
256
+ - spec/lib/deploy_spec.rb
255
257
  - spec/spec_helper.rb