1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00
mal/chuck/run_chuck.rb
Vasilij Schneidermann aa0ac94f0b Implement step 6
2016-07-30 00:50:43 +02:00

15 lines
370 B
Ruby
Executable File

#!/usr/bin/env ruby
cmdline = ['chuck', '--caution-to-the-wind']
cmdline << ARGV.shift if ARGV[0] == '--silent'
scriptfile = ARGV[0]
script = File.readlines(scriptfile)
imports = script.grep(%r{^ *// *@import (.+)}) { $1 }
import_files = imports.flat_map { |i| Dir[i] }
cmdline += import_files
cmdline << scriptfile
ENV['CHUCK_ARGS'] = ARGV.join("\a")
exec(*cmdline)