X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=Gemfile;h=d85a609aba0e4f493e269cf6155fc318168c0491;hb=7e98f7db3bd79775377439d41dd21ed12d10f105;hp=1aff7a8bcd9a14d6ccd740ffa57a579f092029e3;hpb=d6069a619ce1b30f19014932f81e83f445c846e6;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/Gemfile b/Gemfile index 1aff7a8..d85a609 100644 --- a/Gemfile +++ b/Gemfile @@ -1,22 +1,15 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' def location_for(place_or_version, fake_version = nil) - if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)} - [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact - elsif place_or_version =~ %r{\Afile:\/\/(.*)} - ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] - else - [place_or_version, { require: false }] - end -end + git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} + file_url_regex = %r{\Afile:\/\/(?.*)} -def gem_type(place_or_version) - if place_or_version =~ %r{\Agit[:@]} - :git - elsif !place_or_version.nil? && place_or_version.start_with?('file:') - :file + if place_or_version && (git_url = place_or_version.match(git_url_regex)) + [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) + ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else - :gem + [place_or_version, { require: false }] end end @@ -42,7 +35,6 @@ group :system_tests do end puppet_version = ENV['PUPPET_GEM_VERSION'] -puppet_type = gem_type(puppet_version) facter_version = ENV['FACTER_GEM_VERSION'] hiera_version = ENV['HIERA_GEM_VERSION']