From aaff971e017e0cf6edf37c4ec265ede3d04c686f Mon Sep 17 00:00:00 2001 From: kou Date: Thu, 17 Jan 2013 13:20:12 +0000 Subject: [PATCH] * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Remove .time dependency from *.rb install target. It causes needless *.rb install. [Bug #7698] [ruby-core:51437] Reported by Tadashi Saito. Thanks!!! * test/rubygems/test_gem_installer.rb (TestGemInstaller#test_install_extension_and_script): Add a test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 10 ++++++++++ lib/rubygems/ext/builder.rb | 1 + test/rubygems/test_gem_installer.rb | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1ecccdfbae..28af8d48ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Jan 17 22:10:35 2013 Kouhei Sutou + + * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Remove + .time dependency from *.rb install target. It causes needless + *.rb install. [Bug #7698] [ruby-core:51437] + Reported by Tadashi Saito. Thanks!!! + * test/rubygems/test_gem_installer.rb + (TestGemInstaller#test_install_extension_and_script): Add a test + for the above change. + Thu Jan 17 21:08:20 2013 Kouhei Sutou * eval.c: Fix a typo in ruby_finalize() documentation. diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index e0e7387d9c..81b96e84a9 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -19,6 +19,7 @@ class Gem::Ext::Builder mf = Gem.read_binary 'Makefile' mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}") mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}") + mf = mf.gsub(/\s*\S+\.time$/, "") File.open('Makefile', 'wb') {|f| f.print mf} diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index c531c60b29..40345048ac 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -964,6 +964,33 @@ load Gem.bin_path('a', 'executable', version) assert_match %r|I am a shiny gem!|, @ui.output end + def test_install_extension_and_script + @spec.extensions << "extconf.rb" + write_file File.join(@tempdir, "extconf.rb") do |io| + io.write <<-RUBY + require "mkmf" + create_makefile("#{@spec.name}") + RUBY + end + + rb = File.join("lib", "#{@spec.name}.rb") + @spec.files += [rb] + write_file File.join(@tempdir, rb) do |io| + io.write <<-RUBY + # #{@spec.name}.rb + RUBY + end + + assert !File.exist?(File.join(@spec.gem_dir, rb)) + use_ui @ui do + path = Gem::Package.build @spec + + @installer = Gem::Installer.new path + @installer.install + end + assert File.exist?(File.join(@spec.gem_dir, rb)) + end + def test_installation_satisfies_dependency_eh quick_spec 'a'