7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/makit/configuration/rakefile_helper.rb', line 7
def self.generate(project)
rakefile_content = []
rakefile_content << "# Generated Rakefile for #{project.name} v#{project.version}"
rakefile_content << "# Generated by Makit::Configuration::RakefileHelper"
rakefile_content << ""
if project.steps.any?
default_tasks = project.steps.map(&:name).join(",")
rakefile_content << "desc 'Run all project steps'"
rakefile_content << "task :default => [:#{default_tasks}]"
rakefile_content << ""
end
project.steps.each do |step|
rakefile_content << "desc '#{step.description}'"
rakefile_content << "task :#{step.name} do"
step.commands.each do |command|
rakefile_content << " sh '#{command}'"
end
rakefile_content << "end"
rakefile_content << ""
end
rakefile_content.join("\n")
end
|