Update Gemfile and modernize Rakefile

This commit is contained in:
Cedric DEFORTIS 2017-04-27 10:10:42 +02:00
parent 3b97ec6626
commit d85effdf41
2 changed files with 52 additions and 21 deletions

15
Gemfile
View File

@ -1,14 +1,15 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :test do
gem "rake", '< 11.0'
gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0'
gem "rspec", '<= 3.1.0'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 4.9']
gem "rake"
gem "puppet", puppetversion
gem "rspec", '> 3.4.0'
gem "rspec-puppet"
gem "puppetlabs_spec_helper"
gem "metadata-json-lint"
gem "rspec-puppet-facts"
gem 'rubocop', '0.33.0'
gem 'rubocop', '0.42.0'
gem 'simplecov', '>= 0.11.0'
gem 'simplecov-console'
@ -24,10 +25,12 @@ group :test do
end
group :development do
gem "travis" if RUBY_VERSION >= '2.1.0'
gem "travis-lint" if RUBY_VERSION >= '2.1.0'
gem "travis" if RUBY_VERSION >= '2.1.0'
gem "travis-lint" if RUBY_VERSION >= '2.1.0'
gem "puppet-blacksmith"
gem "guard-rake" if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep
gem 'yard'
gem 'puppet-strings'
end
group :system_tests do

View File

@ -1,40 +1,68 @@
require 'rubygems'
require 'bundler/setup'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet/version'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'metadata-json-lint/rake_task'
require 'rubocop/rake_task'
if Puppet.version.to_f >= 4.9
require 'semantic_puppet'
elsif Puppet.version.to_f >= 3.6 && Puppet.version.to_f < 4.9
require 'puppet/vendor/semantic/lib/semantic'
end
# These gems aren't always present, for instance
# on Travis with --without development
begin
require 'puppet_blacksmith/rake_tasks'
rescue LoadError # rubocop:disable Lint/HandleExceptions
end
#RuboCop::RakeTask.new
exclude_paths = [
'bundle/**/*',
'pkg/**/*',
'vendor/**/*',
'spec/**/*'
"bundle/**/*",
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
# Coverage from puppetlabs-spec-helper requires rcov which
# doesn't work in anything since 1.8.7
#Rake::Task[:coverage].clear
Rake::Task[:lint].clear
PuppetLint.configuration.relative = true
PuppetLint.configuration.disable_80chars
PuppetLint.configuration.disable_class_inherits_from_params_class
PuppetLint.configuration.disable_class_parameter_defaults
PuppetLint.configuration.fail_on_warnings = true
PuppetLint::RakeTask.new :lint do |config|
config.fail_on_warnings = true
config.ignore_paths = exclude_paths
config.disable_checks = [
'80chars',
'class_parameter_defaults',
'documentation',
'autoloader_layout'
]
end
PuppetSyntax.exclude_paths = exclude_paths
desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end
task :metadata do
sh 'metadata-json-lint metadata.json'
desc "Populate CONTRIBUTORS file"
task :contributors do
system("git log --format='%aN' | sort -u > CONTRIBUTORS")
end
desc 'Run syntax, lint, and spec tests.'
desc "Run syntax, lint, and spec tests."
task :test => [
:metadata_lint,
:syntax,
:lint,
:rubocop,
:spec,
:metadata
]