summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-27 15:52:42 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-28 15:14:01 +0900
commit7fb12be99fecc5029d540924fc25a1457472451c (patch)
treea80194e5159fdbcb6ef35e9eba4449ada53e773b
parentda31900d9d9e4e9dcd6381a23dd863b18fe65e3d (diff)
[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
-rw-r--r--lib/net/ftp.rb1
-rw-r--r--lib/net/ftp/net-ftp.gemspec12
-rw-r--r--lib/net/ftp/version.rb5
3 files changed, 8 insertions, 10 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 58521b76c5..aff9e7ec60 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -85,6 +85,7 @@ module Net
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 78c7b7369d..6031ce7ccf 100644
--- a/lib/net/ftp/net-ftp.gemspec
+++ b/lib/net/ftp/net-ftp.gemspec
@@ -1,12 +1,14 @@
-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@ruby-lang.org"]
diff --git a/lib/net/ftp/version.rb b/lib/net/ftp/version.rb
deleted file mode 100644
index 865bf44111..0000000000
--- a/lib/net/ftp/version.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module Net
- module Ftp
- VERSION = "0.1.0"
- end
-end