Method: Bake::Blocks::BlockBase.prepareOutput

Defined in:
lib/blocks/blockBase.rb

.prepareOutput(filename, block = nil) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/blocks/blockBase.rb', line 29

def self.prepareOutput(filename, block = nil)
  return if Bake.options.dry
  filename = File.expand_path(filename, @projectDir)
  begin
    if File.exist?(filename)
      FileUtils.rm(filename)
    else
      FileUtils::mkdir_p(File.dirname(filename))
    end
    Utils.gitIgnore(File.expand_path(block.output_dir, @projectDir)) if block
  rescue Exception => e
    if Bake.options.debug
      puts e.message
      puts e.backtrace
    end
  end
end