Sha256: b88745dfdb0182db7b49f1215689c4cb2fe4849cbb5111752c1c3fb9f1484301

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require 'rubygems/user_interaction'

module Spec
  module Rubygems
    def self.setup
      Gem.clear_paths

      ENV['BUNDLE_PATH'] = nil
      ENV['GEM_HOME'] = ENV['GEM_PATH'] = Path.base_system_gems.to_s
      ENV['PATH'] = ["#{Path.root}/bin", "#{Path.system_gem_path}/bin", ENV['PATH']].join(File::PATH_SEPARATOR)

      unless File.exist?("#{Path.base_system_gems}")
        FileUtils.mkdir_p(Path.base_system_gems)
        puts "running `gem install rake fakeweb artifice sinatra --no-rdoc --no-ri`"
        `gem install rake fakeweb artifice sinatra --no-rdoc --no-ri`
        # 3.0.0 breaks 1.9.2 specs
        puts "running `gem install builder --version 2.1.2 --no-rdoc --no-ri`"
        `gem install builder --version 2.1.2 --no-rdoc --no-ri`
      end

      ENV['HOME'] = Path.home.to_s

      Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
    end

    def gem_command(command, args = "", options = {})
      if command == :exec && !options[:no_quote]
        args = args.gsub(/(?=")/, "\\")
        args = %["#{args}"]
      end
      lib  = File.join(File.dirname(__FILE__), '..', '..', 'lib')
      %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
bundler-1.1.pre.4 spec/support/rubygems_ext.rb
bundler-1.1.pre.3 spec/support/rubygems_ext.rb
bundler-1.1.pre.2 spec/support/rubygems_ext.rb
bundler_package_git-1.1.pre.1 spec/support/rubygems_ext.rb
bundler-1.1.pre.1 spec/support/rubygems_ext.rb