From c652797f3635e832029bf537fac6754ece24d41d Mon Sep 17 00:00:00 2001 From: Felix Rodriguez Date: Wed, 10 Jun 2015 21:44:48 -0700 Subject: [PATCH 1/3] get image path from dockerrun file --- lib/gantree/docker.rb | 8 ++++++-- lib/gantree/version.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/gantree/docker.rb b/lib/gantree/docker.rb index 94001e9..a6ac282 100644 --- a/lib/gantree/docker.rb +++ b/lib/gantree/docker.rb @@ -7,11 +7,15 @@ def initialize options check_credentials set_aws_keys @options = options - @image_path = @options[:image_path] - raise "Please provide an image path name in .gantreecfg ex. { 'image_path' : 'bleacher/cms' }" unless @image_path + @image_path = @options[:image_path] || get_image_path @tag = @options[:tag] ||= tag @base_image_tag = @options[:base_image_tag] end + + def get_image_path + dockerrun = JSON.parse(IO.read("Dockerrun.aws.json")) + image = docker["Image"]["Name"] + end def pull puts "Pulling Image First..." diff --git a/lib/gantree/version.rb b/lib/gantree/version.rb index 8a85cb9..720a226 100644 --- a/lib/gantree/version.rb +++ b/lib/gantree/version.rb @@ -1,3 +1,3 @@ module Gantree - VERSION = "0.6.0" + VERSION = "0.6.1" end From 4e7e609a3a3e2426410c0da0746247967c61cd82 Mon Sep 17 00:00:00 2001 From: Felix Rodriguez Date: Thu, 11 Jun 2015 11:42:35 -0700 Subject: [PATCH 2/3] remove tag from image path --- lib/gantree/docker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gantree/docker.rb b/lib/gantree/docker.rb index a6ac282..ac30db2 100644 --- a/lib/gantree/docker.rb +++ b/lib/gantree/docker.rb @@ -14,7 +14,7 @@ def initialize options def get_image_path dockerrun = JSON.parse(IO.read("Dockerrun.aws.json")) - image = docker["Image"]["Name"] + image = dockerrun["Image"]["Name"].gsub!(/:(.*)$/, "") end def pull From 7a3531b222a6ea38d2f7d301368b3fececdd27f9 Mon Sep 17 00:00:00 2001 From: Felix Rodriguez Date: Thu, 11 Jun 2015 12:08:55 -0700 Subject: [PATCH 3/3] tested and working --- lib/gantree/docker.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/gantree/docker.rb b/lib/gantree/docker.rb index ac30db2..3737df0 100644 --- a/lib/gantree/docker.rb +++ b/lib/gantree/docker.rb @@ -7,14 +7,18 @@ def initialize options check_credentials set_aws_keys @options = options - @image_path = @options[:image_path] || get_image_path + @image_path = @options[:image_path] + @image_path||= get_image_path @tag = @options[:tag] ||= tag @base_image_tag = @options[:base_image_tag] end def get_image_path dockerrun = JSON.parse(IO.read("Dockerrun.aws.json")) - image = dockerrun["Image"]["Name"].gsub!(/:(.*)$/, "") + image = dockerrun["Image"]["Name"] + image.gsub!(/:(.*)$/, "") if image.include? ":" + puts "Image Path: #{image}".light_blue + image end def pull