diff --git a/config_defaults.yml b/config_defaults.yml index 0b1843eb..cd78b3df 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -12,3 +12,36 @@ env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.6 env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" +Gemfile: + required: + ':test': + - gem: rake + - gem: rspec-puppet + git: https://github.com/rodjek/rspec-puppet.git + - gem: puppetlabs_spec_helper + - gem: metadata-json-lint + - gem: rspec-puppet-facts + - gem: rspec + - gem: puppet-blacksmith + - gem: rubocop + - gem: rspec-puppet-utils + - gem: puppet + version: ENV['PUPPET_VERSION'] || '~> 3.8.0' + - gem: rspec-puppet-augeas + - gem: ruby-augeas + - gem: puppetlabs_spec_helper + - gem: puppet-lint-absolute_classname-check + - gem: puppet-lint-leading_zero-check + - gem: puppet-lint-trailing_comma-check + - gem: puppet-lint-version_comparison-check + - gem: puppet-lint-classes_and_types_beginning_with_digits-check + - gem: puppet-lint-unquoted_string-check + - gem: puppet-lint-variable_contains_upcase + ':development': + - gem: travis + - gem: travis-lint + - gem: guard-rake + ':system_tests': + - gem: beaker + - gem: beaker-rspec +... diff --git a/moduleroot/Gemfile b/moduleroot/Gemfile index eb947bf7..21740a74 100644 --- a/moduleroot/Gemfile +++ b/moduleroot/Gemfile @@ -1,33 +1,61 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || 'https://rubygems.org' -group :test do - gem 'rake' - gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.8.0' - gem 'rspec-puppet', git: 'https://github.com/rodjek/rspec-puppet.git' - gem 'rspec-puppet-augeas' - gem 'ruby-augeas' - gem 'puppetlabs_spec_helper' - gem 'metadata-json-lint' - gem 'rspec-puppet-facts' - gem 'rspec' - gem 'puppet-blacksmith' - gem 'rubocop' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-trailing_comma-check' - gem 'puppet-lint-version_comparison-check' - gem 'puppet-lint-classes_and_types_beginning_with_digits-check' - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-variable_contains_upcase' +def location_for(place, fake_version = nil) + if place =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end end -group :development do - gem 'travis' - gem 'travis-lint' - gem 'guard-rake' +<% groups = {} -%> +<% (@configs['required'].keys + ((@configs['optional'] || {}).keys)).uniq.each do |key| -%> +<% groups[key] = (@configs['required'][key] || []) + ((@configs['optional'] || {})[key] || []) -%> +<% end -%> +<% -%> +<% groups.each do |group, gems| -%> +group <%= group %> do +<% maxlen = gems.map! do |gem| -%> +<% { -%> +<% 'gem' => gem['gem'], -%> +<% 'version' => gem['version'], -%> +<% 'git' => gem['git'], -%> +<% 'branch' => gem['branch'], -%> +<% 'length' => gem['gem'].length + (("', '".length if gem['version']) || 0) + gem['version'].to_s.length -%> +<% } -%> +<% end.map do |gem| -%> +<% gem['length'] -%> +<% end.max -%> +<% gems.each do |gem| -%> +<% if gem['gem'] == 'beaker-rspec' -%> + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + end + if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end +<% else -%> + gem '<%= gem['gem'] %>'<%= ", '#{gem['version']}'" if gem['version'] %>, <%= ' ' * (maxlen - gem['length']) %> :require => false<%= ", :git => '#{gem['git']}'" if gem['git'] %><%= ", :branch => '#{gem['branch']}'" if gem['branch'] %> +<% end -%> +<% end -%> end -group :system_tests do - gem 'beaker' - gem 'beaker-rspec' +<% end -%> + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', 3.8.0, :require => false end + +# vim:ft=ruby