Skip to content

Commit

Permalink
Merge pull request #37 from jyaworski/add_extra_gem_capability
Browse files Browse the repository at this point in the history
Add the capability to add extra gems to the module gemfile
  • Loading branch information
igalic committed Nov 11, 2015
2 parents c258acb + 2e80e18 commit 4355bf9
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 27 deletions.
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

0 comments on commit 4355bf9

Please sign in to comment.