(MODULES-3704) Update gemfile template to be identical

This commit is contained in:
Hunter Haugen
2016-11-09 12:01:49 -08:00
parent b94fb4a044
commit cf077aa16e

103
Gemfile
View File

@@ -2,50 +2,83 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org" source ENV['GEM_SOURCE'] || "https://rubygems.org"
def location_from_env(env, default_location = []) # Determines what type of gem is requested based on place_or_version.
if location = ENV[env] def gem_type(place_or_version)
if location =~ /^((?:git|https?)[:@][^#]*)#(.*)/ if place_or_version =~ /^git:/
[{ :git => $1, :branch => $2, :require => false }] :git
elsif location =~ /^file:\/\/(.*)/ elsif place_or_version =~ /^file:/
['>= 0', { :path => File.expand_path($1), :require => false }] :file
else
[location, { :require => false }]
end
else else
default_location :gem
end end
end end
group :development, :unit_tests do # Find a location or specific version for a gem. place_or_version can be a
gem 'metadata-json-lint' # version, which is most often used. It can also be git, which is specified as
gem 'puppet_facts' # `git://somewhere.git#branch`. You can also use a file source location, which
gem 'puppet-blacksmith', '>= 3.4.0' # is specified as `file://some/location/on/disk`.
gem 'puppetlabs_spec_helper', '>= 1.2.1' def location_for(place_or_version, fake_version = nil)
gem 'rspec-puppet', '>= 2.3.2' if place_or_version =~ /^(git[:@][^#]*)#(.*)/
gem 'rspec-puppet-facts' [fake_version, { :git => $1, :branch => $2, :require => false }].compact
gem 'mocha', '< 1.2.0' elsif place_or_version =~ /^file:\/\/(.*)/
gem 'simplecov' ['>= 0', { :path => File.expand_path($1), :require => false }]
gem 'parallel_tests', '< 2.10.0' if RUBY_VERSION < '2.0.0' else
gem 'parallel_tests' if RUBY_VERSION >= '2.0.0' [place_or_version, { :require => false }]
gem 'rubocop', '0.41.2' if RUBY_VERSION < '2.0.0' end
gem 'rubocop' if RUBY_VERSION >= '2.0.0'
gem 'rubocop-rspec', '~> 1.6' if RUBY_VERSION >= '2.3.0'
gem 'json_pure', '<= 2.0.1' if RUBY_VERSION < '2.0.0'
end end
# Used for gem conditionals
supports_windows = false
group :development do
gem 'puppet-lint', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet_facts', :require => false
gem 'puppet-blacksmith', '>= 3.4.0', :require => false, :platforms => 'ruby'
gem 'puppetlabs_spec_helper', '>= 1.2.1', :require => false
gem 'rspec-puppet', '>= 2.3.2', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'mocha', '< 1.2.0', :require => false
gem 'simplecov', :require => false
gem 'parallel_tests', '< 2.10.0', :require => false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
gem 'parallel_tests', :require => false if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0.0')
gem 'rubocop', '0.41.2', :require => false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
gem 'rubocop', :require => false if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.0.0')
gem 'rubocop-rspec', '~> 1.6', :require => false if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0')
gem 'pry', :require => false
gem 'json_pure', '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
end
group :system_tests do group :system_tests do
gem 'beaker', *location_from_env('BEAKER_VERSION', []) if RUBY_VERSION >= '2.3.0' gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 2.20') if supports_windows
gem 'beaker', *location_from_env('BEAKER_VERSION', ['< 3']) if RUBY_VERSION < '2.3.0' gem 'beaker', *location_for(ENV['BEAKER_VERSION']) if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0') and ! supports_windows
gem 'beaker-pe' if RUBY_VERSION >= '2.3.0' gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '< 3') if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') and ! supports_windows
gem 'beaker-rspec', *location_from_env('BEAKER_RSPEC_VERSION', ['>= 3.4']) gem 'beaker-pe', :require => false if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.3.0')
gem 'serverspec' gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4') if ! supports_windows
gem 'beaker-puppet_install_helper' gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '~> 5.1') if supports_windows
gem 'master_manipulator' gem 'beaker-puppet_install_helper', :require => false
gem 'beaker-hostgenerator', *location_from_env('BEAKER_HOSTGENERATOR_VERSION', []) gem 'master_manipulator', :require => false
gem 'beaker-hostgenerator', *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
end end
gem 'facter', *location_from_env('FACTER_GEM_VERSION') gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])
gem 'puppet', *location_from_env('PUPPET_GEM_VERSION')
# Only explicitly specify Facter/Hiera if a version has been specified.
# Otherwise it can lead to strange bundler behavior. If you are seeing weird
# gem resolution behavior, try setting `DEBUG_RESOLVER` environment variable
# to `1` and then run bundle install.
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION']) if ENV['FACTER_GEM_VERSION']
gem 'hiera', *location_for(ENV['HIERA_GEM_VERSION']) if ENV['HIERA_GEM_VERSION']
# Evaluate Gemfile.local if it exists
if File.exists? "#{__FILE__}.local" if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding) eval(File.read("#{__FILE__}.local"), binding)
end end
# Evaluate ~/.gemfile if it exists
if File.exists?(File.join(Dir.home, '.gemfile'))
eval(File.read(File.join(Dir.home, '.gemfile')), binding)
end
# vim:ft=ruby