mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
tool/insns2vm.rb: get rid of expanding paths
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
88a7271de4
commit
3c83a94ea9
4 changed files with 7 additions and 7 deletions
|
@ -18,7 +18,7 @@ require_relative '../loaders/vm_opts_h'
|
||||||
class ApplicationController
|
class ApplicationController
|
||||||
def generate i, destdir
|
def generate i, destdir
|
||||||
path = Pathname.new i
|
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
|
dumper = RubyVM::Dumper.new dst
|
||||||
return [path, dumper]
|
return [path, dumper]
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ class RubyVM::Dumper
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_erb spec
|
def new_erb spec
|
||||||
path = Pathname.new(__FILE__).realpath.dirname
|
path = Pathname.new(__FILE__).relative_path_from(Pathname.pwd).dirname
|
||||||
path += '../views'
|
path += '../views'
|
||||||
path += spec
|
path += spec
|
||||||
src = path.read mode: 'rt:utf-8:utf-8'
|
src = path.read mode: 'rt:utf-8:utf-8'
|
||||||
|
@ -37,7 +37,7 @@ class RubyVM::Dumper
|
||||||
else
|
else
|
||||||
erb = ERB.new(src, nil, '%-')
|
erb = ERB.new(src, nil, '%-')
|
||||||
end
|
end
|
||||||
erb.filename = path.realpath.to_path
|
erb.filename = path.to_path
|
||||||
return erb
|
return erb
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class RubyVM::Dumper
|
||||||
def initialize dst
|
def initialize dst
|
||||||
@erb = {}
|
@erb = {}
|
||||||
@empty = new_binding
|
@empty = new_binding
|
||||||
@file = cstr dst.realdirpath.to_path
|
@file = cstr dst.to_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def render partial, opts = { :locals => {} }
|
def render partial, opts = { :locals => {} }
|
||||||
|
|
|
@ -20,10 +20,10 @@ class RubyVM::Scanner
|
||||||
attr_reader :__LINE__
|
attr_reader :__LINE__
|
||||||
|
|
||||||
def initialize path
|
def initialize path
|
||||||
src = Pathname.new(__FILE__).realpath.dirname
|
src = Pathname.new(__FILE__).relative_path_from(Pathname.pwd).dirname
|
||||||
src += path
|
src += path
|
||||||
@__LINE__ = 1
|
@__LINE__ = 1
|
||||||
@__FILE__ = src.realpath.to_path
|
@__FILE__ = src.to_path
|
||||||
@str = src.read mode: 'rt:utf-8:utf-8'
|
@str = src.read mode: 'rt:utf-8:utf-8'
|
||||||
@pos = 0
|
@pos = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ require_relative '../controllers/application_controller.rb'
|
||||||
|
|
||||||
module RubyVM::Insns2VM
|
module RubyVM::Insns2VM
|
||||||
def self.router argv
|
def self.router argv
|
||||||
options = { destdir: Dir.getwd }
|
options = { destdir: nil }
|
||||||
targets = generate_parser(options).parse argv
|
targets = generate_parser(options).parse argv
|
||||||
return targets.map do |i|
|
return targets.map do |i|
|
||||||
next ApplicationController.new.generate i, options[:destdir]
|
next ApplicationController.new.generate i, options[:destdir]
|
||||||
|
|
Loading…
Reference in a new issue