Class: Guard::Sync
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ Sync
constructor
A new instance of Sync.
- #run_all ⇒ Object
- #run_on_additions(paths) ⇒ Object
- #run_on_changes(paths) ⇒ Object
- #run_on_modifications(paths) ⇒ Object
- #run_on_removals(paths) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(watchers = [], options = {}) ⇒ Sync
Returns a new instance of Sync.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/guard/sync.rb', line 6 def initialize(watchers = [], = {}) super @options = { :run_on_start => false, :archive => false, :recursive => true, :compress => true, :permissions => true, :delete => false, :src => '.', :verbose => false, :quiet => true }.merge update end |
Instance Method Details
#run_all ⇒ Object
26 27 28 29 |
# File 'lib/guard/sync.rb', line 26 def run_all UI.info "#{@action}d #{@options[:include]}" `#{@command}` if @opts end |
#run_on_additions(paths) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/guard/sync.rb', line 31 def run_on_additions paths @action = "create" @options[:exclude] = '*' @options[:include] = paths.to_s[1..-2] @options[:delete] = false update run_all end |
#run_on_changes(paths) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/guard/sync.rb', line 40 def run_on_changes paths @action = "modifie" @options[:exclude] = '*' @options[:include] = paths.to_s[1..-2] @options[:delete] = false update run_all end |
#run_on_modifications(paths) ⇒ Object
49 50 51 |
# File 'lib/guard/sync.rb', line 49 def run_on_modifications paths run_on_changes paths end |
#run_on_removals(paths) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/guard/sync.rb', line 53 def run_on_removals paths @action = "remove" @options[:exclude] = '*' @options[:include] = paths.to_s[1..-2] @options[:delete] = true update run_all end |
#start ⇒ Object
22 23 24 |
# File 'lib/guard/sync.rb', line 22 def start run_all if @options[:run_on_start] end |