Class: Rig::Command::Main

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rig/command.rb

Instance Method Summary collapse

Methods inherited from Abstract

#execute, #instance_list, #print_table

Instance Method Details

#merge_file(src, dest) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rig/command.rb', line 10

def merge_file(src, dest)
  old = YAML.load_file(dest)
  FileUtils.mv(dest, "#{dest}.bak.#{Time.now.to_i}")
  new = YAML.load_file(src)
  new.merge!(old)
  File.open(dest, "w") {|f| f.write(new.to_yaml)}
end