mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-25 17:48:41 -05:00
Previously in commit 145ecb443f Rakefile was modified to require the Rubocop
gem however, this gem is not available on jruby systems and would throw errors.
This commit modifies the Rakefile to first detect if the Gem is available and
optionally load the rubocop rake tasks.
25 lines
666 B
Ruby
25 lines
666 B
Ruby
require 'rspec/core/rake_task'
|
|
|
|
rubocop_available = Gem::Specification::find_all_by_name('rubocop').any?
|
|
require 'rubocop/rake_task' if rubocop_available
|
|
|
|
desc 'Run rspec tests with coloring.'
|
|
RSpec::Core::RakeTask.new(:test) do |t|
|
|
t.rspec_opts = %w[--color --format documentation]
|
|
t.pattern = 'spec/'
|
|
end
|
|
|
|
desc 'Run rspec tests and save JUnit output to results.xml.'
|
|
RSpec::Core::RakeTask.new(:junit) do |t|
|
|
t.rspec_opts = %w[-r yarjuf -f JUnit -o results.xml]
|
|
t.pattern = 'spec/'
|
|
end
|
|
|
|
if rubocop_available
|
|
desc 'Run RuboCop'
|
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
|
task.options << '--display-cop-names'
|
|
end
|
|
end
|
|
|
|
task :default => [:test]
|