|
1 |
| -source 'https://rubygems.org' |
2 |
| - |
3 |
| -puppetversion = ENV.key?('PUPPET_GEM_VERSION') ? "#{ENV['PUPPET_GEM_VERSION']}" : ['>= 3.3'] |
4 |
| -facterversion = ENV.key?('FACTER_GEM_VERSION') ? "#{ENV['FACTER_GEM_VERSION']}" : ['>= 1.7'] |
5 |
| -gem 'puppet', puppetversion |
6 |
| -gem 'puppetlabs_spec_helper', '>= 0.1.0' |
7 |
| -gem 'puppet-lint', '>= 0.3.2' |
8 |
| -gem 'facter', facterversion |
9 |
| -gem 'rspec', '< 3.2.0' |
| 1 | +source ENV['GEM_SOURCE'] || "https://rubygems.org" |
| 2 | + |
| 3 | +def location_for(place, version = nil) |
| 4 | + if place =~ /^((?:git|https?)[:@][^#]*)#(.*)/ |
| 5 | + [version, { :git => $1, :branch => $2, :require => false }].compact |
| 6 | + elsif place =~ /^file:\/\/(.*)/ |
| 7 | + ['>= 0', { :path => File.expand_path($1), :require => false }] |
| 8 | + else |
| 9 | + [place, version, { :require => false }].compact |
| 10 | + end |
| 11 | +end |
| 12 | + |
| 13 | +gem 'puppetlabs_spec_helper', '>= 0.1.0', :require => false |
| 14 | +gem 'puppet-lint', '>= 0.3.2', :require => false |
| 15 | +gem 'rspec-puppet', '>= 2.3.2', :require => false |
| 16 | +gem 'rspec-puppet-facts', :require => false |
| 17 | +gem 'metadata-json-lint', :require => false |
10 | 18 | # rubi <1.9 versus rake 11.0.0 workaround
|
11 |
| -gem 'rake', '< 11.0.0' |
| 19 | +gem 'rake', '< 11.0.0', :require => false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0') |
| 20 | +gem 'json', '< 2.0.0', :require => false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0') |
| 21 | +gem 'json_pure', '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0') |
| 22 | + |
| 23 | +gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) |
| 24 | + |
| 25 | +# Only explicitly specify Facter/Hiera if a version has been specified. |
| 26 | +# Otherwise it can lead to strange bundler behavior. If you are seeing weird |
| 27 | +# gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable |
| 28 | +# to `1` and then run bundle install. |
| 29 | +gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION'] |
| 30 | +gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION'] |
| 31 | + |
| 32 | + |
| 33 | +# Evaluate Gemfile.local if it exists |
| 34 | +if File.exists? "#{__FILE__}.local" |
| 35 | + eval(File.read("#{__FILE__}.local"), binding) |
| 36 | +end |
| 37 | + |
| 38 | +# Evaluate ~/.gemfile if it exists |
| 39 | +if File.exists?(File.join(Dir.home, '.gemfile')) |
| 40 | + eval(File.read(File.join(Dir.home, '.gemfile')), binding) |
| 41 | +end |
0 commit comments