Sha256: 4a6a012489cd9106ab1d2c090d751f39c48b0b9f44e4a8288cb4715c125042c6
Contents?: true
Size: 1014 Bytes
Versions: 11
Compression:
Stored size: 1014 Bytes
Contents
require 'fileutils' class Fancy class Compiler class Command def self.option_flag(argv, name) argv.delete name end def self.option_value(argv, name) if idx = argv.index(name) value = argv.delete_at(idx + 1) argv.delete_at(idx) value end end def self.run(argv) batch = option_flag(argv, "--batch") print = option_flag(argv, "-B") src_path = option_value(argv, "--source-path") out_path = option_value(argv, "--output-path") argv.each do |f| out = nil if out_path && src_path out = f.sub(src_path, out_path) + "c" end compile(f, out, batch, print) end end def self.compile(file, out = nil, info_output = false, print = false) puts "Compiling #{file}" if info_output FileUtils.mkdir_p(File.dirname(out)) if out Compiler.compile_fancy_file file, out, 1, print end end end end
Version data entries
11 entries across 11 versions & 1 rubygems