lib/puppet-check/tasks.rb in puppet-check-2.2.0 vs lib/puppet-check/tasks.rb in puppet-check-2.2.1
- old
+ new
@@ -4,19 +4,21 @@
raise 'Rake is not installed and you are attempting to execute Rake tasks with Puppet Check. Please install Rake before continuing.'
end
require_relative '../puppet_check'
# the rake interface for PuppetCheck
-class PuppetCheck::Tasks < ::Rake::TaskLib
+class PuppetCheck::Tasks < Rake::TaskLib
def initialize
+ super
+
desc 'Execute all Puppet-Check checks'
task puppetcheck: %w[puppetcheck:file puppetcheck:spec puppetcheck:beaker puppetcheck:kitchen]
namespace :puppetcheck do
desc 'Execute Puppet-Check file checks'
- task :file do
- PuppetCheck.new.run(PuppetCheck.settings, Dir.glob('*'))
+ task :file, [:settings] do |_, wrapped_settings|
+ PuppetCheck.new.run(wrapped_settings[:settings], Dir.glob('*'))
end
# rspec and rspec-puppet tasks
begin
require 'rspec/core/rake_task'
@@ -24,12 +26,11 @@
desc 'Execute RSpec and RSpec-Puppet tests'
RSpec::Core::RakeTask.new(:spec) do |task|
RSpecPuppetSupport.run
# generate tasks for all recognized directories and ensure spec tests inside module dependencies are ignored
- spec_dirs = Dir.glob('**/{classes,defines,facter,functions,hosts,puppet,unit,types}/**/*_spec.rb').reject { |dir| dir =~ /fixtures/ }
+ spec_dirs = Dir.glob('**/{classes,defines,facter,functions,hosts,puppet,unit,types}/**/*_spec.rb').grep_v(/fixtures/)
task.pattern = spec_dirs.empty? ? 'skip_rspec' : spec_dirs
- task.rspec_opts = '-f json' if PuppetCheck.settings[:output_format] == 'json'
end
rescue LoadError
desc 'RSpec is not installed.'
task :spec do
puts 'RSpec is not installed. The RSpec/RSpec-Puppet tasks will not be available.'