gantree 0.6.12 → 0.6.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f116287b6b0d78ea181d2dd0d5b8dde83ac1694
4
- data.tar.gz: b8a77ab6d88277bc91f05610a759c53786e2381d
3
+ metadata.gz: 50b355b94e1db6af77bba9fe524c4a27e3afd233
4
+ data.tar.gz: 0a40a6e40065c15129cb7e2006b3129604af2c3e
5
5
  SHA512:
6
- metadata.gz: cf13c9a5167c09350fce19ca3e97b87fcdf556e93d4854d67b43bdebef8d96171a60fb4e01cf2c27469bf758a46387cfedcb58f4be2aa9c7d04d24ad2f88161c
7
- data.tar.gz: 70ffef4035acf3590e3a0466b728e2773270827bee841417216980e3e94bd40c21a3bcfea82961b18613411100d7305ea110ad8cdf8dc2f2d27d423503bf7ce8
6
+ metadata.gz: 9d9c3adbf26e1aab68b11dcceb7510b13c7b95caa344b2e1b303e6df7e5f74cffcca571e2352cc3a95cf26dc46a30186aa640f429cee429644edd9b35eea38bb
7
+ data.tar.gz: 71bc1db480b53accdd87b128c9b4c2806a41368bb186c42bf9fcc2ef14a175e8e34de3462bb3de72481ac0e55852162aa749bb63293441c5b7826bfbb5b7569d
data/.gitignore CHANGED
@@ -2,6 +2,8 @@
2
2
  *.swo
3
3
  *.gem
4
4
  *.rbc
5
+ *.tar.gz
6
+ .idea
5
7
  .bundle
6
8
  .config
7
9
  .yardoc
@@ -9,7 +11,10 @@ InstalledFiles
9
11
  _yardoc
10
12
  coverage
11
13
  doc/
14
+ gantree-*
12
15
  lib/bundler/man
16
+ packaging/vendor
17
+ packaging/*.tar.gz
13
18
  pkg
14
19
  rdoc
15
20
  spec/reports
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.1.5
@@ -0,0 +1,27 @@
1
+ VERSION := 0.6.17
2
+
3
+ # Change this variable to your organisation s3 bucket
4
+ S3_BUCKET := s3://br-jenkins/gantree
5
+
6
+ all: build
7
+
8
+ version:
9
+ @echo "${VERSION}"
10
+
11
+ build:
12
+ gem build gantree.gemspec
13
+
14
+ install:
15
+ gem install --local gantree-${VERSION}.gem
16
+
17
+ linux:
18
+ #docker run -ti --rm -v `pwd`:/workspace -w /workspace ruby:2.1.5 /bin/bash -c "bundle install && bundle exec rake package:linux:x86_64"
19
+ @echo "=> push latest version linux binary to : ${S3_BUCKET}"
20
+ aws s3 cp ./gantree-${VERSION}-linux-x86_64.tar.gz ${S3_BUCKET}/ --sse AES256 --acl public-read
21
+
22
+ osx:
23
+ docker run -ti --rm -v `pwd`:/workspace -w /workspace ruby:2.1.5 /bin/bash -c "bundle install && bundle exec rake package:osx"
24
+
25
+ clean:
26
+ rm -rf gantree-${VERSION}-*.tar.gz
27
+ rm -rf gantree-${VERSION}.gem
data/README.md CHANGED
@@ -19,6 +19,14 @@ This tool is intended to help you setup a Dockerrun.aws.json which allows you to
19
19
  ### Prerequisites
20
20
  You need to have your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables set in order to use the tool as well as the proper aws permissions for Elastic Beanstalk, and S3 access.
21
21
 
22
+ Note : For gantree versions >= 0.6.14, configuration of AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables is not necessary if running on an instance with IAM Roles enabled.
23
+
24
+ To check if your EC2 has iam role or not, run below command.
25
+
26
+ ```
27
+ curl http://169.254.169.254/latest/meta-data/iam/info/
28
+ ```
29
+
22
30
  *Install docker for MAC OSX*
23
31
  https://docs.docker.com/installation/mac/
24
32
 
@@ -184,6 +192,23 @@ PostgreSQL: ```gantree create your_app_name --rds pg```
184
192
 
185
193
  Mysql: ```gantree create your_app_name --rds msql```
186
194
 
195
+ ## Traveling Ruby :
196
+
197
+ You can now compile this into a tarball and distribute.
198
+
199
+ #### To generate tarball & push to s3.ß
200
+ ```
201
+ # Change below variable in Makefile before you run below command
202
+ S3_BUCKET := s3://<YOUR_AWS_BUCKET>
203
+ make clean && make linux
204
+ ```
205
+ #### To use gantree binary
206
+ ```
207
+ aws s3 cp s3://<your_bucket>/gantree-0.6.15-linux-x86_64.tar.gz .
208
+ tar -xf gantree-0.6.15-linux-x86_64.tar.gz -C /opt
209
+ ln -s /opt/gantree-0.6.15-linux-x86_64/gantree /usr/bin/gantree
210
+ ```
211
+
187
212
  ## TODO:
188
213
 
189
214
  #### What if you want a cdn behind each of your generated applications
data/Rakefile CHANGED
@@ -1,5 +1,11 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
4
+ require 'gantree/version'
5
+
6
+ PACKAGE_NAME = "gantree"
7
+ VERSION = Gantree::VERSION
8
+ TRAVELING_RUBY_VERSION = "20150210-2.1.5"
3
9
 
4
10
  task :default => :spec
5
11
 
@@ -20,3 +26,95 @@ namespace :clean do
20
26
  FileUtils.rm_rf('spec/fixtures/vcr_cassettes')
21
27
  end
22
28
  end
29
+
30
+
31
+ namespace :package do
32
+ namespace :linux do
33
+ desc "Package your app for Linux x86"
34
+ task :x86 => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz"] do
35
+ create_package("linux-x86")
36
+ end
37
+
38
+ desc "Package your app for Linux x86_64"
39
+ task :x86_64 => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz"] do
40
+ create_package("linux-x86_64")
41
+ end
42
+ end
43
+
44
+ desc "Package your app for OS X"
45
+ task :osx => [:bundle_install, "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz"] do
46
+ create_package("osx")
47
+ end
48
+
49
+ desc "Install gems to local directory"
50
+ task :bundle_install do
51
+ if RUBY_VERSION !~ /^2\.1\./
52
+ abort "You can only 'bundle install' using Ruby 2.1, because that's what Traveling Ruby uses."
53
+ end
54
+ sh "rm -rf packaging/tmp"
55
+ sh "mkdir packaging/tmp"
56
+ sh "cp Gemfile Gemfile.lock packaging/tmp/"
57
+ Bundler.with_clean_env do
58
+ sh "cd packaging/tmp && env BUNDLE_IGNORE_CONFIG=1 bundle install --path ../vendor --without development"
59
+ end
60
+ sh "rm -rf packaging/tmp"
61
+ sh "rm -f packaging/vendor/*/*/cache/*"
62
+ end
63
+ end
64
+
65
+ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86.tar.gz" do
66
+ download_runtime("linux-x86")
67
+ end
68
+
69
+ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64.tar.gz" do
70
+ download_runtime("linux-x86_64")
71
+ end
72
+
73
+ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx.tar.gz" do
74
+ download_runtime("osx")
75
+ end
76
+
77
+ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-osx-nokogiri-1.6.5.tar.gz" do
78
+ download_native_extension("osx", "nokogiri-1.6.5")
79
+ end
80
+
81
+ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86-nokogiri-1.6.5.tar.gz" do
82
+ download_native_extension("linux-x86", "nokogiri-1.6.5")
83
+ end
84
+
85
+ file "packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-linux-x86_64-nokogiri-1.6.5.tar.gz" do
86
+ download_native_extension("linux-x86_64", "nokogiri-1.6.5")
87
+ end
88
+
89
+ def download_runtime(target)
90
+ sh "cd packaging && curl -L -O --fail " +
91
+ "https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz"
92
+ end
93
+
94
+ def download_native_extension(target, gem_name_and_version)
95
+ sh "curl -L --fail -o packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}-#{gem_name_and_version}.tar.gz " +
96
+ "https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-gems-#{TRAVELING_RUBY_VERSION}-#{target}/#{gem_name_and_version}.tar.gz"
97
+ end
98
+
99
+ def create_package(target)
100
+ package_dir = "#{PACKAGE_NAME}-#{VERSION}-#{target}"
101
+ sh "rm -rf #{package_dir}"
102
+ sh "mkdir #{package_dir}"
103
+ sh "mkdir -p #{package_dir}/app/bin"
104
+ sh "mkdir -p #{package_dir}/lib/app"
105
+ sh "mkdir #{package_dir}/lib/ruby"
106
+ sh "mkdir #{package_dir}/bin"
107
+ sh "tar -xzf packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz -C #{package_dir}/lib/ruby"
108
+ sh "cp packaging/wrapper.sh #{package_dir}/gantree"
109
+ sh "chmod +x #{package_dir}/gantree"
110
+ sh "cp -pR packaging/vendor #{package_dir}/lib/"
111
+ sh "cp Gemfile Gemfile.lock #{package_dir}/lib/vendor/"
112
+ sh "mkdir #{package_dir}/lib/vendor/.bundle"
113
+ sh "cp packaging/bundler-config #{package_dir}/lib/vendor/.bundle/config"
114
+ sh "cp bin/gantree #{package_dir}/app/bin/gantree"
115
+ sh "cp -a lib #{package_dir}/app"
116
+ if !ENV['DIR_ONLY']
117
+ sh "tar -czf #{package_dir}.tar.gz #{package_dir}"
118
+ sh "rm -rf #{package_dir}"
119
+ end
120
+ end
@@ -2,13 +2,34 @@ require "colorize"
2
2
  require 'librato/metrics'
3
3
  require 'bigdecimal'
4
4
  require 'bigdecimal/util'
5
+ require 'net/http'
6
+
5
7
  module Gantree
6
8
  class Base
7
9
  def check_credentials
8
- raise "Please set your AWS Environment Variables" unless ENV['AWS_SECRET_ACCESS_KEY']
9
- raise "Please set your AWS Environment Variables" unless ENV['AWS_ACCESS_KEY_ID']
10
+ timeout = false
11
+
12
+ url = URI.parse("http://169.254.169.254/latest/meta-data/iam/info/")
13
+
14
+ http = Net::HTTP.new(url.host, url.port)
15
+
16
+ http.read_timeout = 3
17
+ http.open_timeout = 3
18
+
19
+ begin
20
+ resp = http.start() { |http| http.get(url.path) }.code
21
+ rescue Net::OpenTimeout
22
+ timeout = true
23
+ end
24
+
25
+ if timeout == false && resp == '200'
26
+ puts "Using IAM Role".green
27
+ else
28
+ raise "Please set your AWS Environment Variables" unless ENV['AWS_SECRET_ACCESS_KEY']
29
+ raise "Please set your AWS Environment Variables" unless ENV['AWS_ACCESS_KEY_ID']
30
+ end
10
31
  end
11
-
32
+
12
33
  def self.check_for_updates opts
13
34
  puts opts.inspect
14
35
  enabled = opts[:auto_updates]
@@ -19,8 +40,8 @@ module Gantree
19
40
  puts "Auto updates disabled".light_blue if !enabled
20
41
  puts "Updating from #{current_version} to #{latest_version}...".green
21
42
  if current_version == latest_version && enabled
22
- system("gem update gantree --force")
23
- else
43
+ system("gem update gantree --force")
44
+ else
24
45
  puts "gem already up to date".light_blue
25
46
  end
26
47
  update_configuration(opts[:auto_configure]) if opts[:auto_configure]
@@ -42,10 +63,14 @@ module Gantree
42
63
  end
43
64
 
44
65
  def set_aws_keys
45
- AWS.config(
46
- :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
47
- :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
48
- )
66
+ unless ENV['AWS_ACCESS_KEY_ID'] == nil && ENV['AWS_SECRET_ACCESS_KEY'] == nil
67
+ AWS.config(
68
+ :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
69
+ :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
70
+ )
71
+ else
72
+ AWS.config(:credential_provider => AWS::Core::CredentialProviders::EC2Provider.new)
73
+ end
49
74
  end
50
75
 
51
76
  def s3
@@ -78,7 +103,7 @@ module Gantree
78
103
  raise "Please Set Envinronment Name with -e"
79
104
  end
80
105
  end
81
-
106
+
82
107
  def authenticate_librato
83
108
  if @options[:librato]
84
109
  Librato::Metrics.authenticate @options[:librato][:email], @options[:librato][:token]
@@ -126,7 +151,7 @@ module Gantree
126
151
  puts "uploading cfn templates to #{@options[:cfn_bucket]}/#{@options[:stack_name]}"
127
152
  else
128
153
  puts "creating bucket #{@options[:cfn_bucket]}/#{@options[:stack_name]} to upload templates"
129
- s3.buckets.create(bucket_name)
154
+ s3.buckets.create(bucket_name)
130
155
  end
131
156
  end
132
157
 
@@ -36,7 +36,15 @@ module Gantree
36
36
 
37
37
  def set_tag_to_deploy
38
38
  image = docker["Image"]["Name"]
39
- image.gsub!(/:(.*)$/, ":#{@options[:tag]}")
39
+ token = image.split(":")
40
+ if token.length == 3
41
+ image = token[0] + (":") + token[1] + ":#{@options[:tag]}"
42
+ docker["Image"]["Name"] = image
43
+ elsif token.length == 2
44
+ image.gsub!(/:(.*)$/, ":#{@options[:tag]}")
45
+ else
46
+ puts "Too many ':'".yellow
47
+ end
40
48
  IO.write("/tmp/#{@dockerrun_file}", JSON.pretty_generate(docker))
41
49
  end
42
50
 
@@ -1,3 +1,3 @@
1
1
  module Gantree
2
- VERSION = "0.6.12"
2
+ VERSION = "0.6.18"
3
3
  end
@@ -0,0 +1,3 @@
1
+ BUNDLE_PATH: .
2
+ BUNDLE_WITHOUT: development
3
+ BUNDLE_DISABLE_SHARED_GEMS: '1'
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Figure out where this script is located.
5
+ SELFDIR="`readlink -f /usr/bin/gantree`"
6
+ SELFDIR=`dirname $SELFDIR`
7
+
8
+ # Tell Bundler where the Gemfile and gems are.
9
+ export BUNDLE_GEMFILE="$SELFDIR/lib/vendor/Gemfile"
10
+ unset BUNDLE_IGNORE_CONFIG
11
+
12
+ # Run the actual app using the bundled Ruby interpreter, with Bundler activated.
13
+ eval "$SELFDIR/lib/ruby/bin/ruby" -rbundler/setup -rreadline "$SELFDIR/app/bin/gantree $@"
14
+
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.6.12
4
+ version: 0.6.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2016-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -291,6 +291,7 @@ files:
291
291
  - Gemfile.lock
292
292
  - Guardfile
293
293
  - LICENSE.txt
294
+ - Makefile
294
295
  - README.md
295
296
  - Rakefile
296
297
  - bin/gantree
@@ -317,6 +318,8 @@ files:
317
318
  - lib/gantree/update.rb
318
319
  - lib/gantree/version.rb
319
320
  - lib/gantree/wiki.rb
321
+ - packaging/bundler-config
322
+ - packaging/wrapper.sh
320
323
  - spec/fixtures/project/Dockerrun.aws.json
321
324
  - spec/lib/gantree/1_release_notes_spec.rb
322
325
  - spec/lib/gantree/cli_spec.rb