4 # Base class from which to subclass other backends. Subclasses must
5 # implement the +run+ method that gets passed a file name and must (0)
6 # set the +@layers+ instance var to a hash of layers containing the
7 # metadata gathered and call the +write_layers+ method when finished
13 raise "Base Backend class shouldn't be used for real augmentation."
16 # Output the +@layers+ hash as JSON where augment expects it.
18 @layers.each do |file, layers|
19 FileUtils.mkpath(File.dirname(file) + '/.augment')
20 File.open(Augment.augment_path(file), 'w') do |f|
21 f.puts "[#{layers.map{ |l| l.to_json }.join(", \n")}]"
26 # Suppress STDOUT while a block runs.
28 old_stdout = $stdout.clone
29 $stdout.reopen(File.new('/dev/null','w'))
31 $stdout.reopen(old_stdout)