11source ENV [ 'GEM_SOURCE' ] || 'https://rubygems.org'
22
33def location_for ( place_or_version , fake_version = nil )
4- if place_or_version =~ %r{\A (git[:@][^#]*)#(.*)}
5- [ fake_version , { git : Regexp . last_match ( 1 ) , branch : Regexp . last_match ( 2 ) , require : false } ] . compact
6- elsif place_or_version =~ %r{\A file:\/ \/ (.*)}
7- [ '>= 0' , { path : File . expand_path ( Regexp . last_match ( 1 ) ) , require : false } ]
8- else
9- [ place_or_version , { require : false } ]
10- end
11- end
4+ git_url_regex = %r{\A (?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5+ file_url_regex = %r{\A file:\/ \/ (?<path>.*)}
126
13- def gem_type ( place_or_version )
14- if place_or_version =~ %r{\A git[:@]}
15- :git
16- elsif !place_or_version . nil? && place_or_version . start_with? ( 'file:' )
17- :file
7+ if place_or_version && ( git_url = place_or_version . match ( git_url_regex ) )
8+ [ fake_version , { git : git_url [ :url ] , branch : git_url [ :branch ] , require : false } ] . compact
9+ elsif place_or_version && ( file_url = place_or_version . match ( file_url_regex ) )
10+ [ '>= 0' , { path : File . expand_path ( file_url [ :path ] ) , require : false } ]
1811 else
19- :gem
12+ [ place_or_version , { require : false } ]
2013 end
2114end
2215
@@ -41,7 +34,6 @@ group :system_tests do
4134end
4235
4336puppet_version = ENV [ 'PUPPET_GEM_VERSION' ]
44- puppet_type = gem_type ( puppet_version )
4537facter_version = ENV [ 'FACTER_GEM_VERSION' ]
4638hiera_version = ENV [ 'HIERA_GEM_VERSION' ]
4739
0 commit comments