diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 13:00:23 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 13:00:23 +0000 |
commit | 5d33dad16cc34c39e75f6e61fd469c69c86f8741 (patch) | |
tree | dbf1082cbf5e8f2031e71f0621620fef7b56562d /tool | |
parent | 759619ca864077a8508afcd04a514eb2ff629d3a (diff) | |
download | ruby-5d33dad16cc34c39e75f6e61fd469c69c86f8741.tar.gz |
* revert r38053 because it causes too many test failures.
if you've already installed r38053 or later, remove the installed
lib/ruby/gems/2.0.0 directory and reinstall this revision or later.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/rbinstall.rb | 97 |
1 files changed, 7 insertions, 90 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 322608d330..f5faccae32 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -562,95 +562,24 @@ module Gem src.sub!(/\A#.*/, '') eval(src, nil, path) end - - def to_ruby - <<-GEMSPEC -Gem::Specification.new do |s| - s.name = #{name.dump} - s.version = #{version.dump} - s.summary = #{summary.dump} - s.description = #{description.dump} - s.homepage = #{homepage.dump} - s.authors = #{authors.inspect} - s.email = #{email.inspect} - s.files = #{files.inspect} -end - GEMSPEC - end end end module RbInstall module Specs - class FileCollector - def initialize(base_dir) - @base_dir = base_dir - end - - def collect - ruby_libraries + built_libraries - end - - private - def type - /\/(ext|lib)?\/.*?\z/ =~ @base_dir - $1 - end - - def ruby_libraries - case type - when "ext" - prefix = "#{$extout}/common/" - base = "#{prefix}#{relative_base}" - when "lib" - base = @base_dir - prefix = base.sub(/lib\/.*?\z/, "") + "lib/" - end - - Dir.glob("#{base}{.rb,/**/*.rb}").collect do |ruby_source| - remove_prefix(prefix, ruby_source) - end - end - - def built_libraries - case type - when "ext" - prefix = "#{$extout}/#{CONFIG['arch']}/" - base = "#{prefix}#{relative_base}" - Dir.glob("#{base}{.so,/**/*.so}").collect do |built_library| - remove_prefix(prefix, built_library) - end - when "lib" - [] - end - end - - def relative_base - /\/#{Regexp.escape(type)}\/(.*?)\z/ =~ @base_dir - $1 - end - - def remove_prefix(prefix, string) - string.sub(/\A#{Regexp.escape(prefix)}/, "") - end - end - class Reader < Struct.new(:src) def gemspec @gemspec ||= begin - spec = Gem::Specification.load(src) || raise("invalid spec in #{src}") - file_collector = FileCollector.new(File.dirname(src)) - spec.files = file_collector.collect - spec + Gem::Specification.load(src) || raise("invalid spec in #{src}") end end def spec_source - @gemspec.to_ruby + File.read src end end - class Generator < Struct.new(:name, :base_dir, :src, :execs) + class Generator < Struct.new(:name, :src, :execs) def gemspec @gemspec ||= eval spec_source end @@ -662,7 +591,6 @@ Gem::Specification.new do |s| s.version = #{version.dump} s.summary = "This #{name} is bundled with Ruby" s.executables = #{execs.inspect} - s.files = #{files.inspect} end GEMSPEC end @@ -674,11 +602,6 @@ end } or return version.split(%r"=\s*", 2)[1].strip[/\A([\'\"])(.*?)\1/, 2] end - - def files - file_collector = FileCollector.new(base_dir) - file_collector.collect - end end end end @@ -692,9 +615,6 @@ install?(:ext, :comm, :gem) do prepare "default gems", gem_dir, directories spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0]) - default_spec_dir = "#{spec_dir}/default" - makedirs(default_spec_dir) - gems = {} File.foreach(File.join(srcdir, "defs/default_gems")) do |line| line.chomp! @@ -704,12 +624,11 @@ install?(:ext, :comm, :gem) do line.scan(/\G\s*([^\[\]\s]+|\[([^\[\]]*)\])/) do words << ($2 ? $2.split : $1) end - name, base_dir, src, execs = *words - next unless name and base_dir and src + name, src, execs = *words + next unless name and src src = File.join(srcdir, src) - base_dir = File.join(srcdir, base_dir) - specgen = RbInstall::Specs::Generator.new(name, base_dir, src, execs || []) + specgen = RbInstall::Specs::Generator.new(name, src, execs || []) gems[name] ||= specgen end @@ -720,12 +639,10 @@ install?(:ext, :comm, :gem) do gems.sort.each do |name, specgen| gemspec = specgen.gemspec - base_dir = specgen.src.sub(/\A#{Regexp.escape(srcdir)}\//, "") full_name = "#{gemspec.name}-#{gemspec.version}" puts "#{" "*30}#{gemspec.name} #{gemspec.version}" - gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec") - open_for_install(gemspec_path, $data_mode) do + open_for_install(File.join(spec_dir, "#{full_name}.gemspec"), $data_mode) do specgen.spec_source end |