nest 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +19 -3
  2. data/lib/nest.rb +14 -14
  3. data/nest.gemspec +1 -1
  4. metadata +2 -2
data/Rakefile CHANGED
@@ -8,14 +8,30 @@ task :default => :test
8
8
  task :commands do
9
9
  require "open-uri"
10
10
  require "par"
11
+ require "json"
11
12
 
12
13
  file = File.expand_path("lib/nest.rb", File.dirname(__FILE__))
13
- path = "http://dimaion.com/redis/master/keys"
14
+ path = "https://github.com/antirez/redis-doc/raw/master/commands.json"
14
15
 
15
- commands = open(path).read.split("\n")
16
+ commands = JSON.parse(open(path).read).select do |name, command|
17
+ # Skip all DEBUG commands
18
+ next if command["group"] == "server"
19
+
20
+ # If the command has no arguments, it doesn't operate on a key
21
+ next if command["arguments"].nil?
22
+
23
+ arg = command["arguments"].first
24
+
25
+ arg["type"] == "key" ||
26
+ Array(arg["name"]) == ["channel"]
27
+ end
28
+
29
+ commands = commands.keys.map { |key| key.downcase.to_sym }
30
+
31
+ commands.delete(:mget)
16
32
 
17
33
  source = File.read(file).sub(/ METHODS = .+?\n\n/m) do
18
- Par.new(" METHODS = #{commands.map(&:to_sym).inspect}\n\n", p: 2)
34
+ Par.new(" METHODS = #{commands.inspect}\n\n", p: 2)
19
35
  end
20
36
 
21
37
  File.open(file, "w") { |f| f.write source }
@@ -1,21 +1,21 @@
1
1
  require "redis"
2
2
 
3
3
  class Nest < String
4
- VERSION = "1.0.2"
4
+ VERSION = "1.1.0"
5
5
 
6
- METHODS = [:append, :blpop, :brpop, :decr, :decrby, :del, :exists,
7
- :expire, :expireat, :get, :getset, :hdel, :hexists, :hget, :hgetall,
8
- :hincrby, :hkeys, :hlen, :hmget, :hmset, :hset, :hsetnx, :hvals,
9
- :incr, :incrby, :lindex, :linsert, :llen, :lpop, :lpush, :lpushx,
10
- :lrange, :lrem, :lset, :ltrim, :move, :psubscribe, :publish,
11
- :punsubscribe, :rename, :renamenx, :rpop, :rpoplpush, :rpush,
12
- :rpushx, :sadd, :scard, :sdiff, :sdiffstore, :set, :setex, :setnx,
13
- :sinter, :sinterstore, :sismember, :smembers, :smove, :sort,
14
- :spop, :srandmember, :srem, :strlen, :subscribe, :substr, :sunion,
15
- :sunionstore, :ttl, :type, :unsubscribe, :watch, :zadd, :zcard,
16
- :zcount, :zincrby, :zinterstore, :zrange, :zrangebyscore, :zrank,
17
- :zrem, :zremrangebyrank, :zremrangebyscore, :zrevrange, :zrevrank,
18
- :zscore, :zunionstore]
6
+ METHODS = [:append, :blpop, :brpop, :brpoplpush, :decr, :decrby,
7
+ :del, :exists, :expire, :expireat, :get, :getbit, :getrange, :getset,
8
+ :hdel, :hexists, :hget, :hgetall, :hincrby, :hkeys, :hlen, :hmget,
9
+ :hmset, :hset, :hsetnx, :hvals, :incr, :incrby, :lindex, :linsert,
10
+ :llen, :lpop, :lpush, :lpushx, :lrange, :lrem, :lset, :ltrim, :move,
11
+ :persist, :publish, :rename, :renamenx, :rpop, :rpoplpush, :rpush,
12
+ :rpushx, :sadd, :scard, :sdiff, :sdiffstore, :set, :setbit, :setex,
13
+ :setnx, :setrange, :sinter, :sinterstore, :sismember, :smembers,
14
+ :smove, :sort, :spop, :srandmember, :srem, :strlen, :subscribe,
15
+ :sunion, :sunionstore, :ttl, :type, :unsubscribe, :watch, :zadd,
16
+ :zcard, :zcount, :zincrby, :zinterstore, :zrange, :zrangebyscore,
17
+ :zrank, :zrem, :zremrangebyrank, :zremrangebyscore, :zrevrange,
18
+ :zrevrangebyscore, :zrevrank, :zscore, :zunionstore]
19
19
 
20
20
  attr :redis
21
21
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nest"
3
- s.version = "1.0.2"
3
+ s.version = "1.1.0"
4
4
  s.summary = "Object-oriented keys for Redis."
5
5
  s.description = "It is a design pattern in key-value databases to use the key to simulate structure, and Nest can take care of that."
6
6
  s.authors = ["Michel Martens"]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 1
7
8
  - 0
8
- - 2
9
- version: 1.0.2
9
+ version: 1.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michel Martens