Skip to content

Commit c94e359

Browse files
Let Automatiek vendor net-http and net-protocol
Allow target namespace to be an intermediate one with other constants behind it (like `Net` in `Net::HTTP`).
1 parent ef97ad3 commit c94e359

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tool/automatiek/gem.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ def namespace_files(folder)
100100
contents = File.read(file)
101101

102102
contents.gsub!(/module Kernel/, "module #{prefix}")
103-
contents.gsub!(/::#{namespace}/, "::#{prefix}::#{namespace}")
103+
contents.gsub!(/#{prefix}::#{namespace}::/, "#{namespace}::")
104+
contents.gsub!(/#{namespace}::/, "#{prefix}::#{namespace}::")
105+
contents.gsub!(/(\s)::#{namespace}/, '\1' + "::#{prefix}::#{namespace}")
104106
contents.gsub!(/(?<!\w|def |:)#{namespace}\b/, "#{prefix}::#{namespace}")
105107

106108
contents.gsub!(/^require (["'])#{Regexp.escape require_entrypoint}/, "require_relative \\1#{relative_require_target_from(file)}")

0 commit comments

Comments
 (0)