oxblood 0.1.0.dev1 → 0.1.0.dev2

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
  SHA1:
3
- metadata.gz: e3f412e0d96b8bf2a8520c3bea9465376bf3f5ea
4
- data.tar.gz: fcbe20525510727bd767ff3e134ae35f8d7572cc
3
+ metadata.gz: 4a00f0943e58421dc3712679260605e17607e709
4
+ data.tar.gz: 8cf70de44aaa9dc92d6c58c614781548ee3db53b
5
5
  SHA512:
6
- metadata.gz: 16ff977840a0feea5e931f0427e1f5bd8afa67336964b180a7dc166f5df6a042efde3251c9a1abfd65518aa147fbd8c1a8515dd77f89579c6997d6857288bc69
7
- data.tar.gz: 791cd9fea4d673513a28b2e81f16b554ecb216c628cfbb97c9647715be065a8a34dc782aea4d6c06f4bc048cade2d9df9a2aced7ba43da8ab02cbf10a6321a3d
6
+ metadata.gz: 90fd668f8be2a153061537d565c0470f9202121b88bf64c8ee82e03b4d057d5a34a1cf6a7a989ffa225afba91406e7342901b9c696f7c2988ac6c0b56c4d3881
7
+ data.tar.gz: eab75bed05a363806827dffed9bcfe0f32b51d900fc4e31248eb1c42d44ebfc7549e61e3941e027854d345536b7d14fc9cfc84b5ea2ca91c0c7c64897c95684e
data/.codeclimate.yml ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ fixme:
9
+ enabled: true
10
+ rubocop:
11
+ enabled: true
12
+ ratings:
13
+ paths:
14
+ - "**.rb"
15
+ exclude_paths:
16
+ - spec/
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ sudo: false
2
+
3
+ language: ruby
4
+
5
+ rvm:
6
+ - 2.2.5
7
+ - 2.3.1
8
+ - jruby-9.0.5.0
9
+ - jruby-9.1.2.0
10
+
11
+ services:
12
+ - redis-server
13
+
14
+ addons:
15
+ code_climate:
16
+ repo_token:
17
+ secure: ja+veIG40Hh2QJ75AQtT5Ip2a+SuiBTAQBRFtFEFiqGsXbkKjRw46qDumCIENCphkSjqnXcBYDhGUGjlXA3f4y6VSjr5+nw9PxvksvMnzEzT02UYs4OtqcBXuIH/F7UMylFFGmQmfnfxMOBGYn7ic5za9xGbzvgjwOnIl3x9kb2HW1cyKpH3tW/NgcRKJZjvJoQMOcMtaojtOdRc7wLypQdfDYW2NnvF338CVjSg7nAixNzRsCXgVa+ToeSLZWeg2pkT6Bt+sPwuFqPBybZEpWWe7NMUDtJuv610WPhBmWWnuQ/ncrTwOjs0DrUbQCofZb0EdSKy+JcqVTA57MP9X5s1okccdlXzFhnshFElKjCRE3As2IiAq0OINhRCJYYbUBac9MOJL+iZYEyhH6TydiwXJTvdHeKR39Fc2Em3ZiWCvsNqbvpP3/bEXDkZVeX6WfpKdlgeXo8VgtPj7ORyZpAQ234Ja685HpLpoSfRRFuHqZAhmUh42Hmy/IFgVtaj4Esvz3cwEhcZk4fzacAY+6uAKnJZQsi/DOwfJ68VSNTsoAgDBJiKpdBHB7k/XNG9yWQv1vcsWK3/UC8Os9lgTXcQg49CBaVb3+y9RReWjQzqQW9ACJfxuDXYhZKGgWEdl5FfuSLO65k2Iq1Qracf6vwutFN5a2McR0wtxqhAdYU=
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'codeclimate-test-reporter', group: :test, require: nil
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Oxblood
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/oxblood.svg)](https://badge.fury.io/rb/oxblood)
4
+ [![Code Climate](https://codeclimate.com/github/etehtsea/oxblood/badges/gpa.svg)](https://codeclimate.com/github/etehtsea/oxblood)
5
+ [![Test Coverage](https://codeclimate.com/github/etehtsea/oxblood/badges/coverage.svg)](https://codeclimate.com/github/etehtsea/oxblood/coverage)
6
+ [![Issue Count](https://codeclimate.com/github/etehtsea/oxblood/badges/issue_count.svg)](https://codeclimate.com/github/etehtsea/oxblood)
7
+
3
8
  An experimental Redis Ruby client.
4
9
 
5
10
  ## Usage
@@ -27,6 +32,9 @@ pool.with { |c| c.ping }
27
32
  => Redis::Connection::Oxblood
28
33
  ```
29
34
 
35
+ ## Continuous Integration
36
+
37
+ [![Build Status](https://travis-ci.org/etehtsea/oxblood.svg?branch=master)](https://travis-ci.org/etehtsea/oxblood)
30
38
 
31
39
  ## Contributing
32
40
 
data/Rakefile CHANGED
@@ -1,2 +1,9 @@
1
1
  require 'bundler/gem_tasks'
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ rescue LoadError
7
+ end
8
+
2
9
  task default: :spec
@@ -1,6 +1,10 @@
1
1
  module Oxblood
2
2
  module Command
3
3
  class << self
4
+ #
5
+ # Hashes
6
+ #
7
+
4
8
  def hdel(key, fields)
5
9
  serialize([:HDEL, key, fields])
6
10
  end
@@ -9,20 +13,56 @@ module Oxblood
9
13
  serialize([:HEXISTS, key, field])
10
14
  end
11
15
 
12
- def hmset(key, *args)
13
- serialize(args.unshift(:HMSET, key))
14
- end
15
-
16
16
  def hget(key, field)
17
17
  serialize([:HGET, key, field])
18
18
  end
19
19
 
20
+ def hgetall(key)
21
+ serialize([:HGETALL, key])
22
+ end
23
+
24
+ def hincrby(key, field, increment)
25
+ serialize([:HINCRBY, key, field, increment])
26
+ end
27
+
28
+ def hincrbyfloat(key, field, increment)
29
+ serialize([:HINCRBYFLOAT, key, field, increment])
30
+ end
31
+
32
+ def hkeys(key)
33
+ serialize([:HKEYS, key])
34
+ end
35
+
36
+ def hlen(key)
37
+ serialize([:HLEN, key])
38
+ end
39
+
20
40
  def hmget(key, *fields)
21
41
  serialize(fields.unshift(:HMGET, key))
22
42
  end
23
43
 
24
- def hgetall(key)
25
- serialize([:HGETALL, key])
44
+ def hmset(key, *args)
45
+ serialize(args.unshift(:HMSET, key))
46
+ end
47
+
48
+ def hset(key, field, value)
49
+ serialize([:HSET, key, field, value])
50
+ end
51
+
52
+ def hsetnx(key, field, value)
53
+ serialize([:HSETNX, key, field, value])
54
+ end
55
+
56
+ def hstrlen(key, field)
57
+ serialize([:HSTRLEN, key, field])
58
+ end
59
+
60
+ def hvals(key)
61
+ serialize([:HVALS, key])
62
+ end
63
+
64
+ def hscan(key, cursor)
65
+ raise 'Not implemented!'
26
66
  end
27
67
 
28
68
  # ------------------ Strings ---------------------
@@ -7,7 +7,9 @@ module Oxblood
7
7
  @connection = connection
8
8
  end
9
9
 
10
- # ------------------ Hashes ---------------------
10
+ #
11
+ # Hashes
12
+ #
11
13
 
12
14
  # Removes the specified fields from the hash stored at key
13
15
  # @see http://redis.io/commands/hdel
@@ -31,17 +33,6 @@ module Oxblood
31
33
  1 == run(cmd.hexists(key, field))
32
34
  end
33
35
 
34
- # Set multiple hash fields to multiple values
35
- # @see http://redis.io/commands/hmset
36
- #
37
- # @param [String] key under which store hash
38
- # @param [[String, String], Array<[String, String]>] args fields and values
39
- #
40
- # @return [String] 'OK'
41
- def hmset(key, *args)
42
- run(cmd.hmset(key, *args))
43
- end
44
-
45
36
  # Get the value of a hash field
46
37
  # @see http://redis.io/commands/hget
47
38
  #
@@ -54,6 +45,62 @@ module Oxblood
54
45
  run(cmd.hget(key, field))
55
46
  end
56
47
 
48
+ # Get all the fields and values in a hash
49
+ # @see http://redis.io/commands/hgetall
50
+ #
51
+ # @param [String] key under which hash is stored
52
+ #
53
+ # @return [Hash] of fields and their values
54
+ def hgetall(key)
55
+ Hash[*run(cmd.hgetall(key))]
56
+ end
57
+
58
+ # Increment the integer value of a hash field by the given number
59
+ # @see http://redis.io/commands/hincrby
60
+ #
61
+ # @param [String] key under which hash is stored
62
+ # @param [String] field to increment
63
+ # @param [Integer] increment by value
64
+ #
65
+ # @return [Integer] the value at field after the increment operation
66
+ def hincrby(key, field, increment)
67
+ run(cmd.hincrby(key, field, increment))
68
+ end
69
+
70
+ # Increment the float value of a hash field by the given number
71
+ # @see http://redis.io/commands/hincrby
72
+ #
73
+ # @param [String] key under which hash is stored
74
+ # @param [String] field to increment
75
+ # @param [Integer] increment by value
76
+ #
77
+ # @return [String] the value of field after the increment
78
+ def hincrbyfloat(key, field, increment)
79
+ run(cmd.hincrbyfloat(key, field, increment))
80
+ end
81
+
82
+ # Get all the keys in a hash
83
+ # @see http://redis.io/commands/hkeys
84
+ #
85
+ # @param [String] key
86
+ #
87
+ # @return [Array] list of fields in the hash, or an empty list when
88
+ # key does not exist.
89
+ def hkeys(key)
90
+ run(cmd.hkeys(key))
91
+ end
92
+
93
+ # Get the number of keys in a hash
94
+ # @see http://redis.io/commands/hlen
95
+ #
96
+ # @param [String] key
97
+ #
98
+ # @return [Integer] number of fields in the hash, or 0 when
99
+ # key does not exist.
100
+ def hlen(key)
101
+ run(cmd.hlen(key))
102
+ end
103
+
57
104
  # Get the field values of all given hash fields
58
105
  # @see http://redis.io/commands/hmget
59
106
  #
@@ -66,14 +113,72 @@ module Oxblood
66
113
  run(cmd.hmget(key, *fields))
67
114
  end
68
115
 
69
- # Get all the fields and values in a hash
70
- # @see http://redis.io/commands/hgetall
116
+ # Set multiple hash fields to multiple values
117
+ # @see http://redis.io/commands/hmset
71
118
  #
72
- # @param [String] key under which hash is stored
119
+ # @param [String] key under which store hash
120
+ # @param [[String, String], Array<[String, String]>] args fields and values
73
121
  #
74
- # @return [Hash] of fields and their values
75
- def hgetall(key)
76
- Hash[*run(cmd.hgetall(key))]
122
+ # @return [String] 'OK'
123
+ def hmset(key, *args)
124
+ run(cmd.hmset(key, *args))
125
+ end
126
+
127
+
128
+ # Set the string value of a hash field
129
+ # @see http://redis.io/commands/hset
130
+ #
131
+ # @param [String] key
132
+ # @param [String] field
133
+ # @param [String] value
134
+ #
135
+ # @return [Integer] 1 if field is a new field in the hash and value was set.
136
+ # 0 if field already exists in the hash and the value was updated.
137
+ def hset(key, field, value)
138
+ run(cmd.hset(key, field, value))
139
+ end
140
+
141
+ # Set the value of a hash field, only if the field does not exist
142
+ # @see http://redis.io/commands/hsetnx
143
+ #
144
+ # @param [String] key
145
+ # @param [String] field
146
+ # @param [String] value
147
+ #
148
+ # @return [Integer] 1 if field is a new field in the hash and value was set.
149
+ # 0 if field already exists in the hash and no operation was performed.
150
+ def hsetnx(key, field, value)
151
+ run(cmd.hsetnx(key, field, value))
152
+ end
153
+
154
+ # Get the length of the value of a hash field
155
+ # @see http://redis.io/commands/hstrlen
156
+ #
157
+ # @param [String] key
158
+ # @param [String] field
159
+ #
160
+ # @return [Integer] the string length of the value associated with field,
161
+ # or 0 when field is not present in the hash or key does not exist at all.
162
+ def hstrlen(key, field)
163
+ run(cmd.hstrlen(key, field))
164
+ end
165
+
166
+ # Get all values in a hash
167
+ # @see http://redis.io/commands/hvals
168
+ #
169
+ # @param [String] key
170
+ #
171
+ # @return [Array] list of values in the hash, or an empty list when
172
+ # key does not exist
173
+ def hvals(key)
174
+ run(cmd.hvals(key))
175
+ end
176
+
177
+ # Incrementally iterate hash fields and associated values
178
+ # @see http://redis.io/commands/hscan
179
+ #
180
+ # @todo Implement this command
181
+ def hscan(key, cursor)
77
182
  end
78
183
 
79
184
  # ------------------ Strings ---------------------
@@ -1,3 +1,3 @@
1
1
  module Oxblood
2
- VERSION = '0.1.0.dev1'
2
+ VERSION = '0.1.0.dev2'
3
3
  end
data/oxblood.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
+ spec.required_ruby_version = '>= 2.2.2'
19
20
 
20
21
  spec.add_dependency 'connection_pool'
21
22
  spec.add_development_dependency 'bundler', '~> 1.11'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxblood
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.dev1
4
+ version: 0.1.0.dev2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Shabanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-02 00:00:00.000000000 Z
11
+ date: 2016-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -101,8 +101,10 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".codeclimate.yml"
104
105
  - ".gitignore"
105
106
  - ".rspec"
107
+ - ".travis.yml"
106
108
  - ".yardopts"
107
109
  - Gemfile
108
110
  - LICENSE.txt
@@ -133,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
135
  requirements:
134
136
  - - ">="
135
137
  - !ruby/object:Gem::Version
136
- version: '0'
138
+ version: 2.2.2
137
139
  required_rubygems_version: !ruby/object:Gem::Requirement
138
140
  requirements:
139
141
  - - ">"
@@ -141,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
143
  version: 1.3.1
142
144
  requirements: []
143
145
  rubyforge_project:
144
- rubygems_version: 2.6.4
146
+ rubygems_version: 2.5.1
145
147
  signing_key:
146
148
  specification_version: 4
147
149
  summary: A Ruby Redis client