Class: Tripwire::Runner
- Inherits:
-
Object
- Object
- Tripwire::Runner
- Defined in:
- lib/tripwire/runner.rb
Constant Summary collapse
- GEM_PATH =
File.(File.join(File.dirname(__FILE__), '..', '..'))
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#interrupted ⇒ Object
Returns the value of attribute interrupted.
-
#scanner ⇒ Object
Returns the value of attribute scanner.
Instance Method Summary collapse
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/tripwire/runner.rb', line 7 def command @command end |
#delay ⇒ Object
Returns the value of attribute delay.
8 9 10 |
# File 'lib/tripwire/runner.rb', line 8 def delay @delay end |
#interrupted ⇒ Object
Returns the value of attribute interrupted.
10 11 12 |
# File 'lib/tripwire/runner.rb', line 10 def interrupted @interrupted end |
#scanner ⇒ Object
Returns the value of attribute scanner.
6 7 8 |
# File 'lib/tripwire/runner.rb', line 6 def scanner @scanner end |
Instance Method Details
#run! ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tripwire/runner.rb', line 12 def run! raise "No command specified. Please specify a command to run." if !command raise "No files/folders specified. Please specify files/patterns to scan." if scanner.scan_patterns.empty? original_quiet = scanner.quiet scanner.quiet = true scanner.scan # do this because we don't care about the initial updates collection scanner.quiet = original_quiet add_sigint_handler loop do begin `cd '#{Dir.pwd}'; #{File.join(GEM_PATH, 'bin', 'fsevent_sleep')} . 2>&1` rescue sleep delay end system(command) unless scanner.scan.empty? end end |