5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/framework-generate.rb', line 5
def self.generate
file_path = "#{Dir.pwd}/FrameworkSpec"
unless File.exist?(file_path)
puts "Couldn't find FrameworkSpec. Do you want to create one? [Y/N]"
create_file = gets.chomp
if create_file.casecmp('Y').zero?
sample_framework_spec = File.join(File.dirname(__FILE__), 'SampleFrameworkSpec')
FileUtils.cp(sample_framework_spec, file_path)
abort 'Created a FrameworkSpec. Update the contents of the FrameworkSpec file and rerun the command'
elsif
abort 'Cannot create a project without a FrameworkSpec'
end
end
file_contents = File.read(file_path)
project = FrameworkGenerate::Project.new
project.instance_eval(file_contents, file_path)
project.generate
end
|