Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for the existence of Rubinius::LIB_PATH and actually tell the user in case of error #1671

Merged
merged 3 commits into from Apr 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions kernel/alpha.rb
Expand Up @@ -171,7 +171,7 @@ def kind_of?(cls)
# This method may be overridden, and is often used to provide dynamic
# behaviour. An overriding version should call super if it fails to
# resolve the message. This practice ensures that the default version
# will called if all else fails.
# will be called if all else fails.
#
def method_missing(meth, *args)
raise NoMethodError, "Unable to send '#{meth}' on '#{self}' (#{self.class})"
Expand Down Expand Up @@ -453,7 +453,7 @@ def const_missing(name)

# Set Module's direct superclass.
#
# The corresponding 'getter' #superclass method defined
# The corresponding 'getter' #superclass method is defined
# in class.rb, because it is more complex than a mere
# accessor
#
Expand Down
37 changes: 18 additions & 19 deletions kernel/loader.rb
Expand Up @@ -74,17 +74,14 @@ def preamble
def system_load_path
@stage = "setting up system load path"

@main_lib = nil

if env_lib = ENV['RBX_LIB']
@main_lib = File.expand_path(env_lib) if File.exists?(env_lib)
end

# Use the env version if it's set.
@main_lib = Rubinius::LIB_PATH unless @main_lib
if env_lib = ENV['RBX_LIB'] and File.exists?(env_lib)
@main_lib = File.expand_path(env_lib)
else
# use configured library path and check its existence
@main_lib = Rubinius::LIB_PATH

unless @main_lib
STDERR.puts <<-EOM
unless File.exists?(@main_lib)
STDERR.puts <<-EOM
Rubinius was configured to find standard library files at:

#{@main_lib}
Expand All @@ -93,21 +90,23 @@ def system_load_path

Set the environment variable RBX_LIB to the directory
containing the Rubinius standard library files.
EOM
EOM
end
end

@main_lib_bin = File.join @main_lib, "bin"
Rubinius.const_set :PARSER_EXT_PATH, "#{@main_lib}/ext/melbourne/rbx/melbourne20"

# This conforms more closely to MRI. It is necessary to support
# paths that mkmf adds when compiling and installing native exts.
additions = []
additions << Rubinius::SITE_PATH
additions << "#{Rubinius::SITE_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}"
additions << Rubinius::VENDOR_PATH
additions << "#{Rubinius::VENDOR_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}"
additions << "#{@main_lib}/#{Rubinius::RUBY_LIB_VERSION}"
additions << @main_lib
additions = [
Rubinius::SITE_PATH,
"#{Rubinius::SITE_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}",
Rubinius::VENDOR_PATH,
"#{Rubinius::VENDOR_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}",
"#{@main_lib}/#{Rubinius::RUBY_LIB_VERSION}",
@main_lib,
]
additions.uniq!

$LOAD_PATH.unshift(*additions)
Expand Down Expand Up @@ -160,7 +159,7 @@ def show_syntax_errors(syns)
end
end

# Checks if a subcammand with basename +base+ exists. Returns the full
# Checks if a subcommand with basename +base+ exists. Returns the full
# path to the subcommand if it does; otherwise, returns nil.
def find_subcommand(base)
command = File.join @main_lib_bin, "#{base}.rb"
Expand Down