summaryrefslogtreecommitdiff
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
parenta106278e545119aea7e3f5fe94dde604e1a8a324 (diff)
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.gemspec16
-rwxr-xr-xtool/rbinstall.rb17
2 files changed, 28 insertions, 5 deletions
diff --git a/lib/csv.gemspec b/lib/csv.gemspec
new file mode 100644
index 00000000000..3f8e4411b00
--- /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 854fa07e140..d242002b185 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