module Luban::Deployment::Helpers::Generator::Utils
Public Instance Methods
copy_file(src_path, dst_path)
click to toggle source
# File lib/luban/deployment/helpers/generator.rb, line 19 def copy_file(src_path, dst_path) if dst_path.file? puts " [skipped]" else FileUtils.cp(src_path, dst_path) puts " [created]" end end
mkdir(path)
click to toggle source
# File lib/luban/deployment/helpers/generator.rb, line 10 def mkdir(path) if path.directory? puts " [skipped]" else FileUtils.mkdir(path) puts " [created]" end end
render_file(template_path, output_path, context: binding)
click to toggle source
# File lib/luban/deployment/helpers/generator.rb, line 28 def render_file(template_path, output_path, context: binding) if output_path.file? puts " [skipped]" else require 'erb' File.open(output_path, 'w') do |f| f.write ERB.new(File.read(template_path), nil, '<>').result(context) end puts " [created]" end end