From 6250573af86f493d3541b3a275f2992e724ae660 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Tue, 12 Sep 2017 15:35:14 +0200 Subject: [PATCH] Prepare rakefile for the next episode --- Rakefile | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index d433a1e..37fe42a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,28 @@ require "bundler/gem_tasks" require "rake/testtask" +require 'rubocop/rake_task' -Rake::TestTask.new(:test) do |t| - t.libs << "test" - t.libs << "lib" - t.test_files = FileList["test/**/*_test.rb"] +# Add additional test suite definitions to the default test task here +namespace :spec do + desc 'Runs RuboCop on specified directories' + RuboCop::RakeTask.new(:rubocop) do |task| + # Dirs: app, lib, test + task.patterns = ['exe/**/*.rb', 'lib/**/*.rb', 'spec/**/*_spec.rb'] + + # Make it easier to disable cops. + task.options << "--display-cop-names" + + # Abort on failures (fix your code first) + task.fail_on_error = true + end end -task :default => :test +Rake::TestTask.new(:spec) do |t| + t.libs << "spec" + t.libs << "lib" + t.test_files = FileList['spec/**/*_spec.rb'] +end + +# Rake::Task[:spec].enhance ['spec:rubocop'] + +task :default => :spec