redis-plus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in redis-plus.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Joshua Flanagan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Redis::Plus
2
+
3
+ Extends the [ruby redis client](https://github.com/redis/redis-rb)
4
+ with additional general purpose commands.
5
+
6
+ Requires [Redis 2.6+](http://redis.io)
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'redis-plus'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install redis-plus
21
+
22
+ ## Usage
23
+
24
+ The new commands are available directly from any `Redis` connection instance:
25
+
26
+ ```ruby
27
+ r = Redis.new
28
+ r.rpush "numbers", "one"
29
+ r.rpush "numbers", "two"
30
+ r.rpush "numbers", "three"
31
+
32
+ # retrieve all elements of a list:
33
+ r.lgetall "numbers" #=> ["one", "two", "three"]
34
+ ```
35
+
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ RSpec::Core::RakeTask.new(:spec)
4
+
5
+ task :default => :spec
@@ -0,0 +1,5 @@
1
+ class Redis
2
+ module Plus
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/lib/redis/plus.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'redis'
2
+ require "redis/plus/version"
3
+
4
+ class Redis
5
+ module Plus
6
+ def lgetall(key)
7
+ lrange(key, 0, -1)
8
+ end
9
+ end
10
+
11
+ include Plus
12
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'redis/plus/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "redis-plus"
8
+ gem.version = Redis::Plus::VERSION
9
+ gem.authors = ["Joshua Flanagan"]
10
+ gem.email = ["joshuaflanagan@gmail.com"]
11
+ gem.description = %q{Extends the ruby client driver with additional commands}
12
+ gem.summary = %q{Extends the ruby client driver with additional commands}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.add_dependency "redis", ">=3.0.0"
19
+ gem.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,16 @@
1
+ require 'redis/plus'
2
+
3
+ describe "redis-plus" do
4
+ let(:redis) { Redis.new.tap{|r| r.select 15 } }
5
+ before { redis.flushdb }
6
+
7
+ describe "#lgetall" do
8
+ it "retrieves all values in a list" do
9
+ redis.rpush "numbers", "one"
10
+ redis.rpush "numbers", "two"
11
+ redis.rpush "numbers", "three"
12
+
13
+ redis.lgetall("numbers").should == ["one", "two", "three"]
14
+ end
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redis-plus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joshua Flanagan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-10-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: redis
16
+ prerelease: false
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
22
+ none: false
23
+ type: :runtime
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ! '>='
27
+ - !ruby/object:Gem::Version
28
+ version: 3.0.0
29
+ none: false
30
+ description: Extends the ruby client driver with additional commands
31
+ email:
32
+ - joshuaflanagan@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/redis/plus.rb
43
+ - lib/redis/plus/version.rb
44
+ - redis-plus.gemspec
45
+ - spec/redis-plus_spec.rb
46
+ homepage: ''
47
+ licenses: []
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ none: false
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ none: false
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 1.8.24
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Extends the ruby client driver with additional commands
70
+ test_files:
71
+ - spec/redis-plus_spec.rb