lex-redis 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1aa566254d03bbff2805ebb3a2f861c7e51cc3bb7b1c7cac563ff26433f27211
4
- data.tar.gz: c18e22ae5ba3c4d6f679cc78325bedbaf9810fa8d4b78138b364f69ec0b6f9bd
3
+ metadata.gz: a9539cd6fbe7a2f4a2272455f198262475204c51dfaed6357c144631a9f9708e
4
+ data.tar.gz: 9708872e0b5637714f479b53422e721a5b9ba58df3ff0dc7f35b1275186eb624
5
5
  SHA512:
6
- metadata.gz: 4bcea1e0ac26e4d8c7e2d7fe1306b47bbbc42470028b862651373b5ce2bb423b9572d42b1ac09e37f17a76f13702f317acc5d5ba08cbdefc1f48b58e38ec6f5f
7
- data.tar.gz: e79da82e706476c08e6ed43775e168f4ed0f1699eb2f3eb22522f38949651eb2b84a0a35c21b6c8cfc54976272fb1a85fd1c008181f0091678d10481bc20c1b3
6
+ metadata.gz: 728607659576c3248fa6cc3a97b1112f33c0c8765dd47ffcbda6095b147e71154464c4094a24bb4f2f0532587aa803a9681273c7ce63ddf43d659791a1b3c7c5
7
+ data.tar.gz: f08234977a05e370814ccaadd78e784d76e0e1567666ab1ddf59f8b8f47420bc02d1d592e5f2aa139ab33aa411b367e027dd3295c6545d1537d3261c5e1e61b4
@@ -0,0 +1,54 @@
1
+ name: RSpec
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ rspec:
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ os: [ubuntu-latest]
10
+ ruby: [2.7]
11
+ runs-on: ${{ matrix.os }}
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ bundler-cache: true
18
+ - name: RSpec run
19
+ run: |
20
+ bash -c "
21
+ bundle exec rspec
22
+ [[ $? -ne 2 ]]
23
+ "
24
+ rspec-mri:
25
+ needs: rspec
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ os: [ ubuntu-latest ]
30
+ ruby: [2.5, 2.6, '3.0', head]
31
+ runs-on: ${{ matrix.os }}
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ - uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true
38
+ - run: bundle exec rspec
39
+ rspec-truffleruby:
40
+ needs: rspec
41
+ strategy:
42
+ fail-fast: false
43
+ matrix:
44
+ os: [ ubuntu-latest ]
45
+ ruby: [truffleruby]
46
+ runs-on: ${{ matrix.os }}
47
+ steps:
48
+ - uses: actions/checkout@v2
49
+ - uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: ${{ matrix.ruby }}
52
+ bundler-cache: true
53
+ - run: bundle exec rspec
54
+
@@ -0,0 +1,28 @@
1
+ name: Rubocop
2
+ on: [push, pull_request]
3
+ jobs:
4
+ rubocop:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ os: [ubuntu-latest]
9
+ ruby: [2.7]
10
+ runs-on: ${{ matrix.os }}
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: ${{ matrix.ruby }}
16
+ bundler-cache: true
17
+ - name: Install Rubocop
18
+ run: gem install rubocop code-scanning-rubocop
19
+ - name: Rubocop run --no-doc
20
+ run: |
21
+ bash -c "
22
+ rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
23
+ [[ $? -ne 2 ]]
24
+ "
25
+ - name: Upload Sarif output
26
+ uses: github/codeql-action/upload-sarif@v1
27
+ with:
28
+ sarif_file: rubocop.sarif
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,22 @@
1
+ Layout/LineLength:
2
+ Max: 120
3
+ Metrics/MethodLength:
4
+ Max: 30
5
+ Metrics/ClassLength:
6
+ Max: 1500
7
+ Metrics/BlockLength:
8
+ Max: 50
9
+ Metrics/AbcSize:
10
+ Max: 30
11
+ Style/Documentation:
12
+ Enabled: false
13
+ AllCops:
14
+ TargetRubyVersion: 2.5
15
+ NewCops: enable
16
+ SuggestExtensions: false
17
+ Style/FrozenStringLiteralComment:
18
+ Enabled: false
19
+ Naming/FileName:
20
+ Enabled: false
21
+ Style/ClassAndModuleChildren:
22
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # LEX::Redis
2
+
3
+ ## v0.1.1
4
+ Bumping version for GitHub migration
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at matthewdiverson@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Dockerfile ADDED
@@ -0,0 +1,5 @@
1
+ FROM legionio/legion:latest
2
+ LABEL maintainer="Matthew Iverson <matthewdiverson@gmail.com>"
3
+
4
+ RUN gem install lex-redis --no-document --no-prerelease
5
+ CMD ruby --jit $(which legionio)
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ group :test do
5
+ gem 'rake'
6
+ gem 'rspec'
7
+ gem 'rspec_junit_formatter'
8
+ gem 'rubocop'
9
+ gem 'simplecov'
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lex-redis (0.1.1)
5
+ redis
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ diff-lcs (1.4.4)
12
+ docile (1.4.0)
13
+ parallel (1.20.1)
14
+ parser (3.0.1.1)
15
+ ast (~> 2.4.1)
16
+ rainbow (3.0.0)
17
+ rake (13.0.3)
18
+ redis (4.3.1)
19
+ regexp_parser (2.1.1)
20
+ rexml (3.2.5)
21
+ rspec (3.10.0)
22
+ rspec-core (~> 3.10.0)
23
+ rspec-expectations (~> 3.10.0)
24
+ rspec-mocks (~> 3.10.0)
25
+ rspec-core (3.10.1)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-expectations (3.10.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-mocks (3.10.2)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.10.0)
33
+ rspec-support (3.10.2)
34
+ rspec_junit_formatter (0.4.1)
35
+ rspec-core (>= 2, < 4, != 2.12.0)
36
+ rubocop (1.16.1)
37
+ parallel (~> 1.10)
38
+ parser (>= 3.0.0.0)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ regexp_parser (>= 1.8, < 3.0)
41
+ rexml
42
+ rubocop-ast (>= 1.7.0, < 2.0)
43
+ ruby-progressbar (~> 1.7)
44
+ unicode-display_width (>= 1.4.0, < 3.0)
45
+ rubocop-ast (1.7.0)
46
+ parser (>= 3.0.1.1)
47
+ ruby-progressbar (1.11.0)
48
+ simplecov (0.21.2)
49
+ docile (~> 1.1)
50
+ simplecov-html (~> 0.11)
51
+ simplecov_json_formatter (~> 0.1)
52
+ simplecov-html (0.12.3)
53
+ simplecov_json_formatter (0.1.3)
54
+ unicode-display_width (2.0.0)
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ lex-redis!
61
+ rake
62
+ rspec
63
+ rspec_junit_formatter
64
+ rubocop
65
+ simplecov
66
+
67
+ BUNDLED WITH
68
+ 2.1.4
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,3 @@
1
+ # Legion::Extensions::Redis
2
+
3
+ Connects LegionIO to Redis
data/docker_deploy.rb ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ long_name = 'lex-redis'
4
+ name = 'redis'
5
+ require "./lib/legion/extensions/#{name}/version"
6
+ version = Legion::Extensions::Redis::VERSION
7
+
8
+ system("gem build #{long_name}.gemspec")
9
+ system("gh release create v#{version} '#{long_name}-#{version}.gem'")
10
+ system("gem push #{long_name}-#{version}.gem")
11
+ system("gem push --key github --host https://rubygems.pkg.github.com/LegionIO #{long_name}-#{version}.gem")
12
+
13
+ puts "Building docker image for Legion v#{version}"
14
+ system("docker build --tag legionio/lex-#{name}:v#{version} .")
15
+ system("docker build --tag legionio/lex-#{name}:latest .")
16
+ puts 'Pushing to hub.docker.com'
17
+ system("docker push legionio/lex-#{name}:v#{version}")
18
+ system("docker push legionio/lex-#{name}:latest")
19
+ puts 'completed'
data/lex-redis.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ require_relative 'lib/legion/extensions/redis/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'lex-redis'
5
+ spec.version = Legion::Extensions::Redis::VERSION
6
+ spec.authors = ['Esity']
7
+ spec.email = ['matthewdiverson@gmail.com']
8
+
9
+ spec.summary = 'LEX::redis'
10
+ spec.description = 'Connects LegionIO to Redis Servers'
11
+ spec.homepage = 'https://github.com/LegionIO/lex-redis'
12
+ spec.license = 'MIT'
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
14
+
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+ spec.metadata['source_code_uri'] = 'https://github.com/LegionIO/lex-redis'
17
+ spec.metadata['documentation_uri'] = 'https://github.com/LegionIO/lex-redis'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/LegionIO/lex-redis'
19
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/LegionIO/lex-redis/issues'
20
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+ spec.require_paths = ['lib']
24
+ spec.add_dependency 'redis'
25
+ end
@@ -0,0 +1,9 @@
1
+ require 'legion/extensions/redis/version'
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Redis
6
+ extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ require 'redis'
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Redis
6
+ module Helpers
7
+ module Client
8
+ def self.client(host: '127.0.0.1', port: 6380, **opts)
9
+ connect_hash = { host: host, port: port }
10
+ connect_hash[:db] = opts[:db] if opts.key? :db
11
+ connect_hash[:password] = opts[:password] if opts.key? :password
12
+ Redis.new(**connect_hash)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,46 @@
1
+ require 'legion/extensions/redis/helpers/client'
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Redis
6
+ module Runners
7
+ module Item
8
+ def get(key:, **opts)
9
+ { result: client(**opts).get(key) }
10
+ end
11
+
12
+ def decrement(key:, number: 1, **opts)
13
+ { result: client(**opts).decrby(key, number) }
14
+ end
15
+
16
+ def delete(key:, **opts)
17
+ { result: client(**opts).del(key) }
18
+ end
19
+
20
+ def exists(key:, **opts)
21
+ { result: client(**opts).exists?(key) }
22
+ end
23
+
24
+ def increment(key:, number: 1, **opts)
25
+ { result: client(**opts).incrby(key, number) }
26
+ end
27
+
28
+ def keys(glob: '*', **opts)
29
+ { result: client(**opts).keys(glob) }
30
+ end
31
+
32
+ def rename(old_key, key:, **opts)
33
+ { result: client(**opts).rename(old_key, key) }
34
+ end
35
+
36
+ def set(key:, value:, ttl: nil, **opts)
37
+ { result: client(**opts).set(key, value, ex: ttl) }
38
+ end
39
+
40
+ extend Legion::Extensions::Redis::Helpers::Client
41
+ include Legion::Extensions::Helpers::Lex
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,38 @@
1
+ require 'legion/extensions/redis/helpers/client'
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Redis
6
+ module Runners
7
+ module Server
8
+ def keys(glob: '*', **opts)
9
+ { result: client(**opts).keys(glob) }
10
+ end
11
+
12
+ def ping(message: nil, **opts)
13
+ { result: client(**opts).ping(message) }
14
+ end
15
+
16
+ def save(**opts)
17
+ { result: client(**opts).save }
18
+ end
19
+
20
+ def time(**opts)
21
+ { result: client(**opts).time }
22
+ end
23
+
24
+ def flushall(**opts)
25
+ { result: client(**opts).flushall }
26
+ end
27
+
28
+ def flush_db(db: 0, **opts)
29
+ { results: client(db: db, **opts).flushdb(db) }
30
+ end
31
+
32
+ extend Legion::Extensions::Redis::Helpers::Client
33
+ include Legion::Extensions::Helpers::Lex
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,7 @@
1
+ module Legion
2
+ module Extensions
3
+ module Redis
4
+ VERSION = '0.1.1'.freeze
5
+ end
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-27 00:00:00.000000000 Z
11
+ date: 2021-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -24,22 +24,41 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: LEX::redis
27
+ description: Connects LegionIO to Redis Servers
28
28
  email:
29
29
  - matthewdiverson@gmail.com
30
30
  executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
- files: []
34
- homepage: https://bitbucket.org/legion-io/lex-redis
33
+ files:
34
+ - ".github/workflows/rspec.yml"
35
+ - ".github/workflows/rubocop.yml"
36
+ - ".gitignore"
37
+ - ".rspec"
38
+ - ".rubocop.yml"
39
+ - CHANGELOG.md
40
+ - CODE_OF_CONDUCT.md
41
+ - Dockerfile
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - LICENSE
45
+ - README.md
46
+ - docker_deploy.rb
47
+ - lex-redis.gemspec
48
+ - lib/legion/extensions/redis.rb
49
+ - lib/legion/extensions/redis/helpers/client.rb
50
+ - lib/legion/extensions/redis/runners/item.rb
51
+ - lib/legion/extensions/redis/runners/server.rb
52
+ - lib/legion/extensions/redis/version.rb
53
+ homepage: https://github.com/LegionIO/lex-redis
35
54
  licenses:
36
55
  - MIT
37
56
  metadata:
38
- homepage_uri: https://bitbucket.org/legion-io/lex-redis
39
- source_code_uri: https://bitbucket.org/legion-io/lex-redis
40
- documentation_uri: https://legionio.atlassian.net/wiki/spaces/LEX/pages/614891585
41
- changelog_uri: https://legionio.atlassian.net/wiki/spaces/LEX/pages/612270191
42
- bug_tracker_uri: https://bitbucket.org/legion-io/lex-redis/issues
57
+ homepage_uri: https://github.com/LegionIO/lex-redis
58
+ source_code_uri: https://github.com/LegionIO/lex-redis
59
+ documentation_uri: https://github.com/LegionIO/lex-redis
60
+ changelog_uri: https://github.com/LegionIO/lex-redis
61
+ bug_tracker_uri: https://github.com/LegionIO/lex-redis/issues
43
62
  post_install_message:
44
63
  rdoc_options: []
45
64
  require_paths:
@@ -55,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
74
  - !ruby/object:Gem::Version
56
75
  version: '0'
57
76
  requirements: []
58
- rubygems_version: 3.1.2
77
+ rubygems_version: 3.1.6
59
78
  signing_key:
60
79
  specification_version: 4
61
80
  summary: LEX::redis