diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-01 09:12:53 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-01 09:12:53 +0000 |
commit | 55efe47d0e01343c9f4e33f9336754daf255bd51 (patch) | |
tree | 495557480ab84e75c6b81eceedf8b2d746d43b79 | |
parent | ca177dcf8e39614a918ca57aaec4c06b35ecd11e (diff) | |
download | ruby-55efe47d0e01343c9f4e33f9336754daf255bd51.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
-rw-r--r-- | lib/csv.gemspec | 16 | ||||
-rwxr-xr-x | tool/rbinstall.rb | 17 |
2 files changed, 28 insertions, 5 deletions
diff --git a/lib/csv.gemspec b/lib/csv.gemspec new file mode 100644 index 0000000000..3f8e4411b0 --- /dev/null +++ b/lib/csv.gemspec @@ -0,0 +1,16 @@ +Gem::Specification.new do |s| + s.name = "csv" + s.version = '0.0.1' + s.date = '2017-01-30' + s.summary = "CSV Reading and Writing" + s.description = "the CSV library began its life as FasterCSV." + + s.require_path = %w{lib} + s.files = %w{csv.rb} + s.required_ruby_version = ">= 2.5.0" + + s.authors = ["James Edward Gray II"] + s.email = [nil] + s.homepage = "https://www.ruby-lang.org" + s.license = "BSD-2-Clause" +end 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 |