Rakefile in event-bus-0.2.0 vs Rakefile in event-bus-0.2.1

- old
+ new

@@ -1,34 +1,58 @@ #!/usr/bin/env rake +# +require 'bundler' +Bundler.setup namespace :gem do require 'bundler/gem_tasks' end -desc 'Default task' -task default: :test +require 'cucumber/rake/task' -require 'coveralls/rake/task' -Coveralls::RakeTask.new +Cucumber::Rake::Task.new do |t| + t.cucumber_opts = '' + # t.cucumber_opts = "--format Cucumber::Pro --out cucumber-pro.log" if ENV['CUCUMBER_PRO_TOKEN'] + t.cucumber_opts << '--format pretty' +end -desc 'Run test suite' -task test: %w(test:rubocop test:rspec test:cucumber) +Cucumber::Rake::Task.new(:cucumber_wip) do |t| + t.cucumber_opts = '-p wip' +end -namespace :test do - desc 'Test with coveralls' - task coveralls: %w(test coveralls:push) +require 'rspec/core/rake_task' +desc 'Run RSpec' +RSpec::Core::RakeTask.new do |spec| + spec.rspec_opts = ['--color', '--format documentation'] +end - desc 'Run rspec' - task :rspec do - sh 'bundle exec rspec' - end +namespace :travis do + desc 'Lint travis.yml' + task :lint do + begin + require 'travis/yaml' - desc 'Run cucumber' - task :cucumber do - sh 'bundle exec cucumber' + puts 'Linting .travis.yml ... No output is good!' + Travis::Yaml.parse! File.read('.travis.yml') + rescue LoadError + $stderr.puts 'You ruby is not supported for linting the .travis.yml' + end end +end - desc 'Run cucumber' - task :rubocop do - sh 'bundle exec rubocop' +if RUBY_VERSION < '1.9.3' + begin + require 'rubocop/rake_task' + RuboCop::RakeTask.new + rescue LoadError + desc 'Stub task to make rake happy' + task(:rubocop) {} end +else + require 'rubocop/rake_task' + RuboCop::RakeTask.new end + +desc 'Run tests, both RSpec and Cucumber' +task :test => ['travis:lint', :rubocop, :spec, :cucumber, :cucumber_wip] + +task :default => :test