Class: Guard::Sync

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/sync.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Sync

Returns a new instance of Sync.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/guard/sync.rb', line 6

def initialize(watchers = [], options = {})
  super
  @options = {
    :all_on_start => false,
    :archive => true,
    :compress => true,
    :verbose => false,
    :delete => false,
    :src => '.'
  }.merge options
  update
end

Instance Method Details

#reloadObject



26
27
# File 'lib/guard/sync.rb', line 26

def reload
end

#run_allObject



29
30
31
32
# File 'lib/guard/sync.rb', line 29

def run_all
  UI.info "Guard::Sync is running" if @opts
  %x{#{@command}} if @opts
end

#run_on_additions(paths) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/guard/sync.rb', line 37

def run_on_additions paths
  @options[:exclude] = '*'
  @options[:include] = paths.to_s[1..-2]
  @options[:delete] = false
  update
  run_all
end

#run_on_changes(paths) ⇒ Object



34
35
# File 'lib/guard/sync.rb', line 34

def run_on_changes paths
end

#run_on_modifications(paths) ⇒ Object



45
46
# File 'lib/guard/sync.rb', line 45

def run_on_modifications paths
end

#run_on_removals(paths) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/guard/sync.rb', line 48

def run_on_removals paths
  @options[:exclude] = '*'
  @options[:include] = paths.to_s[1..-2]
  @options[:delete] = true
  update
  run_all
end

#startObject



19
20
21
# File 'lib/guard/sync.rb', line 19

def start
  run_all if @options[:all_on_start]
end

#stopObject



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

def stop
end