aboutsummaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile38
1 files changed, 32 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index 71d875a..e145b58 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,7 +19,10 @@ end
directory 'build'
-task default: :boot
+task :default do
+ Rake::Task["build/valid/#{STAGES.last}/cl"].invoke
+ Rake::Task["boot"].invoke
+end
desc 'Final stage'
task boot: "build/valid/#{STAGES.last}/cl"
@@ -34,11 +37,34 @@ task boot: "boot/#{STAGES.last}/cl.elna" do |t|
Open3.pipeline(cat_arguments, run(exe), diff_arguments)
end
-desc 'Convert previous stage language into the current stage language'
-task :convert do
- File.open('boot/stage25/cl.elna', 'w') do |current_stage|
- File.readlines('boot/stage24/cl.elna').each do |line|
- current_stage << line
+namespace :stage do
+ stage_number = STAGES.last.delete_prefix('stage').to_i
+
+ desc 'Create a new stabe by duplicating the last one'
+ task :new do
+ new_stage = "stage#{stage_number.succ}"
+ cp_r "boot/stage#{stage_number}", "boot/#{new_stage}"
+ STAGES << new_stage
+ Rake::Task['ninja'].invoke
+ end
+
+ desc 'Delete the last stage'
+ task :drop do
+ rm_r "boot/stage#{stage_number}"
+ STAGES.pop
+ Rake::Task['ninja'].invoke
+ end
+
+ desc 'Convert previous stage language into the current stage language'
+ task :convert do
+ from = "boot/stage#{stage_number.pred}/cl.elna"
+ to = "boot/stage#{stage_number}/cl.elna"
+ puts "Converting #{from} to #{to}."
+
+ File.open(to, 'w') do |current_stage|
+ File.readlines(from).each do |line|
+ current_stage << line
+ end
end
end
end