ruby-changes:20560
From: drbrain <ko1@a...>
Date: Fri, 22 Jul 2011 12:16:59 +0900 (JST)
Subject: [ruby-changes:20560] drbrain:r32608 (trunk): * tool/rbinstall.rb (default gems): Install executables into the fake
drbrain 2011-07-22 12:16:48 +0900 (Fri, 22 Jul 2011) New Revision: 32608 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32608 Log: * tool/rbinstall.rb (default gems): Install executables into the fake gem dir for Gem.bin_path. [#4485] Modified files: trunk/ChangeLog trunk/tool/rbinstall.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 32607) +++ ChangeLog (revision 32608) @@ -1,3 +1,8 @@ +Fri Jul 22 12:10:21 2011 Eric Hodel <drbrain@s...> + + * tool/rbinstall.rb (default gems): Install executables into the fake + gem dir for Gem.bin_path. [#4485] + Fri Jul 22 11:20:20 2011 Martin Bosslet <Martin.Bosslet@g...> * ext/openssl/ossl_digest.c: Check return value of EVP_DigestInit_ex. Index: tool/rbinstall.rb =================================================================== --- tool/rbinstall.rb (revision 32607) +++ tool/rbinstall.rb (revision 32608) @@ -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/