Class: Guard::Keepgoing

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/keepgoing.rb

Overview

Guard plugin for keepgoing, which will load the file it is given as an option, on start and on modification.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Keepgoing

Returns a new instance of Keepgoing.



9
10
11
12
13
# File 'lib/guard/keepgoing.rb', line 9

def initialize(options = {})
  opts = options.dup
  @runs = 0
  super(opts) # important to call + avoid passing options Guard doesn't understand
end

Instance Attribute Details

#runsObject (readonly)

Returns the value of attribute runs.



7
8
9
# File 'lib/guard/keepgoing.rb', line 7

def runs
  @runs
end

Instance Method Details

#run_allObject



22
23
24
# File 'lib/guard/keepgoing.rb', line 22

def run_all
  do_run
end

#run_on_modifications(_paths) ⇒ Object



26
27
28
29
# File 'lib/guard/keepgoing.rb', line 26

def run_on_modifications(_paths)
  puts "Press Ctrl+C to quit keepgoing. Just edit and save away, you can do this 🎉\n\n" if clear_screen_on_reload?
  do_run
end

#startObject



15
16
17
18
19
20
# File 'lib/guard/keepgoing.rb', line 15

def start
  @runs = 1
  puts "Hi! I'll keepgoing until you press Ctrl+C. Just edit and save away, you can do this 🎉\n\n"
  setup_interrupt_handler
  run_all
end