From c191b627cbe5a8a735fd9e6f1eaa3b92ea901f43 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Fri, 8 Nov 2024 11:57:18 -0500 Subject: [PATCH 1/9] Fix minor typo from 9997c1acee --- lib/uri/rfc3986_parser.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index 4000f13..0b5f0c4 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -142,25 +142,25 @@ def join(*uris) # :nodoc: # Compatibility for RFC2396 parser def extract(str, schemes = nil, &block) # :nodoc: - warn "URI::RFC3986_PARSER.extract is obsoleted. Use URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE + warn "URI::RFC3986_PARSER.extract is obsolete. Use URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE RFC2396_PARSER.extract(str, schemes, &block) end # Compatibility for RFC2396 parser def make_regexp(schemes = nil) # :nodoc: - warn "URI::RFC3986_PARSER.make_regexp is obsoleted. Use URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE + warn "URI::RFC3986_PARSER.make_regexp is obsolete. Use URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE RFC2396_PARSER.make_regexp(schemes) end # Compatibility for RFC2396 parser def escape(str, unsafe = nil) # :nodoc: - warn "URI::RFC3986_PARSER.escape is obsoleted. Use URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE + warn "URI::RFC3986_PARSER.escape is obsolete. Use URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str) end # Compatibility for RFC2396 parser def unescape(str, escaped = nil) # :nodoc: - warn "URI::RFC3986_PARSER.unescape is obsoleted. Use URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE + warn "URI::RFC3986_PARSER.unescape is obsolete. Use URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str) end From f0847c266cd5d427559a3bec1449fee6613e7d06 Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:34:33 +1100 Subject: [PATCH 2/9] Remove unused files from the gem package --- uri.gemspec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uri.gemspec b/uri.gemspec index 9cf0a71..9c4d43e 100644 --- a/uri.gemspec +++ b/uri.gemspec @@ -30,8 +30,11 @@ Gem::Specification.new do |spec| # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + gemspec = File.basename(__FILE__) spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + `git ls-files -z 2>#{IO::NULL}`.split("\x0").reject do |file| + (file == gemspec) || file.start_with?(*%w[bin/ test/ .github/ .gitignore Gemfile Rakefile]) + end end spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } From ee9a38701a3d49b7d56f7e7a1fd846333186d748 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 13 Nov 2024 12:01:06 +0900 Subject: [PATCH 3/9] Restore constants like URI::REGEXP::PATTERN::IPV6ADDR --- lib/uri/rfc2396_parser.rb | 7 +++++++ test/uri/test_common.rb | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb index a56ca34..c112b1b 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -536,4 +536,11 @@ def convert_to_uri(uri) end end # class Parser + + # Backward compatibility for URI::REGEXP::PATTERN::* + RFC2396_Parser.new.pattern.each_pair do |sym, str| + unless RFC2396_REGEXP::PATTERN.const_defined?(sym) + RFC2396_REGEXP::PATTERN.const_set(sym, str) + end + end end # module URI diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 176efb8..b1e3b2b 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -10,6 +10,10 @@ def setup def teardown end + class Foo + include URI::REGEXP::PATTERN + end + def test_fallback_constants orig_verbose = $VERBOSE $VERBOSE = nil @@ -19,6 +23,8 @@ def test_fallback_constants assert_equal URI::ABS_URI, URI::RFC2396_PARSER.regexp[:ABS_URI] assert_equal URI::PATTERN, URI::RFC2396_Parser::PATTERN assert_equal URI::REGEXP, URI::RFC2396_REGEXP + assert_equal URI::REGEXP::PATTERN, URI::RFC2396_REGEXP::PATTERN + assert_equal Foo::IPV4ADDR, URI::RFC2396_REGEXP::PATTERN::IPV4ADDR ensure $VERBOSE = orig_verbose end From 60a8bc15759065762fda95e83f383747904089a8 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 13 Nov 2024 12:02:46 +0900 Subject: [PATCH 4/9] Removed duplicated declare step for constants under the URI::RFC2396_REGEXP::PATTERN --- lib/uri/common.rb | 5 ----- test/uri/test_common.rb | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index fe8475f..f13ff1a 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -31,11 +31,6 @@ def self.parser=(parser = RFC3986_PARSER) if Parser == RFC2396_Parser const_set("REGEXP", URI::RFC2396_REGEXP) const_set("PATTERN", URI::RFC2396_REGEXP::PATTERN) - Parser.new.pattern.each_pair do |sym, str| - unless REGEXP::PATTERN.const_defined?(sym) - REGEXP::PATTERN.const_set(sym, str) - end - end end Parser.new.regexp.each_pair do |sym, str| diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index b1e3b2b..e96f819 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -40,6 +40,7 @@ def test_parser_switch assert defined?(URI::REGEXP) assert defined?(URI::PATTERN) assert defined?(URI::PATTERN::ESCAPED) + assert defined?(URI::REGEXP::PATTERN::IPV6ADDR) URI.parser = URI::RFC3986_PARSER From a0dd612e9070c979f20ccf4308f6aa10690c1d68 Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:20:46 +1100 Subject: [PATCH 5/9] Remove rakelib/ dir from gem also --- uri.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uri.gemspec b/uri.gemspec index 9c4d43e..0d0f897 100644 --- a/uri.gemspec +++ b/uri.gemspec @@ -33,7 +33,7 @@ Gem::Specification.new do |spec| gemspec = File.basename(__FILE__) spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do `git ls-files -z 2>#{IO::NULL}`.split("\x0").reject do |file| - (file == gemspec) || file.start_with?(*%w[bin/ test/ .github/ .gitignore Gemfile Rakefile]) + (file == gemspec) || file.start_with?(*%w[bin/ test/ rakelib/ .github/ .gitignore Gemfile Rakefile]) end end spec.bindir = "exe" From 57ee11f55f34bd89097fae12839d565b20fa6ca1 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 13 Nov 2024 14:03:06 +0900 Subject: [PATCH 6/9] Don't use bundle exec --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index f0e6b5d..1d70fe5 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -30,7 +30,7 @@ jobs: uses: actions/configure-pages@v5 - name: Build with RDoc # Outputs to the './_site' directory by default - run: bundle exec rake rdoc + run: rake rdoc - name: Upload artifact uses: actions/upload-pages-artifact@v3 From 0a042e862650f085bc7bc55f5a1cdcea52b486e4 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 13 Nov 2024 14:05:50 +0900 Subject: [PATCH 7/9] Fixed rake rdoc --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 19de93e..3935fdf 100644 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,7 @@ require "rdoc/task" RDoc::Task.new do |doc| doc.main = "README.md" doc.title = "URI - handle Uniform Resource Identifiers" - doc.rdoc_files = FileList.new %w[lib README.md LICENSE.txt] + doc.rdoc_files = FileList.new %w[lib README.md BSDL COPYING] doc.rdoc_dir = "_site" # for github pages end From b6f583369a2c0f31a8aeff488d1e9c0bf05edac6 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 14 Nov 2024 11:58:08 +0900 Subject: [PATCH 8/9] Check existence constants only URI module --- lib/uri/common.rb | 2 +- lib/uri/rfc2396_parser.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index f13ff1a..c3fe0b4 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -34,7 +34,7 @@ def self.parser=(parser = RFC3986_PARSER) end Parser.new.regexp.each_pair do |sym, str| - remove_const(sym) if const_defined?(sym) + remove_const(sym) if const_defined?(sym, false) const_set(sym, str) end end diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb index c112b1b..0336366 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -539,7 +539,7 @@ def convert_to_uri(uri) # Backward compatibility for URI::REGEXP::PATTERN::* RFC2396_Parser.new.pattern.each_pair do |sym, str| - unless RFC2396_REGEXP::PATTERN.const_defined?(sym) + unless RFC2396_REGEXP::PATTERN.const_defined?(sym, false) RFC2396_REGEXP::PATTERN.const_set(sym, str) end end From e46960a467f2ed398731286ec78b899e1a01655f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 14 Nov 2024 12:48:33 +0900 Subject: [PATCH 9/9] Bump up v1.0.2 --- lib/uri/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uri/version.rb b/lib/uri/version.rb index e74ddec..59f1c82 100644 --- a/lib/uri/version.rb +++ b/lib/uri/version.rb @@ -1,6 +1,6 @@ module URI # :stopdoc: - VERSION_CODE = '010001'.freeze + VERSION_CODE = '010002'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end