231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
# File 'lib/vagrant/hivemind/util.rb', line 231
def self.generate_hosts_file(hosts = {}, path = Pathname.new(Dir.pwd))
datetime_now = DateTime.now.strftime "%F %T %p"
b = binding
template_string = ""
File.open(File.expand_path("../../../../templates/system.hosts.erb", __FILE__), "r") do |f|
template_string = f.read
end
template = ERB.new template_string
template_result = template.result(b)
system_hosts_file = get_system_hosts_file_from_path path
File.open(system_hosts_file, "w+") do |f|
f.write(template_result)
end
end
|