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 RUBY_VERSION feature + pin json_pure/rspec-rubocop #200

Merged
merged 6 commits into from
Jul 29, 2016
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
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 -%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's going on here?
(also, monads would be pretty sweet now…)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we make dark black magic to determine the indentation in the Gemfile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what i'm saying we should have a function for

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created #201 for this

<% } -%>
<% 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