Class: Guard::Simpleshell
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Simpleshell
constructor
A new instance of Simpleshell.
- #log(msg) ⇒ Object
- #run(command) ⇒ Object
- #run_on_changes(paths) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Simpleshell
Returns a new instance of Simpleshell.
6 7 8 9 10 |
# File 'lib/guard/simple_shell.rb', line 6 def initialize(watchers=[], ={}) @command = [:command] @run_on_start = [:run_on_start] super end |
Instance Method Details
#log(msg) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/guard/simple_shell.rb', line 28 def log(msg) name = @options[:name] output = "SHELL".color(:yellow).bright() output << "[" + name.color(:blue) + "]" output << " #{msg}" puts output end |
#run(command) ⇒ Object
23 24 25 26 |
# File 'lib/guard/simple_shell.rb', line 23 def run(command) log "running #{@command}" system @command end |
#run_on_changes(paths) ⇒ Object
12 13 14 |
# File 'lib/guard/simple_shell.rb', line 12 def run_on_changes(paths) run @command end |
#start ⇒ Object
16 17 18 |
# File 'lib/guard/simple_shell.rb', line 16 def start run @command if @run_on_start end |
#stop ⇒ Object
20 21 |
# File 'lib/guard/simple_shell.rb', line 20 def stop end |