Class: Hpp::Hpp

Inherits:
Thor
  • Object
show all
Includes:
FileUtils
Defined in:
lib/hpp/hpp.rb

Instance Method Summary collapse

Instance Method Details

#process(src = 'src', target = 'target') ⇒ Object

Raises:

  • (RuntimeError)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hpp/hpp.rb', line 11

def process(src='src', target='target')
  raise RuntimeError.new("There is NO '#{src}' folder in current working directory") unless Dir.exists?(src)
  Dir.mkdir(target) unless Dir.exists?(target)

  if options.daemon?
    Listen.to(src, :relative_paths => true) do |modified, added, removed|
      _process(src, target)
      print "Changes of files from '#{src}' Detected: "
      print "#{modified} Modified, " unless modified.empty?
      print "#{added} Added, " unless added.empty?
      print "#{removed} Removed, " unless removed.empty?
      puts "And Re-Generated output files into '#{target}'"
    end.start
  elsif
    _process(src, target)
  end
end