Class: Guard::Yamlsort
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Yamlsort
- Defined in:
- lib/guard/yamlsort.rb,
lib/guard/yamlsort/file_sorter.rb
Defined Under Namespace
Classes: FileSorter
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Yamlsort
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_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(options = {}) ⇒ Yamlsort
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 |
# File 'lib/guard/yamlsort.rb', line 17 def initialize( = {}) super 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/…
45 46 47 |
# File 'lib/guard/yamlsort.rb', line 45 def reload true end |
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
55 56 57 |
# File 'lib/guard/yamlsort.rb', line 55 def run_all true end |
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
64 65 66 |
# File 'lib/guard/yamlsort.rb', line 64 def run_on_additions(paths) true end |
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
74 75 76 77 |
# File 'lib/guard/yamlsort.rb', line 74 def run_on_modifications(paths) Guard::UI.info("Running YAML sorter.") paths.each { |p| FileSorter.new(p) } end |
#run_on_removals(paths) ⇒ Object
Called on file(s) removals that the Guard plugin watches.
85 86 87 |
# File 'lib/guard/yamlsort.rb', line 85 def run_on_removals(paths) true end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
26 27 28 |
# File 'lib/guard/yamlsort.rb', line 26 def start Guard::UI.info("Started YAML sorter.") end |
#stop ⇒ Object
Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
35 36 37 |
# File 'lib/guard/yamlsort.rb', line 35 def stop true end |