From 4839f418091becf145d699507fe6fa33cf197125 Mon Sep 17 00:00:00 2001 From: Marc CARRE Date: Wed, 26 Oct 2016 12:23:58 +0100 Subject: [PATCH] Improve resolution of Dockerfile since used in both Vagrantfile and test/Vagrantfile. --- vagrant-common.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vagrant-common.rb b/vagrant-common.rb index 9c0c6b5b..125abeea 100644 --- a/vagrant-common.rb +++ b/vagrant-common.rb @@ -1,5 +1,6 @@ $go_regexp = /FROM golang:(\S*).*?/ -$go_version = File.readlines("build/Dockerfile").first { |line| line.match($go_regexp) }.match($go_regexp).captures.first +$dockerfile_path = File.expand_path(File.join(File.dirname(__FILE__), 'build', 'Dockerfile')) +$go_version = File.readlines($dockerfile_path).first { |line| line.match($go_regexp) }.match($go_regexp).captures.first if $go_version.nil? raise ArgumentError.new("Failed to read Go version from Dockerfile.") end