Skip to content

Commit

Permalink
Merge pull request #11 from delano/10-bug-undefined-method-register_s…
Browse files Browse the repository at this point in the history
…cheme-for-urimodule

Fix for undefined method register scheme for URI
  • Loading branch information
delano authored May 21, 2024
2 parents 38cd084 + bd41c44 commit 83d15e1
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 5 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ jobs:
strategy:
matrix:
include:
- ruby: '3.2.0'
- ruby: '3.3'
bundler: latest
rubygems: latest

- ruby: '3.1.4'
- ruby: '3.2'
bundler: latest
rubygems: latest

- ruby: '3.1'
bundler: latest
rubygems: latest

Expand Down Expand Up @@ -49,3 +53,6 @@ jobs:

- name: Run the default task
run: bundle exec rake

- name: Run the tryouts
run: bundle exec try -v
69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
##
# Pre-Commit Configuration
#
# Initial setup:
#
# 0. Install the pre-commit framework (if it isn't already on your system):

# $ pip install pre-commit
#
# 1. Install the git hook:
#
# $ pre-commit install
#
#
# Other commands:
#
# Run it on all the files in this repo:
# $ pre-commit run --all-files
#
# Updating plugin repositories:
# $ pre-commit autoupdate
#
# Automatically enable pre-commit on repositories
# $ git config --global init.templateDir ~/.git-template
# $ pre-commit init-templatedir ~/.git-template
#
# See also:
# - https://pre-commit.com for more information
# - https://pre-commit.com/hooks.html for more hooks
#

default_install_hook_types:
- pre-commit
- prepare-commit-msg

fail_fast: true

repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- id: identity

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: detect-private-key
- id: mixed-line-ending
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: no-commit-to-branch
args: ["--branch", "develop", "--branch", "rel/.*"]
- id: check-merge-conflict
- id: forbid-submodules

- repo: https://github.com/avilaton/add-msg-issue-prefix-hook
rev: v0.0.11
hooks:
- id: add-msg-issue-prefix
stages: [prepare-commit-msg]
name: Link commit to Github issue
args:
- "--default=[NOJIRA]"
- "--pattern=[a-zA-Z0-9]{0,10}-?[0-9]{1,5}"
- "--template=[#{}]"
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
URI-Redis, CHANGES

#### 1.2.0 (2024-05-20) ###############################

* Fix for Ruby <= 3.0 `register_scheme` error.


#### 1.1.2 (2024-05-02) ###############################

* Same functionality as the now yanked 1.1.1 with
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# URI-Redis v1.1.2 (2024-05-02)
# URI-Redis v1.2 (2024-05-20)

Creates a URI object for Redis URLs.

Expand Down
7 changes: 6 additions & 1 deletion lib/uri/redis.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "uri"
require "uri/generic"
require "redis"

# URI::Redis - adds support for Redis URIs to core.
Expand Down Expand Up @@ -99,7 +100,11 @@ def parse_query(query, delim = nil)
end
end

register_scheme "REDIS", Redis
if URI.respond_to?(:register_scheme)
URI.register_scheme "REDIS", Redis
else
@@schemes['REDIS'] = Redis
end
end

# Adds a URI method to Redis
Expand Down
3 changes: 2 additions & 1 deletion lib/uri/redis/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module URI
module Redis
VERSION = "1.1.2"
VERSION = "1.2.0"
SUMMARY = "A Ruby library for parsing, building and normalizing redis URLs"
end
end

0 comments on commit 83d15e1

Please sign in to comment.