Method: Bake::Blocks::FileUtil#initialize

Defined in:
lib/blocks/fileutil.rb

#initialize(config, type, projectDir) ⇒ FileUtil

Returns a new instance of FileUtil.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/blocks/fileutil.rb', line 8

def initialize(config, type, projectDir)
  @arg1 = config.name
  @arg2 = config.respond_to?(:to) ? config.to : nil
  @type = type
  @projectDir = projectDir
  @echo = (config.echo != "off")
  if !@arg1 || @arg1.empty?
    Bake.formatter.printError("Error: source of file-step must not be empty")
    ExitHelper.exit(1)
  elsif [:copy, :move].include?(@type) && (!@arg2 || @arg2.empty?)
    Bake.formatter.printError("Error: target of file-step must not be empty")
    ExitHelper.exit(1)
  end
end