From 00a213413d9f705b66ed55ac1f4e1d60d6a6f74c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Jul 2016 14:21:05 +0200 Subject: [PATCH 1/6] use official blacksmith releases we recently did a release, we don't need to pull it from git anymore. --- config_defaults.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/config_defaults.yml b/config_defaults.yml index be0bd1fa..105f4299 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -34,7 +34,6 @@ 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 From a208c4731ddbe523b0c861becfc575677dd83ce0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Jul 2016 14:59:39 +0200 Subject: [PATCH 2/6] add support for RUBY_VERSION in Gemfile now we can set RUBY_VERSION and the needed operator. We're very smart in naming things so the two new options are: ruby-operator and ruby-version. We need that to pin certain gems only on certain damn legacy platforms --- moduleroot/Gemfile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/moduleroot/Gemfile b/moduleroot/Gemfile index f158b60c..f3061231 100644 --- a/moduleroot/Gemfile +++ b/moduleroot/Gemfile @@ -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'] -%> @@ -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 From bcf11401ab8106cc98da276432212f8f3ef93910 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Jul 2016 15:01:17 +0200 Subject: [PATCH 3/6] install rubocop-rspec only on ruby2 and later --- config_defaults.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config_defaults.yml b/config_defaults.yml index 105f4299..4d22e3bd 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -40,6 +40,8 @@ Gemfile: git: https://github.com/puppetlabs/puppetlabs-strings.git - gem: rubocop-rspec version: '~> 1.5' + ruby-operator: '>=' + ruby-version: '2.0.0' ':development': - gem: travis - gem: travis-lint From a6e331747b496f15e6a53c2ffe6783c422e40601 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Jul 2016 15:02:48 +0200 Subject: [PATCH 4/6] install legacy json_pure on legacy ruby --- config_defaults.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config_defaults.yml b/config_defaults.yml index 4d22e3bd..f7ac8fac 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -42,6 +42,10 @@ Gemfile: 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 From 7e2f95dd8f65c2ccc33a316c93b7107c0716313e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Jul 2016 15:04:47 +0200 Subject: [PATCH 5/6] only include rubocop when we need it --- moduleroot/Rakefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/moduleroot/Rakefile b/moduleroot/Rakefile index 979cb8ae..40bb83f9 100644 --- a/moduleroot/Rakefile +++ b/moduleroot/Rakefile @@ -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}' From c3d7db4967c3a93e7250147c022e1c8313765607 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Jul 2016 15:52:07 +0200 Subject: [PATCH 6/6] make condition more readable --- moduleroot/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moduleroot/Gemfile b/moduleroot/Gemfile index f3061231..ddcb81fe 100644 --- a/moduleroot/Gemfile +++ b/moduleroot/Gemfile @@ -44,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'] %><%= " if RUBY_VERSION #{gem['ruby-operator']} #{gem['ruby-version']}" if gem['ruby-operator'] && gem['ruby-version'] %> + 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