Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the capability to add extra gems to the module gemfile #37

Merged
merged 1 commit into from
Nov 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions config_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
...
82 changes: 55 additions & 27 deletions moduleroot/Gemfile
Original file line number Diff line number Diff line change
@@ -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