lex-redis 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +18 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +50 -0
- data/CHANGELOG.md +22 -0
- data/CLAUDE.md +71 -0
- data/Dockerfile +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +93 -0
- data/LICENSE +21 -0
- data/README.md +69 -0
- data/docker_deploy.rb +20 -0
- data/lex-redis.gemspec +28 -0
- data/lib/legion/extensions/redis/client.rb +26 -0
- data/lib/legion/extensions/redis/helpers/client.rb +20 -0
- data/lib/legion/extensions/redis/runners/item.rb +48 -0
- data/lib/legion/extensions/redis/runners/server.rb +40 -0
- data/lib/legion/extensions/redis/version.rb +9 -0
- data/lib/legion/extensions/redis.rb +15 -0
- metadata +34 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f273fe69d0bd2d48811459891dcf582e3dc5c4109ac830107c6fd782656b5c7
|
|
4
|
+
data.tar.gz: '07796f5b244afdfa2d18d2a08445070e5e96c55c87c191b65d2dcb6224978654'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f94ef0cd15b0a20113bfd6658a95995eca067a010fdf50de725e1544a837be9060970b06d669c457e1649a862f53e360f07d8519cce0103e639d52fc8ca6579a
|
|
7
|
+
data.tar.gz: a01a0ab843ddcad4d656ecd14097fc467b342197af11b4618752d5de1475952e8bf4b7d84dd71e0f53251d1fb1ee0eef76520f1b77fb7f4ef6c807b840c9df86
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
ci:
|
|
9
|
+
uses: LegionIO/.github/.github/workflows/ci.yml@main
|
|
10
|
+
with:
|
|
11
|
+
needs-redis: true
|
|
12
|
+
|
|
13
|
+
release:
|
|
14
|
+
needs: ci
|
|
15
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
16
|
+
uses: LegionIO/.github/.github/workflows/release.yml@main
|
|
17
|
+
secrets:
|
|
18
|
+
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
TargetRubyVersion: 3.4
|
|
3
|
+
NewCops: enable
|
|
4
|
+
SuggestExtensions: false
|
|
5
|
+
|
|
6
|
+
Layout/LineLength:
|
|
7
|
+
Max: 160
|
|
8
|
+
|
|
9
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
10
|
+
EnforcedStyle: space
|
|
11
|
+
|
|
12
|
+
Layout/HashAlignment:
|
|
13
|
+
EnforcedHashRocketStyle: table
|
|
14
|
+
EnforcedColonStyle: table
|
|
15
|
+
|
|
16
|
+
Metrics/MethodLength:
|
|
17
|
+
Max: 50
|
|
18
|
+
|
|
19
|
+
Metrics/ClassLength:
|
|
20
|
+
Max: 1500
|
|
21
|
+
|
|
22
|
+
Metrics/ModuleLength:
|
|
23
|
+
Max: 1500
|
|
24
|
+
|
|
25
|
+
Metrics/BlockLength:
|
|
26
|
+
Max: 40
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'spec/**/*'
|
|
29
|
+
|
|
30
|
+
Metrics/AbcSize:
|
|
31
|
+
Max: 60
|
|
32
|
+
|
|
33
|
+
Metrics/CyclomaticComplexity:
|
|
34
|
+
Max: 15
|
|
35
|
+
|
|
36
|
+
Metrics/PerceivedComplexity:
|
|
37
|
+
Max: 17
|
|
38
|
+
|
|
39
|
+
Style/Documentation:
|
|
40
|
+
Enabled: false
|
|
41
|
+
|
|
42
|
+
Style/SymbolArray:
|
|
43
|
+
Enabled: true
|
|
44
|
+
|
|
45
|
+
Style/FrozenStringLiteralComment:
|
|
46
|
+
Enabled: true
|
|
47
|
+
EnforcedStyle: always
|
|
48
|
+
|
|
49
|
+
Naming/FileName:
|
|
50
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-03-15
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Standalone `Client` class including all runner modules
|
|
7
|
+
- Client accepts `host:`, `port:`, and additional kwargs at construction
|
|
8
|
+
- Per-call option overrides via `client(**override)`
|
|
9
|
+
|
|
10
|
+
## [0.1.1] - 2026-03-15
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Comprehensive specs for `Helpers::Client`: connection defaults, custom host/port,
|
|
14
|
+
optional db and password keyword arguments
|
|
15
|
+
- Comprehensive specs for `Runners::Item`: get, set (with and without ttl), delete,
|
|
16
|
+
exists, increment, decrement, keys (glob pattern), and rename
|
|
17
|
+
- Comprehensive specs for `Runners::Server`: keys, ping (with and without message),
|
|
18
|
+
save, time, flushall, and flush_db (default and custom db)
|
|
19
|
+
- Expanded specs for `Legion::Extensions::Redis` module: version format validation
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
- Version bump for GitHub migration
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# lex-redis: Redis Integration for LegionIO
|
|
2
|
+
|
|
3
|
+
**Repository Level 3 Documentation**
|
|
4
|
+
- **Parent (Level 2)**: `/Users/miverso2/rubymine/legion/extensions/CLAUDE.md`
|
|
5
|
+
- **Parent (Level 1)**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Legion Extension that connects LegionIO to Redis servers. Provides runners for item-level key/value operations and server management.
|
|
10
|
+
|
|
11
|
+
**Version**: 0.2.0
|
|
12
|
+
**GitHub**: https://github.com/LegionIO/lex-redis
|
|
13
|
+
**License**: MIT
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Legion::Extensions::Redis
|
|
19
|
+
├── Runners/
|
|
20
|
+
│ ├── Item # Key/value operations (get, set, delete, etc.)
|
|
21
|
+
│ └── Server # Server management and info
|
|
22
|
+
├── Helpers/
|
|
23
|
+
│ └── Client # Redis client connection helper (module method: .client)
|
|
24
|
+
└── Client # Standalone client class wrapping Helpers::Client + all runners
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Key Files
|
|
28
|
+
|
|
29
|
+
| Path | Purpose |
|
|
30
|
+
|------|---------|
|
|
31
|
+
| `lib/legion/extensions/redis.rb` | Entry point, extension registration |
|
|
32
|
+
| `lib/legion/extensions/redis/runners/item.rb` | Key/value runner |
|
|
33
|
+
| `lib/legion/extensions/redis/runners/server.rb` | Server management runner |
|
|
34
|
+
| `lib/legion/extensions/redis/helpers/client.rb` | Redis connection builder |
|
|
35
|
+
| `lib/legion/extensions/redis/client.rb` | Standalone `Client` class for use outside Legion framework |
|
|
36
|
+
|
|
37
|
+
## Runner Methods
|
|
38
|
+
|
|
39
|
+
**Item** (`lib/legion/extensions/redis/runners/item.rb`): `get`, `set` (with optional `ttl:`), `delete`, `exists`, `increment`, `decrement`, `keys`, `rename`
|
|
40
|
+
|
|
41
|
+
**Server** (`lib/legion/extensions/redis/runners/server.rb`): `ping`, `save`, `time`, `flushall`, `flush_db`, `keys`
|
|
42
|
+
|
|
43
|
+
Both runners use `extend Legion::Extensions::Redis::Helpers::Client` so `client(**kwargs)` is available as a module-level method.
|
|
44
|
+
|
|
45
|
+
## Connection Defaults
|
|
46
|
+
|
|
47
|
+
`Helpers::Client.client` defaults: `host: '127.0.0.1'`, `port: 6380`. Note the non-standard default port of 6380 (not the Redis default 6379). Pass `host:`, `port:`, `db:`, and `password:` in task payloads to override.
|
|
48
|
+
|
|
49
|
+
## Standalone Client
|
|
50
|
+
|
|
51
|
+
`Client` wraps `Helpers::Client` and includes all runners (`Item`, `Server`), enabling use as a standalone Redis client outside the full LegionIO framework.
|
|
52
|
+
|
|
53
|
+
## Dependencies
|
|
54
|
+
|
|
55
|
+
| Gem | Purpose |
|
|
56
|
+
|-----|---------|
|
|
57
|
+
| `redis` | Redis Ruby client (>= 5.0) |
|
|
58
|
+
|
|
59
|
+
## Testing
|
|
60
|
+
|
|
61
|
+
49 specs total (40 existing + 9 in `spec/legion/extensions/redis/client_spec.rb`).
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bundle install
|
|
65
|
+
bundle exec rspec
|
|
66
|
+
bundle exec rubocop
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
**Maintained By**: Matthew Iverson (@Esity)
|
data/Dockerfile
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
lex-redis (0.2.0)
|
|
5
|
+
redis (>= 5.0)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.8.9)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
ast (2.4.3)
|
|
13
|
+
bigdecimal (4.0.1)
|
|
14
|
+
connection_pool (3.0.2)
|
|
15
|
+
diff-lcs (1.6.2)
|
|
16
|
+
docile (1.4.1)
|
|
17
|
+
json (2.19.1)
|
|
18
|
+
json-schema (6.2.0)
|
|
19
|
+
addressable (~> 2.8)
|
|
20
|
+
bigdecimal (>= 3.1, < 5)
|
|
21
|
+
language_server-protocol (3.17.0.5)
|
|
22
|
+
lint_roller (1.1.0)
|
|
23
|
+
mcp (0.8.0)
|
|
24
|
+
json-schema (>= 4.1)
|
|
25
|
+
parallel (1.27.0)
|
|
26
|
+
parser (3.3.10.2)
|
|
27
|
+
ast (~> 2.4.1)
|
|
28
|
+
racc
|
|
29
|
+
prism (1.9.0)
|
|
30
|
+
public_suffix (7.0.5)
|
|
31
|
+
racc (1.8.1)
|
|
32
|
+
rainbow (3.1.1)
|
|
33
|
+
rake (13.3.1)
|
|
34
|
+
redis (5.4.1)
|
|
35
|
+
redis-client (>= 0.22.0)
|
|
36
|
+
redis-client (0.27.0)
|
|
37
|
+
connection_pool
|
|
38
|
+
regexp_parser (2.11.3)
|
|
39
|
+
rspec (3.13.2)
|
|
40
|
+
rspec-core (~> 3.13.0)
|
|
41
|
+
rspec-expectations (~> 3.13.0)
|
|
42
|
+
rspec-mocks (~> 3.13.0)
|
|
43
|
+
rspec-core (3.13.6)
|
|
44
|
+
rspec-support (~> 3.13.0)
|
|
45
|
+
rspec-expectations (3.13.5)
|
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
|
+
rspec-support (~> 3.13.0)
|
|
48
|
+
rspec-mocks (3.13.8)
|
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
|
+
rspec-support (~> 3.13.0)
|
|
51
|
+
rspec-support (3.13.7)
|
|
52
|
+
rspec_junit_formatter (0.6.0)
|
|
53
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
|
54
|
+
rubocop (1.85.1)
|
|
55
|
+
json (~> 2.3)
|
|
56
|
+
language_server-protocol (~> 3.17.0.2)
|
|
57
|
+
lint_roller (~> 1.1.0)
|
|
58
|
+
mcp (~> 0.6)
|
|
59
|
+
parallel (~> 1.10)
|
|
60
|
+
parser (>= 3.3.0.2)
|
|
61
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
62
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
63
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
64
|
+
ruby-progressbar (~> 1.7)
|
|
65
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
66
|
+
rubocop-ast (1.49.1)
|
|
67
|
+
parser (>= 3.3.7.2)
|
|
68
|
+
prism (~> 1.7)
|
|
69
|
+
ruby-progressbar (1.13.0)
|
|
70
|
+
simplecov (0.22.0)
|
|
71
|
+
docile (~> 1.1)
|
|
72
|
+
simplecov-html (~> 0.11)
|
|
73
|
+
simplecov_json_formatter (~> 0.1)
|
|
74
|
+
simplecov-html (0.13.2)
|
|
75
|
+
simplecov_json_formatter (0.1.4)
|
|
76
|
+
unicode-display_width (3.2.0)
|
|
77
|
+
unicode-emoji (~> 4.1)
|
|
78
|
+
unicode-emoji (4.2.0)
|
|
79
|
+
|
|
80
|
+
PLATFORMS
|
|
81
|
+
arm64-darwin-25
|
|
82
|
+
ruby
|
|
83
|
+
|
|
84
|
+
DEPENDENCIES
|
|
85
|
+
lex-redis!
|
|
86
|
+
rake
|
|
87
|
+
rspec
|
|
88
|
+
rspec_junit_formatter
|
|
89
|
+
rubocop
|
|
90
|
+
simplecov
|
|
91
|
+
|
|
92
|
+
BUNDLED WITH
|
|
93
|
+
2.6.9
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Esity
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# lex-redis
|
|
2
|
+
|
|
3
|
+
Redis integration for [LegionIO](https://github.com/LegionIO/LegionIO). Run key/value operations and server management commands against Redis servers from within task chains.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install lex-redis
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Functions
|
|
12
|
+
|
|
13
|
+
### Item Runner (key/value operations)
|
|
14
|
+
|
|
15
|
+
| Function | Parameters | Description |
|
|
16
|
+
|----------|-----------|-------------|
|
|
17
|
+
| `get` | `key:` | Get value by key |
|
|
18
|
+
| `set` | `key:`, `value:`, `ttl:` (optional) | Set key to value, with optional TTL in seconds |
|
|
19
|
+
| `delete` | `key:` | Delete a key |
|
|
20
|
+
| `exists` | `key:` | Check if a key exists (returns boolean) |
|
|
21
|
+
| `increment` | `key:`, `number:` (default: 1) | Increment key by number |
|
|
22
|
+
| `decrement` | `key:`, `number:` (default: 1) | Decrement key by number |
|
|
23
|
+
| `keys` | `glob:` (default: `'*'`) | List keys matching a glob pattern |
|
|
24
|
+
| `rename` | `old_key`, `key:` | Rename a key |
|
|
25
|
+
|
|
26
|
+
### Server Runner (server management)
|
|
27
|
+
|
|
28
|
+
| Function | Parameters | Description |
|
|
29
|
+
|----------|-----------|-------------|
|
|
30
|
+
| `ping` | `message:` (optional) | Ping the server |
|
|
31
|
+
| `save` | (none) | Trigger a blocking BGSAVE |
|
|
32
|
+
| `time` | (none) | Return server time |
|
|
33
|
+
| `flushall` | (none) | Flush all databases |
|
|
34
|
+
| `flush_db` | `db:` (default: 0) | Flush a specific database |
|
|
35
|
+
| `keys` | `glob:` (default: `'*'`) | List keys matching a glob pattern |
|
|
36
|
+
|
|
37
|
+
### Connection Parameters
|
|
38
|
+
|
|
39
|
+
All runners accept connection kwargs forwarded to `Helpers::Client`:
|
|
40
|
+
|
|
41
|
+
| Parameter | Default | Description |
|
|
42
|
+
|-----------|---------|-------------|
|
|
43
|
+
| `host` | `'127.0.0.1'` | Redis server hostname |
|
|
44
|
+
| `port` | `6380` | Redis server port |
|
|
45
|
+
| `db` | (none) | Database number |
|
|
46
|
+
| `password` | (none) | Auth password |
|
|
47
|
+
|
|
48
|
+
Note: the default port is `6380`, not the standard Redis default of `6379`.
|
|
49
|
+
|
|
50
|
+
## Standalone Client
|
|
51
|
+
|
|
52
|
+
Use `Legion::Extensions::Redis::Client` outside the full LegionIO framework.
|
|
53
|
+
|
|
54
|
+
```ruby
|
|
55
|
+
require 'legion/extensions/redis'
|
|
56
|
+
client = Legion::Extensions::Redis::Client.new(host: '127.0.0.1', port: 6379)
|
|
57
|
+
client.set(key: 'foo', value: 'bar', ttl: 300)
|
|
58
|
+
client.get(key: 'foo')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- Ruby >= 3.4
|
|
64
|
+
- [LegionIO](https://github.com/LegionIO/LegionIO) framework
|
|
65
|
+
- Redis server >= 5.0
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
data/docker_deploy.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
long_name = 'lex-redis'
|
|
5
|
+
name = 'redis'
|
|
6
|
+
require "./lib/legion/extensions/#{name}/version"
|
|
7
|
+
version = Legion::Extensions::Redis::VERSION
|
|
8
|
+
|
|
9
|
+
system("gem build #{long_name}.gemspec")
|
|
10
|
+
system("gh release create v#{version} '#{long_name}-#{version}.gem'")
|
|
11
|
+
system("gem push #{long_name}-#{version}.gem")
|
|
12
|
+
system("gem push --key github --host https://rubygems.pkg.github.com/LegionIO #{long_name}-#{version}.gem")
|
|
13
|
+
|
|
14
|
+
puts "Building docker image for Legion v#{version}"
|
|
15
|
+
system("docker build --tag legionio/lex-#{name}:v#{version} .")
|
|
16
|
+
system("docker build --tag legionio/lex-#{name}:latest .")
|
|
17
|
+
puts 'Pushing to hub.docker.com'
|
|
18
|
+
system("docker push legionio/lex-#{name}:v#{version}")
|
|
19
|
+
system("docker push legionio/lex-#{name}:latest")
|
|
20
|
+
puts 'completed'
|
data/lex-redis.gemspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/legion/extensions/redis/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'lex-redis'
|
|
7
|
+
spec.version = Legion::Extensions::Redis::VERSION
|
|
8
|
+
spec.authors = ['Esity']
|
|
9
|
+
spec.email = ['matthewdiverson@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'LEX::redis'
|
|
12
|
+
spec.description = 'Connects LegionIO to Redis Servers'
|
|
13
|
+
spec.homepage = 'https://github.com/LegionIO/lex-redis'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.required_ruby_version = '>= 3.4'
|
|
16
|
+
|
|
17
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-redis'
|
|
19
|
+
spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-redis'
|
|
20
|
+
spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-redis'
|
|
21
|
+
spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-redis/issues'
|
|
22
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
25
|
+
end
|
|
26
|
+
spec.require_paths = ['lib']
|
|
27
|
+
spec.add_dependency 'redis', '>= 5.0'
|
|
28
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'helpers/client'
|
|
4
|
+
require_relative 'runners/item'
|
|
5
|
+
require_relative 'runners/server'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Redis
|
|
10
|
+
class Client
|
|
11
|
+
include Runners::Item
|
|
12
|
+
include Runners::Server
|
|
13
|
+
|
|
14
|
+
attr_reader :opts
|
|
15
|
+
|
|
16
|
+
def initialize(host: '127.0.0.1', port: 6380, **extra)
|
|
17
|
+
@opts = { host: host, port: port, **extra }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def client(**override)
|
|
21
|
+
Helpers::Client.client(**@opts, **override)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'redis'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Redis
|
|
8
|
+
module Helpers
|
|
9
|
+
module Client
|
|
10
|
+
def self.client(host: '127.0.0.1', port: 6380, **opts)
|
|
11
|
+
connect_hash = { host: host, port: port }
|
|
12
|
+
connect_hash[:db] = opts[:db] if opts.key? :db
|
|
13
|
+
connect_hash[:password] = opts[:password] if opts.key? :password
|
|
14
|
+
Redis.new(**connect_hash)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/redis/helpers/client'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Redis
|
|
8
|
+
module Runners
|
|
9
|
+
module Item
|
|
10
|
+
def get(key:, **)
|
|
11
|
+
{ result: client(**).get(key) }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def decrement(key:, number: 1, **)
|
|
15
|
+
{ result: client(**).decrby(key, number) }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def delete(key:, **)
|
|
19
|
+
{ result: client(**).del(key) }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def exists(key:, **)
|
|
23
|
+
{ result: client(**).exists?(key) }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def increment(key:, number: 1, **)
|
|
27
|
+
{ result: client(**).incrby(key, number) }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def keys(glob: '*', **)
|
|
31
|
+
{ result: client(**).keys(glob) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def rename(old_key, key:, **)
|
|
35
|
+
{ result: client(**).rename(old_key, key) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def set(key:, value:, ttl: nil, **)
|
|
39
|
+
{ result: client(**).set(key, value, ex: ttl) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
extend Legion::Extensions::Redis::Helpers::Client
|
|
43
|
+
include Legion::Extensions::Helpers::Lex
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/redis/helpers/client'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Redis
|
|
8
|
+
module Runners
|
|
9
|
+
module Server
|
|
10
|
+
def keys(glob: '*', **)
|
|
11
|
+
{ result: client(**).keys(glob) }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def ping(message: nil, **)
|
|
15
|
+
{ result: client(**).ping(message) }
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def save(**)
|
|
19
|
+
{ result: client(**).save }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def time(**)
|
|
23
|
+
{ result: client(**).time }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def flushall(**)
|
|
27
|
+
{ result: client(**).flushall }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def flush_db(db: 0, **)
|
|
31
|
+
{ results: client(db: db, **).flushdb(db) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
extend Legion::Extensions::Redis::Helpers::Client
|
|
35
|
+
include Legion::Extensions::Helpers::Lex
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/redis/version'
|
|
4
|
+
require 'legion/extensions/redis/helpers/client'
|
|
5
|
+
require 'legion/extensions/redis/runners/item'
|
|
6
|
+
require 'legion/extensions/redis/runners/server'
|
|
7
|
+
require 'legion/extensions/redis/client'
|
|
8
|
+
|
|
9
|
+
module Legion
|
|
10
|
+
module Extensions
|
|
11
|
+
module Redis
|
|
12
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-redis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: redis
|
|
@@ -16,31 +15,50 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
18
|
+
version: '5.0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
description:
|
|
25
|
+
version: '5.0'
|
|
26
|
+
description: Connects LegionIO to Redis Servers
|
|
28
27
|
email:
|
|
29
28
|
- matthewdiverson@gmail.com
|
|
30
29
|
executables: []
|
|
31
30
|
extensions: []
|
|
32
31
|
extra_rdoc_files: []
|
|
33
|
-
files:
|
|
34
|
-
|
|
32
|
+
files:
|
|
33
|
+
- ".github/workflows/ci.yml"
|
|
34
|
+
- ".gitignore"
|
|
35
|
+
- ".rspec"
|
|
36
|
+
- ".rubocop.yml"
|
|
37
|
+
- CHANGELOG.md
|
|
38
|
+
- CLAUDE.md
|
|
39
|
+
- Dockerfile
|
|
40
|
+
- Gemfile
|
|
41
|
+
- Gemfile.lock
|
|
42
|
+
- LICENSE
|
|
43
|
+
- README.md
|
|
44
|
+
- docker_deploy.rb
|
|
45
|
+
- lex-redis.gemspec
|
|
46
|
+
- lib/legion/extensions/redis.rb
|
|
47
|
+
- lib/legion/extensions/redis/client.rb
|
|
48
|
+
- lib/legion/extensions/redis/helpers/client.rb
|
|
49
|
+
- lib/legion/extensions/redis/runners/item.rb
|
|
50
|
+
- lib/legion/extensions/redis/runners/server.rb
|
|
51
|
+
- lib/legion/extensions/redis/version.rb
|
|
52
|
+
homepage: https://github.com/LegionIO/lex-redis
|
|
35
53
|
licenses:
|
|
36
54
|
- MIT
|
|
37
55
|
metadata:
|
|
38
|
-
homepage_uri: https://
|
|
39
|
-
source_code_uri: https://
|
|
40
|
-
documentation_uri: https://
|
|
41
|
-
changelog_uri: https://
|
|
42
|
-
bug_tracker_uri: https://
|
|
43
|
-
|
|
56
|
+
homepage_uri: https://github.com/LegionIO/lex-redis
|
|
57
|
+
source_code_uri: https://github.com/LegionIO/lex-redis
|
|
58
|
+
documentation_uri: https://github.com/LegionIO/lex-redis
|
|
59
|
+
changelog_uri: https://github.com/LegionIO/lex-redis
|
|
60
|
+
bug_tracker_uri: https://github.com/LegionIO/lex-redis/issues
|
|
61
|
+
rubygems_mfa_required: 'true'
|
|
44
62
|
rdoc_options: []
|
|
45
63
|
require_paths:
|
|
46
64
|
- lib
|
|
@@ -48,15 +66,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
48
66
|
requirements:
|
|
49
67
|
- - ">="
|
|
50
68
|
- !ruby/object:Gem::Version
|
|
51
|
-
version:
|
|
69
|
+
version: '3.4'
|
|
52
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
71
|
requirements:
|
|
54
72
|
- - ">="
|
|
55
73
|
- !ruby/object:Gem::Version
|
|
56
74
|
version: '0'
|
|
57
75
|
requirements: []
|
|
58
|
-
rubygems_version: 3.
|
|
59
|
-
signing_key:
|
|
76
|
+
rubygems_version: 3.6.9
|
|
60
77
|
specification_version: 4
|
|
61
78
|
summary: LEX::redis
|
|
62
79
|
test_files: []
|