summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff McCune <jeff@puppetlabs.com>2013-08-29 12:59:44 -0700
committerJeff McCune <jeff@puppetlabs.com>2013-08-29 13:02:31 -0700
commit10575587f42fcd84284e0ba85a6c656a37870aa8 (patch)
tree72108a645dbd95ad3216c2be73652e4c761e481c
parent6dd6d060df57362733ed8210bbf56f38372d1f5e (diff)
(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.
-rw-r--r--Gemfile2
1 files changed, 1 insertions, 1 deletions
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 }]