[前][次][番号順一覧][スレッド一覧]

ruby-changes:45418

From: hsbt <ko1@a...>
Date: Wed, 1 Feb 2017 18:12:58 +0900 (JST)
Subject: [ruby-changes:45418] hsbt:r57491 (trunk): Prepare to make CSV module to default gem.

hsbt	2017-02-01 18:12:53 +0900 (Wed, 01 Feb 2017)

  New Revision: 57491

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57491

  Log:
    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]

  Added files:
    trunk/lib/csv.gemspec
  Modified files:
    trunk/tool/rbinstall.rb
Index: lib/csv.gemspec
===================================================================
--- lib/csv.gemspec	(revision 0)
+++ lib/csv.gemspec	(revision 57491)
@@ -0,0 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/lib/csv.gemspec#L1
+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
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 57490)
+++ tool/rbinstall.rb	(revision 57491)
@@ -610,8 +610,9 @@ end https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L610
 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 https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L635
           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 https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L655
           end
         when "lib"
           []
+        else
+          []
         end
       end
 
@@ -753,7 +760,7 @@ install?(:ext, :comm, :gem) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L760
 
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]