2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-04-25 02:17:43 -05:00
|
|
|
# I like guard, don't get me wrong, but it is just not working right
|
|
|
|
# architectually it can not do what I want it to do, this is how I want
|
|
|
|
# it to behave
|
|
|
|
|
|
|
|
desc "Run all specs automatically as needed"
|
|
|
|
task "autospec" => :environment do
|
2013-11-01 17:57:50 -05:00
|
|
|
require 'autospec/manager'
|
2013-05-13 03:04:03 -05:00
|
|
|
|
2017-07-27 20:20:09 -05:00
|
|
|
debug = ARGV.any? { |a| a == "d" || a == "debug" } || ENV["DEBUG"]
|
2013-11-05 04:01:17 -06:00
|
|
|
force_polling = ARGV.any? { |a| a == "p" || a == "polling" }
|
|
|
|
latency = ((ARGV.find { |a| a =~ /l=|latency=/ } || "").split("=")[1] || 3).to_i
|
2013-04-30 19:29:39 -05:00
|
|
|
|
|
|
|
if force_polling
|
2013-11-01 17:57:50 -05:00
|
|
|
puts "Polling has been forced (slower) - checking every #{latency} #{"second".pluralize(latency)}"
|
|
|
|
else
|
|
|
|
puts "If file watching is not working, you can force polling with: bundle exec rake autospec p l=3"
|
2013-04-30 19:29:39 -05:00
|
|
|
end
|
|
|
|
|
2013-11-05 04:01:17 -06:00
|
|
|
puts "@@@@@@@@@@@@ Running in debug mode" if debug
|
2013-11-01 17:57:50 -05:00
|
|
|
|
2013-11-05 04:01:17 -06:00
|
|
|
Autospec::Manager.run(force_polling: force_polling, latency: latency, debug: debug)
|
2013-04-25 02:17:43 -05:00
|
|
|
end
|