8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/makeme.rb', line 8
def self.run(working_directory, absolute_file_path, options)
! File.exist?(absolute_file_path) || founder('File already exists!')
! absolute_file_path.end_with?('/') || founder('File is a directory!')
guess_data, template_contents = Guess::guess(working_directory, absolute_file_path, options)
! template_contents.nil? || founder('Couldn\'t guess a template for that file!')
contents = Fill::fill(working_directory, absolute_file_path, guess_data, template_contents, options)
open(absolute_file_path, 'w') do |f|
f.write contents
end
puts "Created #{absolute_file_path}" unless options[:silent]
exit 0
end
|