aboutsummaryrefslogtreecommitdiffstats
path: root/tool/rbinstall.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-01 09:12:53 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-01 09:12:53 +0000
commit8395d5a7c33b1a539d42ecabadd094f0871397a7 (patch)
tree495557480ab84e75c6b81eceedf8b2d746d43b79 /tool/rbinstall.rb
parenta106278e545119aea7e3f5fe94dde604e1a8a324 (diff)
downloadruby-8395d5a7c33b1a539d42ecabadd094f0871397a7.tar.gz
Prepare to make CSV module to default gem.
* lib/csv.gemspec: initial gemspec for csv gem. * tool/rbinstall.rb: support gemspec located under lib direcotry like `lib/foo.gemspec` [Feature #13177] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/rbinstall.rb')
-rwxr-xr-xtool/rbinstall.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 854fa07e14..d242002b18 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -610,8 +610,9 @@ end
module RbInstall
module Specs
class FileCollector
- def initialize(base_dir)
- @base_dir = base_dir
+ def initialize(gemspec)
+ @gemspec = gemspec
+ @base_dir = File.dirname(gemspec)
end
def collect
@@ -634,8 +635,12 @@ module RbInstall
prefix = base.sub(/lib\/.*?\z/, "") + "lib/"
end
- Dir.glob("#{base}{.rb,/**/*.rb}").collect do |ruby_source|
- remove_prefix(prefix, ruby_source)
+ if base
+ Dir.glob("#{base}{.rb,/**/*.rb}").collect do |ruby_source|
+ remove_prefix(prefix, ruby_source)
+ end
+ else
+ [remove_prefix(File.dirname(@gemspec) + '/', @gemspec.gsub(/gemspec/, 'rb'))]
end
end
@@ -650,6 +655,8 @@ module RbInstall
end
when "lib"
[]
+ else
+ []
end
end
@@ -753,7 +760,7 @@ install?(:ext, :comm, :gem) do
gems = Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").map {|src|
spec = Gem::Specification.load(src) || raise("invalid spec in #{src}")
- file_collector = RbInstall::Specs::FileCollector.new(File.dirname(src))
+ file_collector = RbInstall::Specs::FileCollector.new(src)
files = file_collector.collect
next if files.empty?
spec.files = files