[前][次][番号順一覧][スレッド一覧]

ruby-changes:20563

From: drbrain <ko1@a...>
Date: Fri, 22 Jul 2011 13:27:52 +0900 (JST)
Subject: [ruby-changes:20563] drbrain:r32611 (ruby_1_9_3): * tool/rbinstall.rb (default gems): Install executables into the fake

drbrain	2011-07-22 13:26:37 +0900 (Fri, 22 Jul 2011)

  New Revision: 32611

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32611

  Log:
    * tool/rbinstall.rb (default gems):  Install executables into the fake
      gem dir for Gem.bin_path.  [Ruby 1.9 - Bug #4485]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/tool/rbinstall.rb

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 32610)
+++ ruby_1_9_3/ChangeLog	(revision 32611)
@@ -1,3 +1,8 @@
+Fri Jul 22 13:20:33 2011  Eric Hodel  <drbrain@s...>
+
+	* tool/rbinstall.rb (default gems):  Install executables into the fake
+	  gem dir for Gem.bin_path.  [Ruby 1.9 - Bug #4485]
+
 Fri Jul 22 13:03:12 2011  Martin Bosslet  <Martin.Bosslet@g...>
 
 	* backport r32609 from trunk.
Index: ruby_1_9_3/tool/rbinstall.rb
===================================================================
--- ruby_1_9_3/tool/rbinstall.rb	(revision 32610)
+++ ruby_1_9_3/tool/rbinstall.rb	(revision 32611)
@@ -534,32 +534,47 @@
 install?(:ext, :comm, :gem) do
   $:.unshift(File.join(srcdir, "lib"))
   require("rubygems.rb")
-  gpath = Gem.default_dir
-  directories = Gem.ensure_gem_subdirectories(gpath)
-  prepare "default gems", gpath, directories
+  gem_dir = Gem.default_dir
+  directories = Gem.ensure_gem_subdirectories(gem_dir)
+  prepare "default gems", gem_dir, directories
 
-  destdir = File.join(gpath, directories.grep(/^spec/)[0])
+  spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
   default_gems = [
-    ['rake', 'lib/rake/version.rb'],
-    ['rdoc', 'lib/rdoc.rb'],
+    ['rake', 'lib/rake/version.rb', ['rake']],
+    ['rdoc', 'lib/rdoc.rb', ['rdoc', 'ri']],
     ['minitest', 'lib/minitest/unit.rb'],
     ['json', 'ext/json/lib/json/version.rb'],
     ['io-console', 'ext/io/console/io-console.gemspec'],
   ]
-  default_gems.each do |name, src|
+
+  default_gems.each do |name, src, execs|
+    execs ||= []
     src = File.join(srcdir, src)
     version = open(src) {|f| f.find {|s| /^\s*\w*VERSION\s*=(?!=)/ =~ s}} or next
     version = version.split(%r"=\s*", 2)[1].strip[/\A([\'\"])(.*?)\1/, 2]
+    full_name = "#{name}-#{version}"
+
     puts "#{" "*30}#{name} #{version}"
-    open_for_install(File.join(destdir, "#{name}-#{version}.gemspec"), $data_mode) do
+    open_for_install(File.join(spec_dir, "#{full_name}.gemspec"), $data_mode) do
       <<-GEMSPEC
 Gem::Specification.new do |s|
   s.name = #{name.dump}
   s.version = #{version.dump}
   s.summary = "This #{name} is bundled with Ruby"
+  s.executables = #{execs.inspect}
 end
       GEMSPEC
     end
+
+    unless execs.empty? then
+      bin_dir = File.join(gem_dir, 'gems', full_name, 'bin')
+      makedirs(bin_dir)
+
+      execs.each do |exec|
+        exec = File.join(srcdir, 'bin', exec)
+        install(exec, bin_dir, :mode => $prog_mode)
+      end
+    end
   end
 end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]