Merge pull request #187 from glennsarti/fix-rakefile-for-ruby

(maint) Only load rubocop rake tasks if gem is available
This commit is contained in:
Rob Braden 2017-02-28 15:12:46 -08:00 committed by GitHub
commit dbd16ebc8c

View file

@ -1,5 +1,7 @@
require 'rspec/core/rake_task'
require 'rubocop/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|
@ -13,9 +15,11 @@ RSpec::Core::RakeTask.new(:junit) do |t|
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]