ruby-changes:52943
From: nobu <ko1@a...>
Date: Fri, 19 Oct 2018 08:58:26 +0900 (JST)
Subject: [ruby-changes:52943] nobu:r65157 (trunk): tool/insns2vm.rb: get rid of expanding paths
nobu 2018-10-19 08:58:21 +0900 (Fri, 19 Oct 2018) New Revision: 65157 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65157 Log: tool/insns2vm.rb: get rid of expanding paths Modified files: trunk/tool/ruby_vm/controllers/application_controller.rb trunk/tool/ruby_vm/helpers/dumper.rb trunk/tool/ruby_vm/helpers/scanner.rb trunk/tool/ruby_vm/scripts/insns2vm.rb Index: tool/ruby_vm/helpers/scanner.rb =================================================================== --- tool/ruby_vm/helpers/scanner.rb (revision 65156) +++ tool/ruby_vm/helpers/scanner.rb (revision 65157) @@ -20,10 +20,10 @@ class RubyVM::Scanner https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/helpers/scanner.rb#L20 attr_reader :__LINE__ def initialize path - src = Pathname.new(__FILE__).realpath.dirname + src = Pathname.new(__FILE__).relative_path_from(Pathname.pwd).dirname src += path @__LINE__ = 1 - @__FILE__ = src.realpath.to_path + @__FILE__ = src.to_path @str = src.read mode: 'rt:utf-8:utf-8' @pos = 0 end Index: tool/ruby_vm/helpers/dumper.rb =================================================================== --- tool/ruby_vm/helpers/dumper.rb (revision 65156) +++ tool/ruby_vm/helpers/dumper.rb (revision 65157) @@ -25,7 +25,7 @@ class RubyVM::Dumper https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/helpers/dumper.rb#L25 end def new_erb spec - path = Pathname.new(__FILE__).realpath.dirname + path = Pathname.new(__FILE__).relative_path_from(Pathname.pwd).dirname path += '../views' path += spec src = path.read mode: 'rt:utf-8:utf-8' @@ -37,7 +37,7 @@ class RubyVM::Dumper https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/helpers/dumper.rb#L37 else erb = ERB.new(src, nil, '%-') end - erb.filename = path.realpath.to_path + erb.filename = path.to_path return erb end @@ -87,7 +87,7 @@ class RubyVM::Dumper https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/helpers/dumper.rb#L87 def initialize dst @erb = {} @empty = new_binding - @file = cstr dst.realdirpath.to_path + @file = cstr dst.to_path end def render partial, opts = { :locals => {} } Index: tool/ruby_vm/controllers/application_controller.rb =================================================================== --- tool/ruby_vm/controllers/application_controller.rb (revision 65156) +++ tool/ruby_vm/controllers/application_controller.rb (revision 65157) @@ -18,7 +18,7 @@ require_relative '../loaders/vm_opts_h' https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/controllers/application_controller.rb#L18 class ApplicationController def generate i, destdir path = Pathname.new i - dst = Pathname.new(destdir).join(i) + dst = destdir ? Pathname.new(destdir).join(i) : Pathname.new(i) dumper = RubyVM::Dumper.new dst return [path, dumper] end Index: tool/ruby_vm/scripts/insns2vm.rb =================================================================== --- tool/ruby_vm/scripts/insns2vm.rb (revision 65156) +++ tool/ruby_vm/scripts/insns2vm.rb (revision 65157) @@ -15,7 +15,7 @@ require_relative '../controllers/applica https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/scripts/insns2vm.rb#L15 module RubyVM::Insns2VM def self.router argv - options = { destdir: Dir.getwd } + options = { destdir: nil } targets = generate_parser(options).parse argv return targets.map do |i| next ApplicationController.new.generate i, options[:destdir] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/