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

ruby-changes:62412

From: Nobuyoshi <ko1@a...>
Date: Tue, 28 Jul 2020 15:14:40 +0900 (JST)
Subject: [ruby-changes:62412] 7fb12be99f (master): [ruby/net-ftp] Moved Net::Ftp::Version to Net::FTP

https://git.ruby-lang.org/ruby.git/commit/?id=7fb12be99f

From 7fb12be99fecc5029d540924fc25a1457472451c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 27 Jul 2020 15:52:42 +0900
Subject: [ruby/net-ftp] Moved Net::Ftp::Version to Net::FTP

On case-insensitive filesystem, generated Net/FTP.html is
overwritten by Net/Ftp.html.

https://github.com/ruby/net-ftp/commit/14a6ff5134

diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 58521b7..aff9e7e 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -85,6 +85,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L85
     end
 
     # :stopdoc:
+    VERSION = "0.1.0"
     FTP_PORT = 21
     CRLF = "\r\n"
     DEFAULT_BLOCKSIZE = BufferedIO::BUFSIZE
diff --git a/lib/net/ftp/net-ftp.gemspec b/lib/net/ftp/net-ftp.gemspec
index 78c7b73..6031ce7 100644
--- a/lib/net/ftp/net-ftp.gemspec
+++ b/lib/net/ftp/net-ftp.gemspec
@@ -1,12 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/ftp/net-ftp.gemspec#L1
-begin
-  require_relative 'lib/net/ftp/version'
-rescue LoadError # Fallback to load version file in ruby core repository
-  require_relative "version"
+name = File.basename(__FILE__, ".gemspec")
+version = nil
+["lib", "../.."].find do |dir|
+  version = File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
+    /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
+  end rescue nil
 end
 
 Gem::Specification.new do |spec|
   spec.name          = "net-ftp"
-  spec.version       = Net::Ftp::VERSION
+  spec.version       = version
   spec.authors       = ["Shugo Maeda"]
   spec.email         = ["shugo@r..."]
 
diff --git a/lib/net/ftp/version.rb b/lib/net/ftp/version.rb
deleted file mode 100644
index 865bf44..0000000
--- a/lib/net/ftp/version.rb
+++ /dev/null
@@ -1,5 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/lib/net/ftp/net-ftp.gemspec#L0
-module Net
-  module Ftp
-    VERSION = "0.1.0"
-  end
-end
-- 
cgit v0.10.2


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

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