begin

require 'cucumber/rake/task'

namespace :cucumber do

  task :ok do
    %x{cucumber --format progress --strict --tags ~@wip features 1>&2}
  end

  task :wip do
    %x{cucumber --format progress --strict --tags @wip:3 --wip features 1>&2}
  end

  task :hudson_format do
    report_path = 'features/reports/'
    rm_rf report_path
    mkdir_p report_path
    %x{cucumber --format junit --out #{report_path}}
  end

  desc 'Run all features'
  task :all => [:ok, :wip]

  task :hudson => [:hudson_format]
end

desc 'Alias for cucumber:ok'
task :cucumber => ['cucumber:ok']

task :default => :cucumber

rescue LoadError

desc 'cucumber rake task not available (cucumber not installed)'
task :cucumber do
  abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
end

end require ‘rake’