Rakefile in sidekiq-throttled-0.6.6 vs Rakefile in sidekiq-throttled-0.6.7

- old
+ new

@@ -2,9 +2,25 @@ require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) -require "rubocop/rake_task" -RuboCop::RakeTask.new +desc "Run RuboCop" +task :rubocop do + require "rubocop" + result = RuboCop::CLI.new.run([]) + abort("RuboCop failed!") if result.nonzero? +end -task :default => [:spec, :rubocop] +namespace :rubocop do + desc "Auto-correct RuboCop offenses" + task :autocorrect do + require "rubocop" + result = RuboCop::CLI.new.run(["--auto-correct"]) + abort("RuboCop failed!") if result.nonzero? + end +end + +default_suite = ENV["CI"] ? :spec : %i(spec rubocop) +named_suites = { "rubocop" => :rubocop, "rspec" => :spec } + +task :default => named_suites.fetch(ENV["SUITE"], default_suite)