Class: Guard::Stitchplus

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/stitch-plus.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Stitchplus.



7
8
9
10
# File 'lib/guard/stitch-plus.rb', line 7

def initialize (watchers=[], options={})
  super
  @options = options
end

Instance Method Details

#reloadObject



19
20
21
# File 'lib/guard/stitch-plus.rb', line 19

def reload
  write
end

#run_allObject



23
24
25
# File 'lib/guard/stitch-plus.rb', line 23

def run_all
  write
end

#run_on_additions(paths) ⇒ Object



33
34
35
36
37
38
# File 'lib/guard/stitch-plus.rb', line 33

def run_on_additions(paths)
  @stitch_files = stitch_files
  if (paths & @stitch_files).size > 0
    write
  end
end

#run_on_changes(paths) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/guard/stitch-plus.rb', line 40

def run_on_changes(paths)
  @stitch_files = stitch_files
  if @options[:config] and paths.include? @options[:config]
    start
  elsif (paths & @stitch_files).size > 0
    write
  end
end

#run_on_removals(paths) ⇒ Object



27
28
29
30
31
# File 'lib/guard/stitch-plus.rb', line 27

def run_on_removals(paths)
  if (paths & @stitch_files).size > 0
    write
  end
end

#startObject



12
13
14
15
16
17
# File 'lib/guard/stitch-plus.rb', line 12

def start
  @stitcher = ::StitchPlus.new(@options.merge({guard: true}))
  ENV['GUARD_STITCH_PLUS'] = 'true'
  @stitch_files = stitch_files
  write
end

#writeObject



49
50
51
52
# File 'lib/guard/stitch-plus.rb', line 49

def write
  @stitcher.write
  ENV['GUARD_STITCH_PLUS_OUTPUT'] = @stitcher.last_write
end