Add Rubocop support to Rakefile

This commit is contained in:
Ryan McKern 2017-03-01 11:51:21 -08:00
parent 573f0d83a9
commit 8babbe32ce

View file

@ -1,6 +1,7 @@
require 'rubygems' require 'rubygems'
require 'bundler/setup' require 'bundler/setup'
require 'rspec/core/rake_task' require 'rspec/core/rake_task'
require 'rubocop/rake_task'
# Immediately sync all stdout so that tools like buildbot can # Immediately sync all stdout so that tools like buildbot can
# immediately load in the output. # immediately load in the output.
@ -8,7 +9,7 @@ $stdout.sync = true
$stderr.sync = true $stderr.sync = true
# Change to the directory of this file. # Change to the directory of this file.
Dir.chdir(File.expand_path("../", __FILE__)) Dir.chdir(File.expand_path('../', __FILE__))
# This installs the tasks that help with gem creation and # This installs the tasks that help with gem creation and
# publishing. # publishing.
@ -16,7 +17,13 @@ Bundler::GemHelper.install_tasks
# Install the `spec` task so that we can run tests. # Install the `spec` task so that we can run tests.
RSpec::Core::RakeTask.new(:spec) do |t| RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--order defined" t.rspec_opts = '--order defined'
end end
desc 'Run RuboCop'
RuboCop::RakeTask.new(:rubocop) do |task|
task.options << '--display-cop-names'
end
# Default task is to run the unit tests # Default task is to run the unit tests
task :default => :spec task default: :spec