From a988fe0b3e4cd5a3955706affdc1f498ff9b5d77 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sun, 18 Sep 2022 14:22:35 +0900 Subject: Introduce --basedir to insns2vm.rb and leverage that to preserve the directory structure under tool/ruby_vm/views --- tool/ruby_vm/helpers/dumper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tool/ruby_vm/helpers') diff --git a/tool/ruby_vm/helpers/dumper.rb b/tool/ruby_vm/helpers/dumper.rb index 7aec9c7631..c8a65e0650 100644 --- a/tool/ruby_vm/helpers/dumper.rb +++ b/tool/ruby_vm/helpers/dumper.rb @@ -28,7 +28,7 @@ class RubyVM::Dumper path = Pathname.new(__FILE__) path = (path.relative_path_from(Pathname.pwd) rescue path).dirname path += '../views' - path += File.basename(spec) + path += Pathname.pwd.join(spec).to_s.sub("#{@base}/", '') src = path.read mode: 'rt:utf-8:utf-8' rescue Errno::ENOENT raise "don't know how to generate #{path}" @@ -85,10 +85,11 @@ class RubyVM::Dumper . join end - def initialize dst + def initialize dst, base @erb = {} @empty = new_binding @file = cstr dst.to_path + @base = base end def render partial, opts = { :locals => {} } -- cgit v1.2.1