mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
74867e2dc1
commit
5400811db9
Notes:
git
2020-05-08 14:14:19 +09:00
1 changed files with 25 additions and 63 deletions
|
@ -20,39 +20,17 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||||
@cmd = Gem::Commands::SetupCommand.new
|
@cmd = Gem::Commands::SetupCommand.new
|
||||||
@cmd.options[:prefix] = @install_dir
|
@cmd.options[:prefix] = @install_dir
|
||||||
|
|
||||||
FileUtils.mkdir_p 'bin'
|
filelist = %w[
|
||||||
FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org'
|
bin/gem
|
||||||
|
lib/rubygems.rb
|
||||||
|
lib/rubygems/test_case.rb
|
||||||
|
lib/rubygems/ssl_certs/rubygems.org/foo.pem
|
||||||
|
bundler/exe/bundle
|
||||||
|
bundler/lib/bundler.rb
|
||||||
|
bundler/lib/bundler/b.rb
|
||||||
|
]
|
||||||
|
|
||||||
File.open 'bin/gem', 'w' do |io|
|
create_dummy_files(filelist)
|
||||||
io.puts '# gem'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open 'lib/rubygems.rb', 'w' do |io|
|
|
||||||
io.puts '# rubygems.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open 'lib/rubygems/test_case.rb', 'w' do |io|
|
|
||||||
io.puts '# test_case.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io|
|
|
||||||
io.puts '# foo.pem'
|
|
||||||
end
|
|
||||||
|
|
||||||
FileUtils.mkdir_p 'bundler/exe'
|
|
||||||
FileUtils.mkdir_p 'bundler/lib/bundler'
|
|
||||||
|
|
||||||
File.open 'bundler/exe/bundle', 'w' do |io|
|
|
||||||
io.puts '# bundle'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open 'bundler/lib/bundler.rb', 'w' do |io|
|
|
||||||
io.puts '# bundler.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open 'bundler/lib/bundler/b.rb', 'w' do |io|
|
|
||||||
io.puts '# b.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
gemspec = Gem::Specification.new
|
gemspec = Gem::Specification.new
|
||||||
gemspec.author = "Us"
|
gemspec.author = "Us"
|
||||||
|
@ -276,42 +254,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||||
old_format_rb = File.join lib_rubygems, 'format.rb'
|
old_format_rb = File.join lib_rubygems, 'format.rb'
|
||||||
old_bundler_c_rb = File.join lib_bundler, 'c.rb'
|
old_bundler_c_rb = File.join lib_bundler, 'c.rb'
|
||||||
|
|
||||||
FileUtils.mkdir_p lib_rubygems_defaults
|
files_that_go = [old_builder_rb, old_format_rb, old_bundler_c_rb]
|
||||||
FileUtils.mkdir_p lib_bundler
|
files_that_stay = [securerandom_rb, engine_defaults_rb, os_defaults_rb]
|
||||||
|
|
||||||
File.open securerandom_rb, 'w' do |io|
|
create_dummy_files(files_that_go + files_that_stay)
|
||||||
io.puts '# securerandom.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open old_builder_rb, 'w' do |io|
|
|
||||||
io.puts '# builder.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open old_format_rb, 'w' do |io|
|
|
||||||
io.puts '# format.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open old_bundler_c_rb, 'w' do |io|
|
|
||||||
io.puts '# c.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open engine_defaults_rb, 'w' do |io|
|
|
||||||
io.puts '# jruby.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
File.open os_defaults_rb, 'w' do |io|
|
|
||||||
io.puts '# operating_system.rb'
|
|
||||||
end
|
|
||||||
|
|
||||||
@cmd.remove_old_lib_files lib
|
@cmd.remove_old_lib_files lib
|
||||||
|
|
||||||
refute_path_exists old_builder_rb
|
files_that_go.each {|file| refute_path_exists file }
|
||||||
refute_path_exists old_format_rb
|
|
||||||
refute_path_exists old_bundler_c_rb
|
|
||||||
|
|
||||||
assert_path_exists securerandom_rb
|
files_that_stay.each {|file| assert_path_exists file }
|
||||||
assert_path_exists engine_defaults_rb
|
|
||||||
assert_path_exists os_defaults_rb
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_release_notes
|
def test_show_release_notes
|
||||||
|
@ -365,6 +317,16 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def create_dummy_files(list)
|
||||||
|
list.each do |file|
|
||||||
|
FileUtils.mkdir_p File.dirname(file)
|
||||||
|
|
||||||
|
File.open file, 'w' do |io|
|
||||||
|
io.puts "# #{File.basename(file)}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def gem_install(name)
|
def gem_install(name)
|
||||||
gem = util_spec name do |s|
|
gem = util_spec name do |s|
|
||||||
s.executables = [name]
|
s.executables = [name]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue