From: Jeff McCune Date: Thu, 29 Aug 2013 19:59:44 +0000 (-0700) Subject: (maint) Fix location_for helper method X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=10575587f42fcd84284e0ba85a6c656a37870aa8;p=puppet-stdlib.git (maint) Fix location_for helper method 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. --- diff --git a/Gemfile b/Gemfile index 197cc6b..636f930 100644 --- 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 }]