Class: MavenWatchr
- Inherits:
-
Object
- Object
- MavenWatchr
- Defined in:
- lib/maven_watchr.rb
Instance Attribute Summary collapse
-
#stop_after_next ⇒ Object
Returns the value of attribute stop_after_next.
Instance Method Summary collapse
- #go_local_dir ⇒ Object
-
#initialize(command_to_run) ⇒ MavenWatchr
constructor
Note that this command will receive a single classname, like App from App.java, appended to it, when it’s used.
Constructor Details
#initialize(command_to_run) ⇒ MavenWatchr
Note that this command will receive a single classname, like App from App.java, appended to it, when it’s used
17 18 19 |
# File 'lib/maven_watchr.rb', line 17 def initialize command_to_run @command_to_run = command_to_run end |
Instance Attribute Details
#stop_after_next ⇒ Object
Returns the value of attribute stop_after_next.
11 12 13 |
# File 'lib/maven_watchr.rb', line 11 def stop_after_next @stop_after_next end |
Instance Method Details
#go_local_dir ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/maven_watchr.rb', line 21 def go_local_dir script = Watchr::Script.new script.watch('.*/(.*)\.java') do |changed_file| success = true if changed_file[1] =~ /Test$/ if @command_to_run command = @command_to_run + changed_file[1] puts command success = system(command) end else if @command_to_run && Dir['**/' + changed_file[1] + 'Test*'].length > 0 # ltodo test this > 0 command = @command_to_run + changed_file[1] + 'Test' puts command success = system(command) end end if OS.windows? && !success Snarl.new 'failed:' + command if defined?(Snarl) end puts 'done' raise 'done' if stop_after_next end contrl = Watchr::Controller.new(script, Watchr.handler.new) contrl.run Watchr::Controller.new(script, Watchr.handler.new).run end |