Permalink
Browse files

deps: conditionally load rubocop on ruby 2.1+

  • Loading branch information...
stevenosloan committed Nov 23, 2017
1 parent d656b23 commit ffa212e8569441b5073e193093e21e44ef8e5b6e
Showing with 12 additions and 6 deletions.
  1. +1 −1 Gemfile
  2. +11 −5 Rakefile
@@ -17,7 +17,7 @@ end
group :test do
gem "rake", "~> 12.0"
gem "rspec", "~> 3.5.0"
gem "rubocop", "~> 0.51", require: false
gem "rubocop", "~> 0.51", require: false if RUBY_VERSION >= "2.1"

gem "string-scrub" if RUBY_VERSION <= "1.9.3"
end
@@ -1,10 +1,16 @@
# frozen_string_literal: true

require "rubocop/rake_task"
require "rspec/core/rake_task"

rubocop = RuboCop::RakeTask.new
rubocop.fail_on_error = false
RSpec::Core::RakeTask.new(:spec)

task default: %i[rubocop spec]
begin
require "rubocop/rake_task"
rubocop = RuboCop::RakeTask.new
rubocop.fail_on_error = false
rescue LoadError
task :rubocop do
puts "Rubocop not loaded"
end
end

task default: %i[spec rubocop]

0 comments on commit ffa212e

Please sign in to comment.