redness 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gem "json"
4
+ gem "rspec"
5
+ gem "redis", "~> 2.2.2"
6
+ gem "activesupport"
7
+ gem "timecop"
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.3)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ diff-lcs (1.1.3)
8
+ i18n (0.6.0)
9
+ json (1.6.6)
10
+ multi_json (1.3.2)
11
+ redis (2.2.2)
12
+ rspec (2.9.0)
13
+ rspec-core (~> 2.9.0)
14
+ rspec-expectations (~> 2.9.0)
15
+ rspec-mocks (~> 2.9.0)
16
+ rspec-core (2.9.0)
17
+ rspec-expectations (2.9.1)
18
+ diff-lcs (~> 1.1.3)
19
+ rspec-mocks (2.9.0)
20
+ timecop (0.3.5)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ activesupport
27
+ json
28
+ redis (~> 2.2.2)
29
+ rspec
30
+ timecop
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # Redness
2
+
3
+ Simple data structures for Redis-backed Ruby applications
4
+
5
+ ### Description
6
+
7
+ Redness extends the redis-rb client library with useful data structures. It provides higher-level access
8
+ to Redis than the client library while remaining more composable and minimal than a full-featured ORM.
9
+
10
+ ### Installation
11
+ ``
12
+ gem install redness
13
+ ``
14
+
15
+ ### Playing Around (read the tests for more examples)
16
+ ```ruby
17
+ require 'redis'
18
+ require 'json'
19
+ require 'redness'
20
+
21
+ $redis = Redis.new
22
+
23
+ # RedJSON represents a collection of data as JSON
24
+ RedJSON.set("foo", {:foo => ["bar", "baz", "buzz"]})
25
+ #=> "OK"
26
+ RedJSON.get("foo")
27
+ #=> {"foo"=>["bar", "baz", "buzz"]}
28
+
29
+ # RedList represents a standard list of data
30
+ RedList.get("users:1:viewers")
31
+ #=> [1]
32
+ RedList.add("users:1:viewers", 2)
33
+ #=> 2
34
+ RedList.get("users:1:viewers")
35
+ #=> [2, 1]
36
+ RedList.add("users:1:viewers", 2)
37
+ #=> 2
38
+ RedList.get("users:1:viewers")
39
+ #=> [2, 2, 1]
40
+
41
+ # RedCappedList is a list of data capped at a max length
42
+ capped_list = RedCappedList.new("somekey", 2)
43
+ capped_list.get
44
+ #=> []
45
+ capped_list.add(1)
46
+ #=> "OK"
47
+ capped_list.get
48
+ #=> [1]
49
+ capped_list.add(2)
50
+ #=> "OK"
51
+ capped_list.get
52
+ #=> [2, 1]
53
+ capped_list.add(3)
54
+ #=> "OK"
55
+ capped_list.get
56
+ #=> [3, 2]
57
+
58
+ # RedSet represents a unique set of data
59
+ RedSet.add("myset", 1)
60
+ #=> [1]
61
+ RedSet.add("myset", 1)
62
+ #=> nil
63
+ RedSet.get("myset")
64
+ #=> [1]
65
+ RedSet.add("myset", 2)
66
+ RedSet.get("myset")
67
+ #=> [2, 1]
68
+ RedSet.remove("myset", 2)
69
+ #=> true
70
+ RedSet.get("myset")
71
+ #=> [1]
72
+ # You can specify upper and lower bounds...
73
+ RedSet.get("myset").each { |i| RedSet.remove("myset", i) }
74
+ RedSet.get("myset")
75
+ #=> []
76
+ 1.upto(10).each { |i| RedSet.add("myset", i) }
77
+ RedSet.get("myset")
78
+ #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
79
+ RedSet.get("myset", lower: 2, upper: 7)
80
+ #=> [8, 7, 6, 5, 4, 3]
81
+ RedSet.count("myset")
82
+ #=> 10
83
+
84
+ # RedHash represents a data collection as a Ruby hash
85
+ red_hash = RedHash.new("test")
86
+ red_hash[:mykey]
87
+ #=> nil
88
+ red_hash[:mykey] = "value"
89
+ red_hash[:mykey]
90
+ #=> "value"
91
+ red_hash.all
92
+ #=> {"mykey"=>"value"}
93
+ red_hash.remove(:mykey)
94
+ red_hash.all
95
+ #=> {}
96
+
97
+ # RedExpire expires the collection with the
98
+ # provided key in a given number of seconds
99
+ RedList.new("somelist")
100
+ RedList.add("somelist", 0)
101
+ # => 1
102
+ >> RedList.get("somelist")
103
+ #=> [1]
104
+ # Expire the 'somelist' RedList in 1 second
105
+ RedExpire.set("somelist", 1.second)
106
+ #=> true
107
+ RedList.get("somelist")
108
+ #=> []
109
+ ```
110
+
111
+ ### TODO
112
+
113
+ * Ensure all CRUD methods exist for all classes
114
+ * Unify interfaces and method names across all classes (and remove the singleton pattern wherever it is found)
115
+
116
+ ### Copyright
117
+
118
+ Copyright (c) 2012 HowAboutWe. See LICENSE.txt for further details.
data/lib/redness.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  require "redness/red"
2
+ require "redness/red_list"
2
3
  require "redness/red_capped_list"
3
4
  require "redness/red_expire"
4
5
  require "redness/red_hash"
5
6
  require "redness/red_json"
6
- require "redness/red_list"
7
7
  require "redness/red_set"
8
8
  require "redness/red_set_multi"
9
9
  require "redness/red_set_union"
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Redness
2
- VERSION="0.0.2"
2
+ VERSION="0.0.3"
3
3
  MAJOR, MINOR, TINY = VERSION.split(".")
4
4
  end
data/redness.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.homepage = "http://github.com/howaboutwe/redness"
19
19
  s.licenses = ["MIT"]
20
20
  s.files = `git ls-files`.split("\n")
21
+ s.add_dependency "json"
21
22
  s.add_dependency "rspec"
22
23
  s.add_dependency "redis", "~> 2.2.2"
23
24
  s.add_dependency "activesupport"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,11 +14,27 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2012-04-20 00:00:00.000000000Z
17
+ date: 2012-04-27 00:00:00.000000000 Z
18
18
  dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: json
21
+ requirement: !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ type: :runtime
28
+ prerelease: false
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
19
35
  - !ruby/object:Gem::Dependency
20
36
  name: rspec
21
- requirement: &70145297776720 !ruby/object:Gem::Requirement
37
+ requirement: !ruby/object:Gem::Requirement
22
38
  none: false
23
39
  requirements:
24
40
  - - ! '>='
@@ -26,10 +42,15 @@ dependencies:
26
42
  version: '0'
27
43
  type: :runtime
28
44
  prerelease: false
29
- version_requirements: *70145297776720
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
30
51
  - !ruby/object:Gem::Dependency
31
52
  name: redis
32
- requirement: &70145297776220 !ruby/object:Gem::Requirement
53
+ requirement: !ruby/object:Gem::Requirement
33
54
  none: false
34
55
  requirements:
35
56
  - - ~>
@@ -37,10 +58,15 @@ dependencies:
37
58
  version: 2.2.2
38
59
  type: :runtime
39
60
  prerelease: false
40
- version_requirements: *70145297776220
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 2.2.2
41
67
  - !ruby/object:Gem::Dependency
42
68
  name: activesupport
43
- requirement: &70145297775800 !ruby/object:Gem::Requirement
69
+ requirement: !ruby/object:Gem::Requirement
44
70
  none: false
45
71
  requirements:
46
72
  - - ! '>='
@@ -48,10 +74,15 @@ dependencies:
48
74
  version: '0'
49
75
  type: :runtime
50
76
  prerelease: false
51
- version_requirements: *70145297775800
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
52
83
  - !ruby/object:Gem::Dependency
53
84
  name: timecop
54
- requirement: &70145297775340 !ruby/object:Gem::Requirement
85
+ requirement: !ruby/object:Gem::Requirement
55
86
  none: false
56
87
  requirements:
57
88
  - - ! '>='
@@ -59,7 +90,12 @@ dependencies:
59
90
  version: '0'
60
91
  type: :runtime
61
92
  prerelease: false
62
- version_requirements: *70145297775340
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
63
99
  description: Helpful Ruby classes for improved Redis data structures
64
100
  email: dev@howaboutwe.com
65
101
  executables: []
@@ -67,9 +103,11 @@ extensions: []
67
103
  extra_rdoc_files: []
68
104
  files:
69
105
  - .gitignore
106
+ - Gemfile
107
+ - Gemfile.lock
70
108
  - LICENSE.txt
71
109
  - RAKEFILE
72
- - README.rdoc
110
+ - README.md
73
111
  - Rakefile
74
112
  - lib/redness.rb
75
113
  - lib/redness/red.rb
@@ -117,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
155
  version: '0'
118
156
  requirements: []
119
157
  rubyforge_project:
120
- rubygems_version: 1.8.15
158
+ rubygems_version: 1.8.21
121
159
  signing_key:
122
160
  specification_version: 3
123
161
  summary: Helpful Ruby classes for improved Redis data structures
data/README.rdoc DELETED
@@ -1 +0,0 @@
1
- WIP