From 10e996782b6745457fd7d74577388922e79ef7e2 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Wed, 1 Mar 2017 13:35:02 +0100 Subject: [PATCH 1/2] - Refactoring for Rakefile to display cucumber task by "rake -T". - Add profile for Ruby 2.2, 2.3 and 2.4. --- Rakefile | 6 ++++-- cucumber.yml | 3 +++ gem_tasks/cucumber.rake | 7 +++++++ lib/cucumber/platform.rb | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index af0d076680..aac6ff15fa 100644 --- a/Rakefile +++ b/Rakefile @@ -9,7 +9,7 @@ Dir['gem_tasks/**/*.rake'].each { |rake| load rake } require 'rubocop/rake_task' RuboCop::RakeTask.new -task :default => [:spec, :rubocop, :cucumber] +default_tasks = [:spec, :rubocop, :cucumber] if ENV['TRAVIS'] ENV['SIMPLECOV'] = 'ci' @@ -18,8 +18,10 @@ if ENV['TRAVIS'] require 'coveralls/rake/task' Coveralls::RakeTask.new - task :default => [:spec, :rubocop, :cucumber, 'coveralls:push'] + default_tasks << 'coveralls:push' end +task :default => default_tasks + require 'rake/clean' CLEAN.include %w(**/*.{log,pyc,rbc,tgz} doc) diff --git a/cucumber.yml b/cucumber.yml index bab8059171..4df4292634 100644 --- a/cucumber.yml +++ b/cucumber.yml @@ -16,6 +16,9 @@ windows_mri: <%= std_opts %> --tags 'not @jruby and not @wire and not @needs-man ruby_1_9: <%= std_opts %> --tags 'not @jruby' ruby_2_0: <%= std_opts %> --tags 'not @jruby' ruby_2_1: <%= std_opts %> --tags 'not @jruby' +ruby_2_2: <%= std_opts %> --tags 'not @jruby' +ruby_2_3: <%= std_opts %> --tags 'not @jruby' +ruby_2_4: <%= std_opts %> --tags 'not @jruby' wip: --wip <%= wip_opts %> features <%= cucumber_pro_opts %> none: --format pretty --format Cucumber::Pro --out /dev/null rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip-new-core' <%= cucumber_pro_opts %> diff --git a/gem_tasks/cucumber.rake b/gem_tasks/cucumber.rake index 599b7373d4..346816b884 100644 --- a/gem_tasks/cucumber.rake +++ b/gem_tasks/cucumber.rake @@ -14,6 +14,12 @@ class Cucumber::Rake::Task 'ruby_2_0' elsif Cucumber::RUBY_2_1 'ruby_2_1' + elsif Cucumber::RUBY_2_2 + 'ruby_2_2' + elsif Cucumber::RUBY_2_3 + 'ruby_2_3' + elsif Cucumber::RUBY_2_4 + 'ruby_2_4' end end end @@ -23,4 +29,5 @@ Cucumber::Rake::Task.new(:features) do |t| t.set_profile_for_current_ruby end +desc 'Run Cucumber features' task :cucumber => :features diff --git a/lib/cucumber/platform.rb b/lib/cucumber/platform.rb index fcfe60b319..a95ef48b0d 100644 --- a/lib/cucumber/platform.rb +++ b/lib/cucumber/platform.rb @@ -11,9 +11,10 @@ module Cucumber LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib') RAILS = defined?(Rails) RUBY_BINARY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) - RUBY_2_2 = RUBY_VERSION =~ /^2\.2/ RUBY_2_1 = RUBY_VERSION =~ /^2\.1/ + RUBY_2_2 = RUBY_VERSION =~ /^2\.2/ RUBY_2_3 = RUBY_VERSION =~ /^2\.3/ + RUBY_2_4 = RUBY_VERSION =~ /^2\.4/ class << self attr_accessor :use_full_backtrace From 05715ccc4373f96d7309a9b673b552892a4b49bf Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Mon, 6 Mar 2017 14:19:17 +0100 Subject: [PATCH 2/2] - Remove gem_tasks/cucumber.rake - Unify ruby_x_y profiles --- Rakefile | 5 +++++ cucumber.yml | 7 +------ gem_tasks/cucumber.rake | 33 --------------------------------- lib/cucumber/platform.rb | 5 +---- 4 files changed, 7 insertions(+), 43 deletions(-) delete mode 100644 gem_tasks/cucumber.rake diff --git a/Rakefile b/Rakefile index aac6ff15fa..15257970ec 100644 --- a/Rakefile +++ b/Rakefile @@ -9,6 +9,11 @@ Dir['gem_tasks/**/*.rake'].each { |rake| load rake } require 'rubocop/rake_task' RuboCop::RakeTask.new +require 'cucumber/rake/task' +Cucumber::Rake::Task.new do |t| + t.profile = 'ruby' if Cucumber::RUBY +end + default_tasks = [:spec, :rubocop, :cucumber] if ENV['TRAVIS'] diff --git a/cucumber.yml b/cucumber.yml index 4df4292634..b5d32778da 100644 --- a/cucumber.yml +++ b/cucumber.yml @@ -13,12 +13,7 @@ default: <%= std_opts %> --tags 'not @jruby' jruby: <%= std_opts %> --tags 'not @wire' jruby_win: <%= std_opts %> --tags 'not @wire' CUCUMBER_FORWARD_SLASH_PATHS=true windows_mri: <%= std_opts %> --tags 'not @jruby and not @wire and not @needs-many-fonts' CUCUMBER_FORWARD_SLASH_PATHS=true -ruby_1_9: <%= std_opts %> --tags 'not @jruby' -ruby_2_0: <%= std_opts %> --tags 'not @jruby' -ruby_2_1: <%= std_opts %> --tags 'not @jruby' -ruby_2_2: <%= std_opts %> --tags 'not @jruby' -ruby_2_3: <%= std_opts %> --tags 'not @jruby' -ruby_2_4: <%= std_opts %> --tags 'not @jruby' +ruby: <%= std_opts %> --tags 'not @jruby' wip: --wip <%= wip_opts %> features <%= cucumber_pro_opts %> none: --format pretty --format Cucumber::Pro --out /dev/null rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip-new-core' <%= cucumber_pro_opts %> diff --git a/gem_tasks/cucumber.rake b/gem_tasks/cucumber.rake deleted file mode 100644 index 346816b884..0000000000 --- a/gem_tasks/cucumber.rake +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true -require 'cucumber/rake/task' -require 'cucumber/platform' - -class Cucumber::Rake::Task - def set_profile_for_current_ruby - self.profile = if Cucumber::JRUBY - Cucumber::WINDOWS ? 'jruby_win' : 'jruby' - elsif Cucumber::WINDOWS_MRI - 'windows_mri' - elsif Cucumber::RUBY_1_9 - 'ruby_1_9' - elsif Cucumber::RUBY_2_0 - 'ruby_2_0' - elsif Cucumber::RUBY_2_1 - 'ruby_2_1' - elsif Cucumber::RUBY_2_2 - 'ruby_2_2' - elsif Cucumber::RUBY_2_3 - 'ruby_2_3' - elsif Cucumber::RUBY_2_4 - 'ruby_2_4' - end - end -end - -Cucumber::Rake::Task.new(:features) do |t| - t.fork = true - t.set_profile_for_current_ruby -end - -desc 'Run Cucumber features' -task :cucumber => :features diff --git a/lib/cucumber/platform.rb b/lib/cucumber/platform.rb index a95ef48b0d..c9f08016de 100644 --- a/lib/cucumber/platform.rb +++ b/lib/cucumber/platform.rb @@ -11,10 +11,7 @@ module Cucumber LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib') RAILS = defined?(Rails) RUBY_BINARY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) - RUBY_2_1 = RUBY_VERSION =~ /^2\.1/ - RUBY_2_2 = RUBY_VERSION =~ /^2\.2/ - RUBY_2_3 = RUBY_VERSION =~ /^2\.3/ - RUBY_2_4 = RUBY_VERSION =~ /^2\.4/ + RUBY = defined? RUBY_VERSION class << self attr_accessor :use_full_backtrace