Class: Guard::Preserves
Instance Attribute Summary collapse
-
#app_root ⇒ Object
readonly
Returns the value of attribute app_root.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Preserves
constructor
Initializes a Guard plugin.
-
#reload ⇒ Object
Called when ‘reload|r|z + enter` is pressed.
-
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
-
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
-
#run_on_changes(paths) ⇒ Object
Default behaviour on file(s) changes that the Guard plugin watches.
-
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
-
#run_on_removals(paths) ⇒ Object
Called on file(s) removals that the Guard plugin watches.
-
#start ⇒ Object
Called once when Guard starts.
-
#stop ⇒ Object
Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Preserves
Initializes a Guard plugin. Don’t do any work here, especially as Guard plugins get initialized even if they are not in an active group!
17 18 19 20 21 22 23 |
# File 'lib/guard/preserves.rb', line 17 def initialize(watchers = [], = {}) @destination = [:destination] @app_root = [:app_root] || File.dirname(::Guard.[:guardfile]) watchers = [::Guard::Watcher.new(%r{^.+\.(js|coffee)$})] if watchers.empty? super end |
Instance Attribute Details
#app_root ⇒ Object (readonly)
Returns the value of attribute app_root.
8 9 10 |
# File 'lib/guard/preserves.rb', line 8 def app_root @app_root end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
8 9 10 |
# File 'lib/guard/preserves.rb', line 8 def destination @destination end |
Instance Method Details
#reload ⇒ Object
Called when ‘reload|r|z + enter` is pressed. This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…
47 48 |
# File 'lib/guard/preserves.rb', line 47 def reload end |
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
56 57 |
# File 'lib/guard/preserves.rb', line 56 def run_all end |
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
73 74 |
# File 'lib/guard/preserves.rb', line 73 def run_on_additions(paths) end |
#run_on_changes(paths) ⇒ Object
Default behaviour on file(s) changes that the Guard plugin watches.
64 65 |
# File 'lib/guard/preserves.rb', line 64 def run_on_changes(paths) end |
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
82 83 84 85 86 87 88 |
# File 'lib/guard/preserves.rb', line 82 def run_on_modifications(paths) paths.each do |path| package = package_name(path) compile_package package if File.extname(path) == '.coffee' copy_package package if File.extname(path) == '.js' end end |
#run_on_removals(paths) ⇒ Object
Called on file(s) removals that the Guard plugin watches.
96 97 |
# File 'lib/guard/preserves.rb', line 96 def run_on_removals(paths) end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
30 31 |
# File 'lib/guard/preserves.rb', line 30 def start end |
#stop ⇒ Object
Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
38 39 |
# File 'lib/guard/preserves.rb', line 38 def stop end |