mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
a106278e54
commit
8395d5a7c3
2 changed files with 28 additions and 5 deletions
16
lib/csv.gemspec
Normal file
16
lib/csv.gemspec
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue