Skip to content

Commit

Permalink
Merge pull request #200 from bastelfreak/testplatform
Browse files Browse the repository at this point in the history
Add RUBY_VERSION feature + pin json_pure/rspec-rubocop
  • Loading branch information
igalic committed Jul 29, 2016
2 parents 7b43bbf + c3d7db4 commit d65a898
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
7 changes: 6 additions & 1 deletion config_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ Gemfile:
- gem: puppet-lint-variable_contains_upcase
- gem: metadata-json-lint
- gem: puppet-blacksmith
git: https://github.com/voxpupuli/puppet-blacksmith.git
- gem: voxpupuli-release
git: https://github.com/voxpupuli/voxpupuli-release-gem.git
- gem: puppet-strings
git: https://github.com/puppetlabs/puppetlabs-strings.git
- gem: rubocop-rspec
version: '~> 1.5'
ruby-operator: '>='
ruby-version: '2.0.0'
- gem: json_pure
version: '<= 2.0.1'
ruby-operator: '<'
ruby-version: '2.0.0'
':development':
- gem: travis
- gem: travis-lint
Expand Down
18 changes: 10 additions & 8 deletions moduleroot/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ group <%= group %> do
<% maxlen = gems.map! do |gem| -%>
<% gem['platforms'].map!{|a| a.to_sym} unless gem['platforms'].nil? -%>
<% { -%>
<% 'gem' => gem['gem'], -%>
<% 'version' => gem['version'], -%>
<% 'platforms' => gem['platforms'], -%>
<% 'require' => gem['require'], -%>
<% 'git' => gem['git'], -%>
<% 'branch' => gem['branch'], -%>
<% 'length' => gem['gem'].length + (("', '".length if gem['version']) || 0) + gem['version'].to_s.length -%>
<% 'gem' => gem['gem'], -%>
<% 'version' => gem['version'], -%>
<% 'platforms' => gem['platforms'], -%>
<% 'require' => gem['require'], -%>
<% 'git' => gem['git'], -%>
<% 'branch' => gem['branch'], -%>
<% 'ruby-version' => gem['ruby-version'], -%>
<% 'ruby-operator' => gem['ruby-operator'], -%>
<% 'length' => gem['gem'].length + (("', '".length if gem['version']) || 0) + gem['version'].to_s.length -%>
<% } -%>
<% end.map do |gem| -%>
<% gem['length'] -%>
Expand All @@ -42,7 +44,7 @@ group <%= group %> do
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'] %><%= ", :platforms => #{gem['platforms']}" if gem['platforms'] %>
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'] %><%= ", :platforms => #{gem['platforms']}" if gem['platforms'] %><%= " if RUBY_VERSION #{gem['ruby-operator']} #{gem['ruby-version']}" if (gem['ruby-operator'] && gem['ruby-version']) %>
<% end -%>
<% end -%>
end
Expand Down
11 changes: 7 additions & 4 deletions moduleroot/Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet_blacksmith/rake_tasks'
require 'voxpupuli/release/rake_tasks'
require 'rubocop/rake_task'
require 'puppet-strings/rake_tasks'

RuboCop::RakeTask.new(:rubocop) do |task|
# These make the rubocop experience maybe slightly less terrible
task.options = ['-D', '-S', '-E']
if RUBY_VERSION >= '2.0.0'
require 'rubocop/rake_task'

RuboCop::RakeTask.new(:rubocop) do |task|
# These make the rubocop experience maybe slightly less terrible
task.options = ['-D', '-S', '-E']
end
end

PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
Expand Down

0 comments on commit d65a898

Please sign in to comment.