Created
February 2, 2011 22:39
-
-
Save ericanderson/808612 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
require 'rubygems' | |
module Gem | |
class << self | |
def hacked_set_paths(gpaths) | |
@gem_path = gpaths | |
@gem_path << Gem.dir | |
end | |
end | |
end | |
Gem.hacked_set_paths(["file:/a"]) | |
p Gem.path |
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
jruby-1.5.5 > require 'rubygems' | |
=> false | |
jruby-1.5.5 > Gem.path | |
=> ["/Users/ericanderson/.rvm/gems/jruby-1.5.5@warbler", "/Users/ericanderson/.rvm/gems/jruby-1.5.5@global"] | |
jruby-1.5.5 > ENV['GEM_PATH'] = 'a' | |
=> "a" | |
jruby-1.5.5 > Gem.clear_paths | |
=> nil | |
jruby-1.5.5 > Gem.path | |
=> ["/Users/ericanderson/.rvm/gems/jruby-1.5.5@warbler"] | |
jruby-1.5.5 > ENV['GEM_PATH'] | |
=> "a" |
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
~ (1.8.7) $ irb | |
ruby-1.8.7-p302 > require 'rubygems' | |
=> false | |
ruby-1.8.7-p302 > Gem.path | |
=> ["/Users/ericanderson/.rvm/gems/ruby-1.8.7-p302", "/Users/ericanderson/.rvm/gems/ruby-1.8.7-p302@global"] | |
ruby-1.8.7-p302 > ENV['GEM_PATH'] = "a" | |
=> "a" | |
ruby-1.8.7-p302 > Gem.clear_paths | |
=> nil | |
ruby-1.8.7-p302 > Gem.path | |
=> ["a", "/Users/ericanderson/.rvm/gems/ruby-1.8.7-p302"] | |
ruby-1.8.7-p302 > ENV['GEM_PATH'] | |
=> "a" |
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
module Gem | |
ConfigFile::PLATFORM_DEFAULTS['install'] = '--env-shebang' | |
ConfigFile::PLATFORM_DEFAULTS['update'] = '--env-shebang' | |
@jar_paths = [] | |
class << self | |
alias_method :original_set_paths, :set_paths | |
def set_paths(gpaths) | |
original_set_paths(gpaths) | |
@gem_path.reject! {|p| !readable_path? p } | |
@jar_paths.each {|p| @gem_path << p unless @gem_path.include?(p) } if @jar_paths | |
end | |
def readable_path?(p) | |
p =~ /^file:/ || File.exists?(p) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, jruby_partial.rb has the code that jruby ships. There are 2 big duhs for my problems.