]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(maint) Fix location_for helper method
authorJeff McCune <jeff@puppetlabs.com>
Thu, 29 Aug 2013 19:59:44 +0000 (12:59 -0700)
committerJeff McCune <jeff@puppetlabs.com>
Thu, 29 Aug 2013 20:02:31 +0000 (13:02 -0700)
Without this patch the location_for helper method in the Gemfile
incorrectly assumes the mdata variable has a value.  This patch
addresses the problem by explicitly binding the regular expression match
results to the mdata variable to ensure it has a value when accessed by
index.

Gemfile

diff --git a/Gemfile b/Gemfile
index 197cc6b0152777178012b23cbacb9ca63230af18..636f930ad4170f46fa70ddedf7f083dde4211339 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -4,7 +4,7 @@ def location_for(place, fake_version = nil)
   mdata = /^(git:[^#]*)#(.*)/.match(place)
   if mdata
     [fake_version, { :git => mdata[1], :branch => mdata[2], :require => false }].compact
-  elsif place =~ /^file:\/\/(.*)/
+  elsif mdata = /^file:\/\/(.*)/.match(place)
     ['>= 0', { :path => File.expand_path(mdata[1]), :require => false }]
   else
     [place, { :require => false }]