diff options
-rw-r--r-- | lib/net/ftp.rb | 1 | ||||
-rw-r--r-- | lib/net/ftp/net-ftp.gemspec | 12 | ||||
-rw-r--r-- | lib/net/ftp/version.rb | 5 |
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 |