PHP 8.2.31
Preview: installer_test_case.rb Size: 3.10 KB
//proc/thread-self/root/opt/alt/ruby19/lib64/ruby/1.9.1/rubygems/installer_test_case.rb

require 'rubygems/test_case'
require 'rubygems/installer'

class Gem::Installer

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :gem_dir

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :format

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :gem_home

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :env_shebang

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :ignore_dependencies

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :format_executable

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :security_policy

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :spec

  ##
  # Available through requiring rubygems/installer_test_case

  attr_writer :wrappers
end

##
# A test case for Gem::Installer.

class Gem::InstallerTestCase < Gem::TestCase

  def setup
    super

    @installer_tmp = File.join @tempdir, 'installer'
    FileUtils.mkdir_p @installer_tmp

    Gem.use_paths @installer_tmp
    Gem.ensure_gem_subdirectories @installer_tmp

    @spec = quick_gem 'a'
    util_make_exec @spec
    util_build_gem @spec
    @gem = @spec.cache_file

    @user_spec = quick_gem 'b'
    util_make_exec @user_spec
    util_build_gem @user_spec
    @user_gem = @user_spec.cache_file

    Gem.use_paths @gemhome

    @installer      = util_installer @spec, @gemhome
    @user_installer = util_installer @user_spec, Gem.user_dir, :user

    Gem.use_paths @gemhome
  end

  def util_gem_bindir spec = @spec
    # TODO: deprecate
    spec.bin_dir
  end

  def util_gem_dir spec = @spec
    # TODO: deprecate
    spec.gem_dir
  end

  def util_inst_bindir
    File.join @gemhome, "bin"
  end

  def util_make_exec(spec = @spec, shebang = "#!/usr/bin/ruby")
    spec.executables = %w[executable]
    spec.files << 'bin/executable'

    exec_path = spec.bin_file "executable"
    write_file exec_path do |io|
      io.puts shebang
    end

    bin_path = File.join @tempdir, "bin", "executable"
    write_file bin_path do |io|
      io.puts shebang
    end
  end

  def util_setup_gem(ui = @ui) # HACK fix use_ui to make this automatic
    @spec.files << File.join('lib', 'code.rb')
    @spec.extensions << File.join('ext', 'a', 'mkrf_conf.rb')

    Dir.chdir @tempdir do
      FileUtils.mkdir_p 'bin'
      FileUtils.mkdir_p 'lib'
      FileUtils.mkdir_p File.join('ext', 'a')
      File.open File.join('bin', 'executable'), 'w' do |f|
        f.puts "raise 'ran executable'"
      end
      File.open File.join('lib', 'code.rb'), 'w' do |f| f.puts '1' end
      File.open File.join('ext', 'a', 'mkrf_conf.rb'), 'w' do |f|
        f << <<-EOF
          File.open 'Rakefile', 'w' do |rf| rf.puts "task :default" end
        EOF
      end

      use_ui ui do
        FileUtils.rm @gem

        @gem = Gem::Builder.new(@spec).build
      end
    end

    @installer = Gem::Installer.new @gem
  end

  def util_installer(spec, gem_home, user=false)
    Gem::Installer.new spec.cache_file, :user_install => user
  end
end

Directory Contents

Dirs: 4 × Files: 49

Name Size Perms Modified Actions
commands DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
ext DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
package DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
ssl_certs DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
2.21 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
12.46 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
4.67 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
9.69 KB lrw-r--r-- 2012-04-19 23:38:41
Edit Download
1.83 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
2.65 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
6.43 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
9.94 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
5.58 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
1.81 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
5.55 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
793 B lrw-r--r-- 2011-07-27 02:04:03
Edit Download
2.34 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
379 B lrw-r--r-- 2011-07-27 02:04:03
Edit Download
1.96 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
1.86 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
2.24 KB lrw-r--r-- 2011-08-05 20:18:14
Edit Download
4.57 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
2.38 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
16.85 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
16.94 KB lrw-r--r-- 2012-10-25 09:18:59
Edit Download
3.10 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
3.87 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
3.36 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
1.05 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
3.69 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
2.15 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
3.79 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
1.50 KB lrw-r--r-- 2011-08-26 01:12:57
Edit Download
5.55 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
498 B lrw-r--r-- 2012-04-19 22:43:16
Edit Download
1.34 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
13.50 KB lrw-r--r-- 2012-04-19 23:38:41
Edit Download
4.99 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
577 B lrw-r--r-- 2011-07-27 02:04:03
Edit Download
28.83 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
21.93 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
11.00 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
54.68 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
7.17 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
3.96 KB lrw-r--r-- 2012-04-19 23:38:41
Edit Download
21.89 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
3.47 KB lrw-r--r-- 2011-08-05 20:18:14
Edit Download
1.23 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
6.77 KB lrw-r--r-- 2011-07-27 03:42:40
Edit Download
11.22 KB lrw-r--r-- 2011-08-05 20:18:14
Edit Download
4.65 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
10.18 KB lrw-r--r-- 2013-12-22 04:38:28
Edit Download
1.59 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).