Sha256: e022188a66566b8ac83e4749949812d5d6be9b0558a63b7f45d0b36dbfe4eeaa

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

  module FasterRubyGems
    def self.install_over_rubygems! aggressive = false
      raise 'only needed on 1.8 -- for 1.9 you have to do
      $ export RUBYOPT=$RUBYOPT -rfaster_rubygems' if RUBY_VERSION >= '1.9.0'
      require 'fileutils'
      old = rubygems_path
      new =  old + ".bak.rb"
      raise 'cannot install twice--please run unoverride first' if File.exist?(new)
      FileUtils.cp old, new
      File.open(old, 'w') do |f|
        f.write "require 'faster_rubygems'\n"
        f.write "require 'faster_require'" if aggressive
      end
      puts 'success--it will load by default in place of normal rubygems'
    end
    
    def self.rubygems_path
      Gem::Dependency
      raise unless $LOADED_FEATURES.include? "rubygems.rb"
      # now go and look for it
      $:.detect{|path| File.exist?(path + '/rubygems.rb') || File.exist?(path + '/rubygems.rb.bak.rb')} + "/rubygems.rb"
    end
    
    def self.uninstall_over_rubygems!
      raise 'only needed on 1.8' if RUBY_VERSION >= '1.9.0'
      require 'fileutils'
      old = rubygems_path + ".bak.rb"
      FileUtils.cp old, rubygems_path
      File.delete old
      puts 'successfully reverted back to normal rubygems'
    end
  end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
faster_rubygems-0.12.8 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.12.7 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.12.6 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.12.5 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.12.2 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.12.1 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.12.0 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.11.1 lib/faster_rubygems/install_helper.rb
faster_rubygems-0.9.2 lib/faster_rubygems/install_helper.rb