Created
January 15, 2010 12:40
-
-
Save koseki/278021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# ----------------------------------------------- | |
# $ gem --version | |
# 1.3.5 | |
# $ mkdir gemtest | |
# $ cd gemtest | |
# $ gem install -i . bluecloth | |
# $ gem_path_test.rb . bluecloth | |
# ERROR | |
# ERROR | |
# ERROR | |
# OK | |
# ----------------------------------------------- | |
require 'rubygems' | |
Gem.path.unshift(ARGV[0]) | |
def try_require | |
begin | |
require ARGV[1] | |
puts "OK" | |
rescue LoadError | |
puts "ERROR" | |
end | |
end | |
try_require # -> ERROR | |
Gem.refresh | |
try_require # -> ERROR | |
# Why need this line? | |
Gem.source_index.spec_dirs = Gem::SourceIndex.installed_spec_directories | |
try_require # -> ERROR | |
Gem.refresh | |
try_require # -> OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment