From 69116ff436b06e08f858487f2285b7c3e1ddb3c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 00:48:29 +0000 Subject: [PATCH 01/30] Bump actions/deploy-pages from 2 to 3 Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 2 to 3. - [Release notes](https://github.com/actions/deploy-pages/releases) - [Commits](https://github.com/actions/deploy-pages/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/deploy-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .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 a4f155a..6f51f54 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -43,4 +43,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v3 From fba4daa5ca6e9420c9874c1c7221791990776e50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 00:48:33 +0000 Subject: [PATCH 02/30] Bump actions/configure-pages from 3 to 4 Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 3 to 4. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](https://github.com/actions/configure-pages/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .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 a4f155a..74d8b5b 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -27,7 +27,7 @@ jobs: bundler-cache: true - name: Setup Pages id: pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - name: Build with RDoc # Outputs to the './_site' directory by default run: bundle exec rake rdoc From f3e5b0c97d98989f75929bb33e275ce5feb33fb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 00:19:22 +0000 Subject: [PATCH 03/30] Bump actions/upload-pages-artifact from 2 to 3 Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-pages-artifact/releases) - [Commits](https://github.com/actions/upload-pages-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-pages-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .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 8683e26..19aa794 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -32,7 +32,7 @@ jobs: # Outputs to the './_site' directory by default run: bundle exec rake rdoc - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + uses: actions/upload-pages-artifact@v3 deploy: environment: From 15f76263462b1bd4168a6a30df96965457a41357 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 00:19:27 +0000 Subject: [PATCH 04/30] Bump actions/deploy-pages from 3 to 4 Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 3 to 4. - [Release notes](https://github.com/actions/deploy-pages/releases) - [Commits](https://github.com/actions/deploy-pages/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/deploy-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .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 8683e26..203af73 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -43,4 +43,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v3 + uses: actions/deploy-pages@v4 From ac32aa005b283e036003989fb2e625cdde462a36 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Tue, 24 Oct 2023 13:26:03 -0700 Subject: [PATCH 05/30] Make URI#to_s prepend relative path with / if there is a host or port Otherwise, the path could be considered part of the host or port. This is better than modifying the path to make it absolute when a host or port is set. We could also raise for invalid paths when a host or port is set using check_path, but that results in weird errors, and won't catch issues (such as ftp allowing a relative path). Fixes [Bug #19916] --- lib/uri/generic.rb | 3 +++ test/uri/test_generic.rb | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index f3540a2..9ea2335 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -1364,6 +1364,9 @@ def to_s str << ':' str << @port.to_s end + if (@host || @port) && !@path.empty? && !@path.start_with?('/') + str << '/' + end str << @path if @query str << '?' diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index e661937..8209363 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -26,6 +26,17 @@ def test_to_s assert_equal "postgres:///foo", URI("postgres:///foo").to_s assert_equal "http:///foo", URI("http:///foo").to_s assert_equal "http:/foo", URI("http:/foo").to_s + + uri = URI('rel_path') + assert_equal "rel_path", uri.to_s + uri.scheme = 'http' + assert_equal "http:rel_path", uri.to_s + uri.host = 'h' + assert_equal "http://h/rel_path", uri.to_s + uri.port = 8080 + assert_equal "http://h:8080/rel_path", uri.to_s + uri.host = nil + assert_equal "http::8080/rel_path", uri.to_s end def test_parse From feb8e0dd731c573e1b4384138b2140040f2eefdc Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 19 Jan 2024 20:09:32 +0900 Subject: [PATCH 06/30] Removed commented-out code --- lib/uri/generic.rb | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index 9ea2335..baa6a4c 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -1402,19 +1402,6 @@ def eql?(oth) self.component_ary.eql?(oth.component_ary) end -=begin - ---- URI::Generic#===(oth) - -=end -# def ===(oth) -# raise NotImplementedError -# end - -=begin -=end - - # Returns an Array of the components defined from the COMPONENT Array. def component_ary component.collect do |x| From ad2591f0d190eecfbc0f85e5d98bdd8cb17dc5b9 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 20 Feb 2024 16:57:45 +0900 Subject: [PATCH 07/30] Use https instead of http --- lib/uri.rb | 18 +++++++++--------- lib/uri/ftp.rb | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/uri.rb b/lib/uri.rb index 59a7c4a..cd8083b 100644 --- a/lib/uri.rb +++ b/lib/uri.rb @@ -1,6 +1,6 @@ # frozen_string_literal: false # URI is a module providing classes to handle Uniform Resource Identifiers -# (RFC2396[http://tools.ietf.org/html/rfc2396]). +# (RFC2396[https://datatracker.ietf.org/doc/html/rfc2396]). # # == Features # @@ -47,14 +47,14 @@ # A good place to view an RFC spec is http://www.ietf.org/rfc.html. # # Here is a list of all related RFC's: -# - RFC822[http://tools.ietf.org/html/rfc822] -# - RFC1738[http://tools.ietf.org/html/rfc1738] -# - RFC2255[http://tools.ietf.org/html/rfc2255] -# - RFC2368[http://tools.ietf.org/html/rfc2368] -# - RFC2373[http://tools.ietf.org/html/rfc2373] -# - RFC2396[http://tools.ietf.org/html/rfc2396] -# - RFC2732[http://tools.ietf.org/html/rfc2732] -# - RFC3986[http://tools.ietf.org/html/rfc3986] +# - RFC822[https://datatracker.ietf.org/doc/html/rfc822] +# - RFC1738[https://datatracker.ietf.org/doc/html/rfc1738] +# - RFC2255[https://datatracker.ietf.org/doc/html/rfc2255] +# - RFC2368[https://datatracker.ietf.org/doc/html/rfc2368] +# - RFC2373[https://datatracker.ietf.org/doc/html/rfc2373] +# - RFC2396[https://datatracker.ietf.org/doc/html/rfc2396] +# - RFC2732[https://datatracker.ietf.org/doc/html/rfc2732] +# - RFC3986[https://datatracker.ietf.org/doc/html/rfc3986] # # == Class tree # diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index abad613..1c75e24 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -17,7 +17,7 @@ module URI # This class will be redesigned because of difference of implementations; # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it # is a good summary about the de facto spec. - # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04 + # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04 # class FTP < Generic # A Default port of 21 for URI::FTP. From c7f818378b7fb7e7cea8de38b93c3532f3cee264 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 28 Mar 2024 09:45:01 +0900 Subject: [PATCH 08/30] Use www.rfc-editor.org for RFC text. We use the following site for that now: * https://tools.ietf.org/ or http * https://datatracker.ietf.org or http Today, IETF said the official site of RFC is www.rfc-editor.org. FYI: https://authors.ietf.org/en/references-in-rfcxml I replaced them to www.rfc-editor.org. --- lib/uri.rb | 18 +++++++++--------- lib/uri/generic.rb | 2 +- lib/uri/http.rb | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/uri.rb b/lib/uri.rb index cd8083b..dfdb052 100644 --- a/lib/uri.rb +++ b/lib/uri.rb @@ -1,6 +1,6 @@ # frozen_string_literal: false # URI is a module providing classes to handle Uniform Resource Identifiers -# (RFC2396[https://datatracker.ietf.org/doc/html/rfc2396]). +# (RFC2396[https://www.rfc-editor.org/rfc/rfc2396]). # # == Features # @@ -47,14 +47,14 @@ # A good place to view an RFC spec is http://www.ietf.org/rfc.html. # # Here is a list of all related RFC's: -# - RFC822[https://datatracker.ietf.org/doc/html/rfc822] -# - RFC1738[https://datatracker.ietf.org/doc/html/rfc1738] -# - RFC2255[https://datatracker.ietf.org/doc/html/rfc2255] -# - RFC2368[https://datatracker.ietf.org/doc/html/rfc2368] -# - RFC2373[https://datatracker.ietf.org/doc/html/rfc2373] -# - RFC2396[https://datatracker.ietf.org/doc/html/rfc2396] -# - RFC2732[https://datatracker.ietf.org/doc/html/rfc2732] -# - RFC3986[https://datatracker.ietf.org/doc/html/rfc3986] +# - RFC822[https://www.rfc-editor.org/rfc/rfc822] +# - RFC1738[https://www.rfc-editor.org/rfc/rfc1738] +# - RFC2255[https://www.rfc-editor.org/rfc/rfc2255] +# - RFC2368[https://www.rfc-editor.org/rfc/rfc2368] +# - RFC2373[https://www.rfc-editor.org/rfc/rfc2373] +# - RFC2396[https://www.rfc-editor.org/rfc/rfc2396] +# - RFC2732[https://www.rfc-editor.org/rfc/rfc2732] +# - RFC3986[https://www.rfc-editor.org/rfc/rfc3986] # # == Class tree # diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index baa6a4c..bdd3666 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -945,7 +945,7 @@ def fragment=(v) # == Description # # URI has components listed in order of decreasing significance from left to right, - # see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3. + # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3. # # == Usage # diff --git a/lib/uri/http.rb b/lib/uri/http.rb index 306daf1..900b132 100644 --- a/lib/uri/http.rb +++ b/lib/uri/http.rb @@ -85,7 +85,7 @@ def request_uri # == Description # # Returns the authority for an HTTP uri, as defined in - # https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2. + # https://www.rfc-editor.org/rfc/rfc3986#section-3.2. # # # Example: @@ -106,7 +106,7 @@ def authority # == Description # # Returns the origin for an HTTP uri, as defined in - # https://datatracker.ietf.org/doc/html/rfc6454. + # https://www.rfc-editor.org/rfc/rfc6454. # # # Example: From 554438f4e0f88013adc675d2e874dc661d4bbd89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 01:17:32 +0000 Subject: [PATCH 09/30] Bump actions/configure-pages from 4 to 5 Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 4 to 5. - [Release notes](https://github.com/actions/configure-pages/releases) - [Commits](https://github.com/actions/configure-pages/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/configure-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .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 7aed1b2..c30ff22 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -27,7 +27,7 @@ jobs: bundler-cache: true - name: Setup Pages id: pages - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 - name: Build with RDoc # Outputs to the './_site' directory by default run: bundle exec rake rdoc From bf9012fa58d25208229e72ca637bdcc699fba95b Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 11 Jun 2024 07:06:32 +0200 Subject: [PATCH 10/30] Exclude Ruby 2.5 from Apple Silicon --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6cf5ef7..ee9b2a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,9 @@ jobs: matrix: ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} os: [ ubuntu-latest, macos-latest ] + exclude: + - ruby: 2.5 + os: macos-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 From e84670a9e2e0c40eba8d722c1b26929cd5bd6ce8 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 11 Jun 2024 07:07:31 +0200 Subject: [PATCH 11/30] Update license files same as ruby/ruby repository --- LICENSE.txt => BSDL | 6 ++--- COPYING | 56 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 3 deletions(-) rename LICENSE.txt => BSDL (83%) create mode 100644 COPYING diff --git a/LICENSE.txt b/BSDL similarity index 83% rename from LICENSE.txt rename to BSDL index a009cae..66d9359 100644 --- a/LICENSE.txt +++ b/BSDL @@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..48e5a96 --- /dev/null +++ b/COPYING @@ -0,0 +1,56 @@ +Ruby is copyrighted free software by Yukihiro Matsumoto . +You can redistribute it and/or modify it under either the terms of the +2-clause BSDL (see the file BSDL), or the conditions below: + +1. You may make and give away verbatim copies of the source form of the + software without restriction, provided that you duplicate all of the + original copyright notices and associated disclaimers. + +2. You may modify your copy of the software in any way, provided that + you do at least ONE of the following: + + a. place your modifications in the Public Domain or otherwise + make them Freely Available, such as by posting said + modifications to Usenet or an equivalent medium, or by allowing + the author to include your modifications in the software. + + b. use the modified software only within your corporation or + organization. + + c. give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d. make other distribution arrangements with the author. + +3. You may distribute the software in object code or binary form, + provided that you do at least ONE of the following: + + a. distribute the binaries and library files of the software, + together with instructions (in the manual page or equivalent) + on where to get the original distribution. + + b. accompany the distribution with the machine-readable source of + the software. + + c. give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d. make other distribution arrangements with the author. + +4. You may modify and include the part of the software into any other + software (possibly commercial). But some files in the distribution + are not written by the author, so that they are not under these terms. + + For the list of those files and their copying conditions, see the + file LEGAL. + +5. The scripts and library files supplied as input to or produced as + output from the software do not automatically fall under the + copyright of the software, but belong to whomever generated them, + and may be sold commercially, and may be aggregated with this + software. + +6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. From 9f2c7ed5f2e2c4060c05e3db8fa1dc73dd24ba0f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Mon, 28 Mar 2022 21:17:51 -0400 Subject: [PATCH 12/30] Add space after `bad URI` --- lib/uri/rfc2396_parser.rb | 6 +++--- lib/uri/rfc3986_parser.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb index 00c66cf..a56ca34 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -140,11 +140,11 @@ def split(uri) if !scheme raise InvalidURIError, - "bad URI(absolute but no scheme): #{uri}" + "bad URI (absolute but no scheme): #{uri}" end if !opaque && (!path && (!host && !registry)) raise InvalidURIError, - "bad URI(absolute but no path): #{uri}" + "bad URI (absolute but no path): #{uri}" end when @regexp[:REL_URI] @@ -173,7 +173,7 @@ def split(uri) # server = [ [ userinfo "@" ] hostport ] else - raise InvalidURIError, "bad URI(is not URI?): #{uri}" + raise InvalidURIError, "bad URI (is not URI?): #{uri}" end path = '' if !path && !opaque # (see RFC2396 Section 5.2) diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index 092a1ac..0f63c48 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -78,7 +78,7 @@ def split(uri) #:nodoc: begin uri = uri.to_str rescue NoMethodError - raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}" + raise InvalidURIError, "bad URI (is not URI?): #{uri.inspect}" end uri.ascii_only? or raise InvalidURIError, "URI must be ascii only #{uri.dump}" @@ -127,7 +127,7 @@ def split(uri) #:nodoc: m["fragment"] ] else - raise InvalidURIError, "bad URI(is not URI?): #{uri.inspect}" + raise InvalidURIError, "bad URI (is not URI?): #{uri.inspect}" end end From d7dc19ad3fc5efe094abb4bffbe6b80a1d7aacae Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 17 Jul 2024 18:53:54 +0900 Subject: [PATCH 13/30] Added URI.parser= method for switch back to RFC2396_Parser --- lib/uri/common.rb | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index faf75f0..1d381e7 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -13,24 +13,34 @@ require_relative "rfc3986_parser" module URI - include RFC2396_REGEXP + RFC2396_PARSER = RFC2396_Parser.new + Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) - REGEXP = RFC2396_REGEXP - Parser = RFC2396_Parser RFC3986_PARSER = RFC3986_Parser.new Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) - # URI::Parser.new - DEFAULT_PARSER = Parser.new - DEFAULT_PARSER.pattern.each_pair do |sym, str| - unless REGEXP::PATTERN.const_defined?(sym) - REGEXP::PATTERN.const_set(sym, str) + DEFAULT_PARSER = RFC3986_PARSER + Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) + + def self.parser=(parser = RFC3986_PARSER) + remove_const(:Parser) if defined?(Parser) + const_set("Parser", parser.class) + + if Parser == RFC2396_Parser + remove_const(:REGEXP) if defined?(REGEXP) + const_set("REGEXP", URI::RFC2396_REGEXP) + 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| + remove_const(sym) if const_defined?(sym) + const_set(sym, str) end end - DEFAULT_PARSER.regexp.each_pair do |sym, str| - const_set(sym, str) - end - Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) + self.parser = RFC3986_PARSER module Util # :nodoc: def make_components_hash(klass, array_hash) From bbb8a40eae3d11521113a111e5f8ab8f6d6f40c3 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jul 2024 10:11:13 +0900 Subject: [PATCH 14/30] Added compatibility methods for RFC2396 parser --- lib/uri/rfc3986_parser.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index 092a1ac..dbb352f 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -135,12 +135,31 @@ def parse(uri) # :nodoc: URI.for(*self.split(uri), self) end - def join(*uris) # :nodoc: uris[0] = convert_to_uri(uris[0]) uris.inject :merge end + # Compatibility for RFC2396 parser + def extract(str, schemes = nil) # :nodoc: + RFC2396_PARSER.extract(str, schemes) + end + + # Compatibility for RFC2396 parser + def make_regexp(schemes = nil) # :nodoc: + RFC2396_PARSER.make_regexp(schemes) + end + + # Compatibility for RFC2396 parser + def escape(str, unsafe = nil) # :nodoc: + unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str) + end + + # Compatibility for RFC2396 parser + def unescape(str, escaped = nil) # :nodoc: + escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str) + end + @@to_s = Kernel.instance_method(:to_s) if @@to_s.respond_to?(:bind_call) def inspect From 0ab9abbf088654f1a71de5302b6282006cfb3942 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jul 2024 10:11:29 +0900 Subject: [PATCH 15/30] Switch to inspect with default parser --- test/uri/test_parser.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb index 75c02fe..f400de2 100644 --- a/test/uri/test_parser.rb +++ b/test/uri/test_parser.rb @@ -8,8 +8,8 @@ def uri_to_ary(uri) end def test_inspect - assert_match(/URI::RFC2396_Parser/, URI::Parser.new.inspect) - assert_match(/URI::RFC3986_Parser/, URI::RFC3986_Parser.new.inspect) + assert_match(/URI::RFC2396_Parser/, URI::RFC2396_Parser.new.inspect) + assert_match(/URI::RFC3986_Parser/, URI::Parser.new.inspect) end def test_compare From 2e0f73f05e9ad226356a2dde89f53feb41d59cc9 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jul 2024 10:27:25 +0900 Subject: [PATCH 16/30] Rename and switch RFC2396_PARSER test --- test/uri/test_parser.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb index f400de2..9105d47 100644 --- a/test/uri/test_parser.rb +++ b/test/uri/test_parser.rb @@ -33,7 +33,9 @@ def test_compare assert(!u2.equal?(u3)) end - def test_parse + def test_parse_rfc2396_parser + URI.parser = URI::RFC2396_PARSER + escaped = URI::REGEXP::PATTERN::ESCAPED hex = URI::REGEXP::PATTERN::HEX p1 = URI::Parser.new(:ESCAPED => "(?:#{escaped}|%u[#{hex}]{4})") @@ -43,6 +45,8 @@ def test_parse u1.path = '/%uDCBA' assert_equal(['http', nil, 'a', URI::HTTP.default_port, '/%uDCBA', nil, nil], uri_to_ary(u1)) + ensure + URI.parser = URI::DEFAULT_PARSER end def test_parse_query_pct_encoded From 984145c407c074d93ab7ca50e12afc2be7333804 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jul 2024 11:58:26 +0900 Subject: [PATCH 17/30] URI.extract needs to pass block If given block to URI.extract, it returns nil. --- lib/uri/rfc3986_parser.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index dbb352f..529ecfa 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -141,8 +141,8 @@ def join(*uris) # :nodoc: end # Compatibility for RFC2396 parser - def extract(str, schemes = nil) # :nodoc: - RFC2396_PARSER.extract(str, schemes) + def extract(str, schemes = nil, &block) # :nodoc: + RFC2396_PARSER.extract(str, schemes, &block) end # Compatibility for RFC2396 parser From 6f616d97fc9ec9e74c21a396206c2eb9ba907552 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jul 2024 13:16:20 +0900 Subject: [PATCH 18/30] Added test for constant definition and remove URI::REGEXP when using RFC3986_PARSER --- lib/uri/common.rb | 3 ++- test/uri/test_common.rb | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 1d381e7..034b91c 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -26,8 +26,8 @@ def self.parser=(parser = RFC3986_PARSER) remove_const(:Parser) if defined?(Parser) const_set("Parser", parser.class) + remove_const(:REGEXP) if defined?(REGEXP) if Parser == RFC2396_Parser - remove_const(:REGEXP) if defined?(REGEXP) const_set("REGEXP", URI::RFC2396_REGEXP) Parser.new.pattern.each_pair do |sym, str| unless REGEXP::PATTERN.const_defined?(sym) @@ -35,6 +35,7 @@ def self.parser=(parser = RFC3986_PARSER) end end end + Parser.new.regexp.each_pair do |sym, str| remove_const(sym) if const_defined?(sym) const_set(sym, str) diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 1df19e6..8d0a206 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -10,6 +10,23 @@ def setup def teardown end + def test_parser_switch + assert_equal(URI::Parser, URI::RFC3986_Parser) + refute defined?(::URI::REGEXP) + + URI.parser = URI::RFC2396_PARSER + + assert_equal(URI::Parser, URI::RFC2396_Parser) + assert defined?(URI::REGEXP) + + URI.parser = URI::RFC3986_PARSER + + assert_equal(URI::Parser, URI::RFC3986_Parser) + refute defined?(URI::REGEXP) + ensure + URI.parser = URI::RFC3986_PARSER + end + def test_extract EnvUtil.suppress_warning do assert_equal(['http://example.com'], From 823697edb4eb1d6f43e6864d00e99797888265a6 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 18 Jul 2024 13:31:17 +0900 Subject: [PATCH 19/30] Also support URI::PATTERN with switch-back --- lib/uri/common.rb | 2 ++ test/uri/test_common.rb | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 034b91c..b5b6177 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -27,8 +27,10 @@ def self.parser=(parser = RFC3986_PARSER) const_set("Parser", parser.class) remove_const(:REGEXP) if defined?(REGEXP) + remove_const(:PATTERN) if defined?(PATTERN) 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) diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 8d0a206..aa9c689 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -12,17 +12,21 @@ def teardown def test_parser_switch assert_equal(URI::Parser, URI::RFC3986_Parser) - refute defined?(::URI::REGEXP) + refute defined?(URI::REGEXP) + refute defined?(URI::PATTERN) URI.parser = URI::RFC2396_PARSER assert_equal(URI::Parser, URI::RFC2396_Parser) assert defined?(URI::REGEXP) + assert defined?(URI::PATTERN) + assert defined?(URI::PATTERN::ESCAPED) URI.parser = URI::RFC3986_PARSER assert_equal(URI::Parser, URI::RFC3986_Parser) refute defined?(URI::REGEXP) + refute defined?(URI::PATTERN) ensure URI.parser = URI::RFC3986_PARSER end From 7a64e0245fa7d98468d4a217b9e20ea7b9b87a1e Mon Sep 17 00:00:00 2001 From: Randy Stauner Date: Fri, 19 Jul 2024 08:55:31 -0700 Subject: [PATCH 20/30] Restrict constant checks to current namespace to avoid conflicts with globals --- lib/uri/common.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index b5b6177..6ef07c8 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -23,11 +23,11 @@ module URI Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor) def self.parser=(parser = RFC3986_PARSER) - remove_const(:Parser) if defined?(Parser) + remove_const(:Parser) if defined?(::URI::Parser) const_set("Parser", parser.class) - remove_const(:REGEXP) if defined?(REGEXP) - remove_const(:PATTERN) if defined?(PATTERN) + remove_const(:REGEXP) if defined?(::URI::REGEXP) + remove_const(:PATTERN) if defined?(::URI::PATTERN) if Parser == RFC2396_Parser const_set("REGEXP", URI::RFC2396_REGEXP) const_set("PATTERN", URI::RFC2396_REGEXP::PATTERN) From cd1e539f27bd5c84ff6b000abda323306416217a Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sun, 21 Jul 2024 10:05:03 -0700 Subject: [PATCH 21/30] Use Ruby 3.3 for gh_pages build Hopefully this will fix the following error: You have already activated uri 0.12.1, but your Gemfile requires uri 0.13.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. --- .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 c30ff22..f0e6b5d 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 with: - ruby-version: '3.2' + ruby-version: '3.3' bundler-cache: true - name: Setup Pages id: pages From 28af4e155a30b71780e680ce943e00b132b6491f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Mon, 5 Aug 2024 16:35:53 +0900 Subject: [PATCH 22/30] Use DEFAULT_PARSER at split, parse, join --- lib/uri/common.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 6ef07c8..4e8210d 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -181,7 +181,7 @@ class BadURIError < Error; end # ["fragment", "top"]] # def self.split(uri) - RFC3986_PARSER.split(uri) + DEFAULT_PARSER.split(uri) end # Returns a new \URI object constructed from the given string +uri+: @@ -195,7 +195,7 @@ def self.split(uri) # if it may contain invalid URI characters. # def self.parse(uri) - RFC3986_PARSER.parse(uri) + DEFAULT_PARSER.parse(uri) end # Merges the given URI strings +str+ @@ -222,7 +222,7 @@ def self.parse(uri) # # => # # def self.join(*str) - RFC3986_PARSER.join(*str) + DEFAULT_PARSER.join(*str) end # From c2fdec079a69d4f0ced0ddfa12bda9e84449caba Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 6 Aug 2024 17:09:47 +0800 Subject: [PATCH 23/30] Fallback missing constants with RFC3986_PARSER (#113) * Fallback missing constants with RFC3986_PARSER * raise missing constant * Update test/uri/test_common.rb Co-authored-by: Nobuyoshi Nakada * Update lib/uri/common.rb Co-authored-by: Nobuyoshi Nakada * Update lib/uri/common.rb Co-authored-by: Nobuyoshi Nakada --------- Co-authored-by: Nobuyoshi Nakada --- lib/uri/common.rb | 9 +++++++++ test/uri/test_common.rb | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 4e8210d..cf93fb1 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -45,6 +45,15 @@ def self.parser=(parser = RFC3986_PARSER) end self.parser = RFC3986_PARSER + def self.const_missing(const) + if value = RFC2396_PARSER.regexp[const] + warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE + value + else + super + end + end + module Util # :nodoc: def make_components_hash(klass, array_hash) tmp = {} diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index aa9c689..bccdeaf 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -10,6 +10,15 @@ def setup def teardown end + def test_fallback_constants + orig_verbose = $VERBOSE + $VERBOSE = nil + assert URI::ABS_URI + assert_raise(NameError) { URI::FOO } + ensure + $VERBOSE = orig_verbose + end + def test_parser_switch assert_equal(URI::Parser, URI::RFC3986_Parser) refute defined?(URI::REGEXP) From 9997c1aceedfc205aa4f956b17d09b88feaf2fe2 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 8 Aug 2024 10:44:52 +0900 Subject: [PATCH 24/30] Warn compatibility methods in RFC3986_PARSER --- lib/uri/rfc3986_parser.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index cac75a3..a8a8c74 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -147,16 +147,19 @@ def extract(str, schemes = nil, &block) # :nodoc: # 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 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 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 escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str) end From 898b889811e5978b967eb5c73fe3b273b736552c Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 8 Aug 2024 11:06:03 +0900 Subject: [PATCH 25/30] Use URI::RFC2396_PARSER explicitly in URI --- lib/uri/generic.rb | 4 ++-- test/uri/test_parser.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index bdd3666..7b48c9b 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -82,7 +82,7 @@ def self.build2(args) if args.kind_of?(Array) return self.build(args.collect{|x| if x.is_a?(String) - DEFAULT_PARSER.escape(x) + URI::RFC2396_PARSER.escape(x) else x end @@ -91,7 +91,7 @@ def self.build2(args) tmp = {} args.each do |key, value| tmp[key] = if value - DEFAULT_PARSER.escape(value) + URI::RFC2396_PARSER.escape(value) else value end diff --git a/test/uri/test_parser.rb b/test/uri/test_parser.rb index 9105d47..f455a5c 100644 --- a/test/uri/test_parser.rb +++ b/test/uri/test_parser.rb @@ -69,8 +69,8 @@ def test_raise_bad_uri_for_integer end end - def test_unescape - p1 = URI::Parser.new + def test_rfc2822_unescape + p1 = URI::RFC2396_Parser.new assert_equal("\xe3\x83\x90", p1.unescape("\xe3\x83\x90")) assert_equal("\xe3\x83\x90", p1.unescape('%e3%83%90')) assert_equal("\u3042", p1.unescape('%e3%81%82'.force_encoding(Encoding::US_ASCII))) From 0f6b9455572cb5f491f3dc352a98e5ff73276d4f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 27 Aug 2024 11:36:34 +0900 Subject: [PATCH 26/30] Also warn URI::RFC3986_PARSER.extract --- lib/uri/rfc3986_parser.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index a8a8c74..4000f13 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -142,6 +142,7 @@ 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 RFC2396_PARSER.extract(str, schemes, &block) end From 31ec9cea66e2856775f8281bfeabc7d433d0fab1 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 27 Aug 2024 14:23:38 +0900 Subject: [PATCH 27/30] Bump up 0.13.1 --- 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 2dafa57..bfe3f47 100644 --- a/lib/uri/version.rb +++ b/lib/uri/version.rb @@ -1,6 +1,6 @@ module URI # :stopdoc: - VERSION_CODE = '001300'.freeze + VERSION_CODE = '001301'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end From 77241d65084caebb4d2a13f4d7b52c94a8ec6b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 17 Sep 2024 19:06:40 +0200 Subject: [PATCH 28/30] Fix spelling of "cannot" --- lib/uri/file.rb | 6 +++--- lib/uri/generic.rb | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/uri/file.rb b/lib/uri/file.rb index 4ff0bc0..940d361 100644 --- a/lib/uri/file.rb +++ b/lib/uri/file.rb @@ -70,17 +70,17 @@ def set_port(v) # raise InvalidURIError def check_userinfo(user) - raise URI::InvalidURIError, "can not set userinfo for file URI" + raise URI::InvalidURIError, "cannot set userinfo for file URI" end # raise InvalidURIError def check_user(user) - raise URI::InvalidURIError, "can not set user for file URI" + raise URI::InvalidURIError, "cannot set user for file URI" end # raise InvalidURIError def check_password(user) - raise URI::InvalidURIError, "can not set password for file URI" + raise URI::InvalidURIError, "cannot set password for file URI" end # do nothing diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index 7b48c9b..d4bfa3b 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -393,7 +393,7 @@ def check_userinfo(user, password = nil) def check_user(v) if @opaque raise InvalidURIError, - "can not set user with opaque" + "cannot set user with opaque" end return v unless v @@ -417,7 +417,7 @@ def check_user(v) def check_password(v, user = @user) if @opaque raise InvalidURIError, - "can not set password with opaque" + "cannot set password with opaque" end return v unless v @@ -596,7 +596,7 @@ def check_host(v) if @opaque raise InvalidURIError, - "can not set host with registry or opaque" + "cannot set host with registry or opaque" elsif parser.regexp[:HOST] !~ v raise InvalidComponentError, "bad component(expected host component): #{v}" @@ -685,7 +685,7 @@ def check_port(v) if @opaque raise InvalidURIError, - "can not set port with registry or opaque" + "cannot set port with registry or opaque" elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v raise InvalidComponentError, "bad component(expected port component): #{v.inspect}" @@ -733,17 +733,17 @@ def port=(v) end def check_registry(v) # :nodoc: - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end private :check_registry def set_registry(v) #:nodoc: - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end protected :set_registry def registry=(v) - raise InvalidURIError, "can not set registry" + raise InvalidURIError, "cannot set registry" end # @@ -866,7 +866,7 @@ def check_opaque(v) # hier_part = ( net_path | abs_path ) [ "?" query ] if @host || @port || @user || @path # userinfo = @user + ':' + @password raise InvalidURIError, - "can not set opaque with host, port, userinfo or path" + "cannot set opaque with host, port, userinfo or path" elsif v && parser.regexp[:OPAQUE] !~ v raise InvalidComponentError, "bad component(expected opaque component): #{v}" @@ -1235,7 +1235,7 @@ def route_from0(oth) return rel, rel end - # you can modify `rel', but can not `oth'. + # you can modify `rel', but cannot `oth'. return oth, rel end private :route_from0 @@ -1260,7 +1260,7 @@ def route_from0(oth) # #=> # # def route_from(oth) - # you can modify `rel', but can not `oth'. + # you can modify `rel', but cannot `oth'. begin oth, rel = route_from0(oth) rescue From aab4e6ee73668786c6633c9bbc43c2a93e94c087 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 7 Nov 2024 15:50:57 +0900 Subject: [PATCH 29/30] Enabled trusted publisher for rubygems.org --- .github/workflows/push_gem.yml | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/push_gem.yml diff --git a/.github/workflows/push_gem.yml b/.github/workflows/push_gem.yml new file mode 100644 index 0000000..e15d54b --- /dev/null +++ b/.github/workflows/push_gem.yml @@ -0,0 +1,46 @@ +name: Publish gem to rubygems.org + +on: + push: + tags: + - 'v*' + +permissions: + contents: read + +jobs: + push: + if: github.repository == 'ruby/uri' + runs-on: ubuntu-latest + + environment: + name: rubygems.org + url: https://rubygems.org/gems/uri + + permissions: + contents: write + id-token: write + + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Set up Ruby + uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0 + with: + bundler-cache: true + ruby-version: ruby + + - name: Publish to RubyGems + uses: rubygems/release-gem@612653d273a73bdae1df8453e090060bb4db5f31 # v1 + + - name: Create GitHub release + run: | + tag_name="$(git describe --tags --abbrev=0)" + gh release create "${tag_name}" --verify-tag --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.MATZBOT_GITHUB_WORKFLOW_TOKEN }} From af8d9d6bb1a90da71f64a9c3f8eddd3626d44efb Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 7 Nov 2024 15:52:18 +0900 Subject: [PATCH 30/30] Bump up v1.0.0 --- 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 bfe3f47..c68c43a 100644 --- a/lib/uri/version.rb +++ b/lib/uri/version.rb @@ -1,6 +1,6 @@ module URI # :stopdoc: - VERSION_CODE = '001301'.freeze + VERSION_CODE = '010000'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end