Skip to content

Commit

Permalink
Merge pull request #396 from bjfish/guard-rubocop-in-rakefile
Browse files Browse the repository at this point in the history
Prevent Rakefile from loading rubocop when dependency is not present
  • Loading branch information
JonRowe committed Jan 10, 2020
2 parents 596198a + e31aa34 commit b83b4ce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Rakefile
Expand Up @@ -23,8 +23,12 @@ end

task :build => :verify_private_key_present

require 'rubocop/rake_task'
desc 'Run RuboCop on the lib directory'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb']
begin
require 'rubocop/rake_task'
desc 'Run RuboCop on the lib directory'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib/**/*.rb']
end
rescue LoadError
# No rubocop means no rubocop rake task
end

0 comments on commit b83b4ce

Please sign in to comment.