class Vpsb::Helpers::FileReplace
Public Class Methods
replace_json(path, hash)
click to toggle source
# File lib/vpsb/helpers/file_replace.rb, line 7 def self.replace_json(path, hash) replace_text(path, hash.to_json) end
replace_text(path, text)
click to toggle source
# File lib/vpsb/helpers/file_replace.rb, line 11 def self.replace_text(path, text) file_path = File.join(Dir.pwd, path) FileUtils.rm(file_path) if File.exist?(file_path) File.open(file_path,"w") do |f| f.write(text) end end