mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
improve rbx core source support
* Making use of new Rubinius::LIB_PATH and Rubinius::KERNEL_PATH constants
This commit is contained in:
parent
ad4fe02e6c
commit
ac26e57ad1
1 changed files with 5 additions and 19 deletions
|
@ -2,33 +2,19 @@ class Pry
|
||||||
module RbxPath
|
module RbxPath
|
||||||
module_function
|
module_function
|
||||||
def is_core_path?(path)
|
def is_core_path?(path)
|
||||||
path.start_with?("kernel")
|
path.start_with?("kernel") || path.start_with?("lib")
|
||||||
end
|
end
|
||||||
|
|
||||||
def convert_path_to_full(path)
|
def convert_path_to_full(path)
|
||||||
if rvm_ruby?(Rubinius::BIN_PATH)
|
if path.start_with?("kernel")
|
||||||
rvm_convert_path_to_full(path)
|
File.join File.dirname(Rubinius::KERNEL_PATH), path
|
||||||
else
|
elsif path.start_with?("lib")
|
||||||
std_convert_path_to_full(path)
|
File.join File.dirname(Rubinius::LIB_PATH), path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def rvm_ruby?(path)
|
def rvm_ruby?(path)
|
||||||
!!(path =~ /\.rvm/)
|
!!(path =~ /\.rvm/)
|
||||||
end
|
end
|
||||||
|
|
||||||
def rvm_convert_path_to_full(path)
|
|
||||||
ruby_name = File.dirname(Rubinius::BIN_PATH).split("/").last
|
|
||||||
source_path = File.join(File.dirname(File.dirname(File.dirname(Rubinius::BIN_PATH))), "src", ruby_name)
|
|
||||||
file_name = File.join(source_path, path)
|
|
||||||
raise "Cannot find rbx core source" if !File.exists?(file_name)
|
|
||||||
file_name
|
|
||||||
end
|
|
||||||
|
|
||||||
def std_convert_path_to_full(path)
|
|
||||||
file_name = File.join(Rubinius::BIN_PATH, "..", path)
|
|
||||||
raise "Cannot find rbx core source" if !File.exists?(file_name)
|
|
||||||
file_name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue