Class: Katte::Plugins::Output::File_

Inherits:
Object
  • Object
show all
Includes:
Katte::Plugins::Output
Defined in:
lib/katte/plugins/output/file.rb

Instance Method Summary collapse

Methods included from Base

#define_keyword, #find, #included, #index, #plugins, #register

Instance Method Details

#err(node, data) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/katte/plugins/output/file.rb', line 19

def err(node, data)
  return data if data.empty?

  file = File.join(Katte.app.config.log_root,
                   'recipes',
                   node.name + '.log',
                   Katte.app.env.to_hash['date'] + ".txt")

  FileUtils.makedirs(File.dirname(file))

  File.open(file, 'a') {|f| f.print data }
end

#out(node, data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/katte/plugins/output/file.rb', line 7

def out(node, data)
  return data if data.empty?

  file = File.join(Katte.app.config.result_root,
                   node.name + '.out',
                   Katte.app.env.to_hash['date'] + ".txt")

  FileUtils.makedirs(File.dirname(file))

  File.open(file, 'w') {|f| f.print data }
end