diff --git a/lib/net/imap/net-imap.gemspec b/lib/net/net-imap.gemspec similarity index 94% rename from lib/net/imap/net-imap.gemspec rename to lib/net/net-imap.gemspec index 2426e0932d..7a4556e4aa 100644 --- a/lib/net/imap/net-imap.gemspec +++ b/lib/net/net-imap.gemspec @@ -1,7 +1,7 @@ # frozen_string_literal: true name = File.basename(__FILE__, ".gemspec") -version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir| +version = ["lib", Array.new(name.count("-"), "..").join("/")].find do |dir| break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line| /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 end rescue nil diff --git a/lib/net/pop/net-pop.gemspec b/lib/net/net-pop.gemspec similarity index 93% rename from lib/net/pop/net-pop.gemspec rename to lib/net/net-pop.gemspec index 90d594f14a..12e633cc77 100644 --- a/lib/net/pop/net-pop.gemspec +++ b/lib/net/net-pop.gemspec @@ -1,7 +1,7 @@ # frozen_string_literal: true name = File.basename(__FILE__, ".gemspec") -version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir| +version = ["lib", Array.new(name.count("-"), "..").join("/")].find do |dir| break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line| /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 end rescue nil diff --git a/lib/net/protocol/net-protocol.gemspec b/lib/net/net-protocol.gemspec similarity index 94% rename from lib/net/protocol/net-protocol.gemspec rename to lib/net/net-protocol.gemspec index a277c301d5..9653ddd378 100644 --- a/lib/net/protocol/net-protocol.gemspec +++ b/lib/net/net-protocol.gemspec @@ -1,7 +1,7 @@ # frozen_string_literal: true name = File.basename(__FILE__, ".gemspec") -version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir| +version = ["lib", Array.new(name.count("-"), "..").join("/")].find do |dir| break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line| /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 end rescue nil diff --git a/lib/net/smtp/net-smtp.gemspec b/lib/net/net-smtp.gemspec similarity index 93% rename from lib/net/smtp/net-smtp.gemspec rename to lib/net/net-smtp.gemspec index 4c8c07810b..c547beb754 100644 --- a/lib/net/smtp/net-smtp.gemspec +++ b/lib/net/net-smtp.gemspec @@ -1,7 +1,7 @@ # frozen_string_literal: true name = File.basename(__FILE__, ".gemspec") -version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir| +version = ["lib", Array.new(name.count("-"), "..").join("/")].find do |dir| break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line| /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 end rescue nil diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index e9c4b27d5b..af60185c3c 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -219,29 +219,25 @@ def sync_default_gems(gem) cp_r("#{upstream}/History.md", "ext/openssl") `git checkout ext/openssl/depend` when "net-pop" - rm_rf(%w[lib/net/pop.rb lib/net/pop test/net/pop]) + rm_rf(%w[lib/net/pop.rb lib/net/net-pop.gemspec test/net/pop]) cp_r("#{upstream}/lib/net/pop.rb", "lib/net") - cp_r("#{upstream}/lib/net/pop", "lib/net") cp_r("#{upstream}/test/net/pop", "test/net") - cp_r("#{upstream}/net-pop.gemspec", "lib/net/pop") + cp_r("#{upstream}/net-pop.gemspec", "lib/net") when "net-smtp" - rm_rf(%w[lib/net/smtp.rb lib/net/smtp test/net/smtp]) + rm_rf(%w[lib/net/smtp.rb lib/net/net-smtp.gemspec test/net/smtp]) cp_r("#{upstream}/lib/net/smtp.rb", "lib/net") - cp_r("#{upstream}/lib/net/smtp", "lib/net") cp_r("#{upstream}/test/net/smtp", "test/net") - cp_r("#{upstream}/net-smtp.gemspec", "lib/net/smtp") + cp_r("#{upstream}/net-smtp.gemspec", "lib/net") when "net-protocol" - rm_rf(%w[lib/net/protocol.rb lib/net/protocol test/net/protocol]) + rm_rf(%w[lib/net/protocol.rb lib/net/net-protocol.gemspec test/net/protocol]) cp_r("#{upstream}/lib/net/protocol.rb", "lib/net") - cp_r("#{upstream}/lib/net/protocol", "lib/net") cp_r("#{upstream}/test/net/protocol", "test/net") - cp_r("#{upstream}/net-protocol.gemspec", "lib/net/protocol") + cp_r("#{upstream}/net-protocol.gemspec", "lib/net") when "net-imap" - rm_rf(%w[lib/net/imap.rb lib/net/imap test/net/imap]) + rm_rf(%w[lib/net/imap.rb lib/net/net-imap.gemspec test/net/imap]) cp_r("#{upstream}/lib/net/imap.rb", "lib/net") - cp_r("#{upstream}/lib/net/imap", "lib/net") cp_r("#{upstream}/test/net/imap", "test/net") - cp_r("#{upstream}/net-imap.gemspec", "lib/net/imap") + cp_r("#{upstream}/net-imap.gemspec", "lib/net") when "net-ftp" rm_rf(%w[lib/net/ftp.rb lib/net/net-ftp.gemspec test/net/ftp]) cp_r("#{upstream}/lib/net/ftp.rb", "lib/net")