Class: Jstdutil::Autotest
- Inherits:
-
Object
- Object
- Jstdutil::Autotest
- Includes:
- Hooks
- Defined in:
- lib/jstdutil/autotest.rb
Constant Summary collapse
- AVAILABLE_HOOKS =
[:initialize, :died, :quit, :ran_command, :run_command, :waiting]
Instance Attribute Summary collapse
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(args) ⇒ Autotest
constructor
A new instance of Autotest.
- #run ⇒ Object
Methods included from Hooks
Constructor Details
#initialize(args) ⇒ Autotest
Returns a new instance of Autotest.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jstdutil/autotest.rb', line 11 def initialize(args) absolute_path = Pathname(File.join(Jstdutil.install_dir, "watchr_script")) script = Watchr::Script.new(absolute_path) @watchr_controller = Watchr::Controller.new(script, Watchr.handler.new) @runner = Jstdutil::TestRunner.new(args) $jstestdriver_test_runner = @runner @interrupted_at = nil rescue StandardError => err raise err end |
Instance Attribute Details
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
7 8 9 |
# File 'lib/jstdutil/autotest.rb', line 7 def runner @runner end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jstdutil/autotest.rb', line 22 def run hook(:initialize) trap("INT") do if @interrupted_at && Time.now - @interrupted_at < 2 puts "No more testing today, shutting down" @runner.finalize exit else @interrupted_at = Time.now puts "Running all tests, hit Ctrl-c again to exit" @runner.run end end @watchr_controller.run end |