aboutsummaryrefslogtreecommitdiffstats
path: root/tool/ruby_vm/scripts
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-09-18 14:22:35 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2022-09-18 14:39:53 +0900
commita988fe0b3e4cd5a3955706affdc1f498ff9b5d77 (patch)
treecb8478fc417dc73bb495636b45b0393190c74926 /tool/ruby_vm/scripts
parent12023c833fb2ba3b50a34ab7f6b53f5f77d78658 (diff)
downloadruby-a988fe0b3e4cd5a3955706affdc1f498ff9b5d77.tar.gz
Introduce --basedir to insns2vm.rb
and leverage that to preserve the directory structure under tool/ruby_vm/views
Diffstat (limited to 'tool/ruby_vm/scripts')
-rw-r--r--tool/ruby_vm/scripts/insns2vm.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/tool/ruby_vm/scripts/insns2vm.rb b/tool/ruby_vm/scripts/insns2vm.rb
index 8325dd364f..47d8da5513 100644
--- a/tool/ruby_vm/scripts/insns2vm.rb
+++ b/tool/ruby_vm/scripts/insns2vm.rb
@@ -15,10 +15,10 @@ require_relative '../controllers/application_controller.rb'
module RubyVM::Insns2VM
def self.router argv
- options = { destdir: nil }
+ options = { destdir: nil, basedir: nil }
targets = generate_parser(options).parse argv
return targets.map do |i|
- next ApplicationController.new.generate i, options[:destdir]
+ next ApplicationController.new.generate i, options[:destdir], options[:basedir]
end
end
@@ -84,6 +84,14 @@ module RubyVM::Insns2VM
options[:destdir] = dir
end
+ this.on "--basedir=DIR", <<-'begin' do |dir|
+ Change the base directory from the current working directory
+ to the given path. Used for searching the source template.
+ begin
+ raise "directory was not found in '#{dir}'" unless Dir.exist?(dir)
+ options[:basedir] = dir
+ end
+
this.on "-V", "--[no-]verbose", <<-'end'
Please let us ignore this and be modest.
end