8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/gizmo_mogwai.rb', line 8
def clone_mogwai(file_name, options)
template_file = options[:template_file]
project_dir = options[:project_dir]
spec_dir = options[:spec_dir]
file_path = "#{project_dir}/#{file_name}.rb"
template = ERB.new File.new(template_file).read, nil, "%"
@class_name = file_name.split('_').map{|word| word.capitalize}.join('')
create_file file_path do
template.result binding
end
generator = RSpecKickstarter::Generator.new(spec_dir)
generator.write_spec(file_path, false, false)
end
|