68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/yodel/command/installer.rb', line 68
def install(file, permissions='0644', file_name=nil)
if file_name
dest_path = File.join('/', File.dirname(file), file_name)
else
dest_path = File.join('/', file)
end
source_path = File.join(system_path, file)
temp_file = Tempfile.new('yodel')
Feedback.report('installing', dest_path)
temp_file.write Ember::Template.new(IO.read(source_path), {source_file: source_path}).render(binding)
temp_file.close
`sudo mkdir -p #{File.dirname(dest_path)}`
`sudo cp #{temp_file.path} #{dest_path}`
`sudo chmod #{permissions} #{dest_path}`
temp_file.unlink
end
|