зеркало из https://github.com/github/ruby.git
* re-added r38053 that is reverted by r38061. Problems by r38053
are resolved by r38096. r38096 removed GEM_SKIP configuration. The below is ChangeLog of r38053: * defs/default_gems: Add base directory column. * tool/rbinstall.rb: - Install .gemspecs of default gem to #{GEM_HOME}/specifications/default/. - Update files parameter of .gemspecs by relative path from library directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3f50943b03
Коммит
bfd5921e5d
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
Sat Dec 1 12:22:17 2012 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
|
* re-added r38053 that is reverted by r38061. Problems by r38053
|
||||||
|
are resolved by r38096. r38096 removed GEM_SKIP configuration.
|
||||||
|
|
||||||
|
The below is ChangeLog of r38053:
|
||||||
|
|
||||||
|
* defs/default_gems: Add base directory column.
|
||||||
|
|
||||||
|
* tool/rbinstall.rb:
|
||||||
|
- Install .gemspecs of default gem to
|
||||||
|
#{GEM_HOME}/specifications/default/.
|
||||||
|
- Update files parameter of .gemspecs by relative path from
|
||||||
|
library directory.
|
||||||
|
|
||||||
Sat Dec 1 11:09:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
Sat Dec 1 11:09:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
* variable.c (rb_class_path_no_cache): add a function to get the class
|
* variable.c (rb_class_path_no_cache): add a function to get the class
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# gem versioning file [executable files under bin]
|
# gem base directory versioning file [executable files under bin]
|
||||||
rake lib/rake/version.rb [rake]
|
rake lib/rake lib/rake/version.rb [rake]
|
||||||
rdoc lib/rdoc.rb [rdoc ri]
|
rdoc lib/rdoc lib/rdoc.rb [rdoc ri]
|
||||||
minitest lib/minitest/unit.rb
|
minitest lib/minitest lib/minitest/unit.rb
|
||||||
json ext/json/lib/json/version.rb
|
json ext/json ext/json/lib/json/version.rb
|
||||||
|
|
|
@ -562,24 +562,95 @@ module Gem
|
||||||
src.sub!(/\A#.*/, '')
|
src.sub!(/\A#.*/, '')
|
||||||
eval(src, nil, path)
|
eval(src, nil, path)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
module RbInstall
|
module RbInstall
|
||||||
module Specs
|
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)
|
class Reader < Struct.new(:src)
|
||||||
def gemspec
|
def gemspec
|
||||||
@gemspec ||= begin
|
@gemspec ||= begin
|
||||||
Gem::Specification.load(src) || raise("invalid spec in #{src}")
|
spec = Gem::Specification.load(src) || raise("invalid spec in #{src}")
|
||||||
|
file_collector = FileCollector.new(File.dirname(src))
|
||||||
|
spec.files = file_collector.collect
|
||||||
|
spec
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def spec_source
|
def spec_source
|
||||||
File.read src
|
@gemspec.to_ruby
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Generator < Struct.new(:name, :src, :execs)
|
class Generator < Struct.new(:name, :base_dir, :src, :execs)
|
||||||
def gemspec
|
def gemspec
|
||||||
@gemspec ||= eval spec_source
|
@gemspec ||= eval spec_source
|
||||||
end
|
end
|
||||||
|
@ -591,6 +662,7 @@ Gem::Specification.new do |s|
|
||||||
s.version = #{version.dump}
|
s.version = #{version.dump}
|
||||||
s.summary = "This #{name} is bundled with Ruby"
|
s.summary = "This #{name} is bundled with Ruby"
|
||||||
s.executables = #{execs.inspect}
|
s.executables = #{execs.inspect}
|
||||||
|
s.files = #{files.inspect}
|
||||||
end
|
end
|
||||||
GEMSPEC
|
GEMSPEC
|
||||||
end
|
end
|
||||||
|
@ -602,6 +674,11 @@ end
|
||||||
} or return
|
} or return
|
||||||
version.split(%r"=\s*", 2)[1].strip[/\A([\'\"])(.*?)\1/, 2]
|
version.split(%r"=\s*", 2)[1].strip[/\A([\'\"])(.*?)\1/, 2]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def files
|
||||||
|
file_collector = FileCollector.new(base_dir)
|
||||||
|
file_collector.collect
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -615,6 +692,9 @@ install?(:ext, :comm, :gem) do
|
||||||
prepare "default gems", gem_dir, directories
|
prepare "default gems", gem_dir, directories
|
||||||
|
|
||||||
spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
|
spec_dir = File.join(gem_dir, directories.grep(/^spec/)[0])
|
||||||
|
default_spec_dir = "#{spec_dir}/default"
|
||||||
|
makedirs(default_spec_dir)
|
||||||
|
|
||||||
gems = {}
|
gems = {}
|
||||||
File.foreach(File.join(srcdir, "defs/default_gems")) do |line|
|
File.foreach(File.join(srcdir, "defs/default_gems")) do |line|
|
||||||
line.chomp!
|
line.chomp!
|
||||||
|
@ -624,11 +704,12 @@ install?(:ext, :comm, :gem) do
|
||||||
line.scan(/\G\s*([^\[\]\s]+|\[([^\[\]]*)\])/) do
|
line.scan(/\G\s*([^\[\]\s]+|\[([^\[\]]*)\])/) do
|
||||||
words << ($2 ? $2.split : $1)
|
words << ($2 ? $2.split : $1)
|
||||||
end
|
end
|
||||||
name, src, execs = *words
|
name, base_dir, src, execs = *words
|
||||||
next unless name and src
|
next unless name and base_dir and src
|
||||||
|
|
||||||
src = File.join(srcdir, src)
|
src = File.join(srcdir, src)
|
||||||
specgen = RbInstall::Specs::Generator.new(name, src, execs || [])
|
base_dir = File.join(srcdir, base_dir)
|
||||||
|
specgen = RbInstall::Specs::Generator.new(name, base_dir, src, execs || [])
|
||||||
gems[name] ||= specgen
|
gems[name] ||= specgen
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -639,10 +720,12 @@ install?(:ext, :comm, :gem) do
|
||||||
|
|
||||||
gems.sort.each do |name, specgen|
|
gems.sort.each do |name, specgen|
|
||||||
gemspec = specgen.gemspec
|
gemspec = specgen.gemspec
|
||||||
|
base_dir = specgen.src.sub(/\A#{Regexp.escape(srcdir)}\//, "")
|
||||||
full_name = "#{gemspec.name}-#{gemspec.version}"
|
full_name = "#{gemspec.name}-#{gemspec.version}"
|
||||||
|
|
||||||
puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
|
puts "#{" "*30}#{gemspec.name} #{gemspec.version}"
|
||||||
open_for_install(File.join(spec_dir, "#{full_name}.gemspec"), $data_mode) do
|
gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec")
|
||||||
|
open_for_install(gemspec_path, $data_mode) do
|
||||||
specgen.spec_source
|
specgen.spec_source
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче