blendris 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/Manifest +2 -1
- data/{README.rdoc → README.markdown} +39 -25
- data/Rakefile +4 -3
- data/blendris.gemspec +4 -4
- data/lib/blendris.rb +2 -0
- data/lib/blendris/accessor.rb +0 -2
- data/lib/blendris/model.rb +5 -3
- data/spec/redis-tools_spec.rb +2 -0
- data/spec/spec_helper.rb +5 -4
- metadata +5 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/Manifest
CHANGED
@@ -1,59 +1,73 @@
|
|
1
|
-
|
1
|
+
# Blendris #
|
2
2
|
|
3
3
|
* http://github.com/alexmchale/blendris
|
4
4
|
|
5
|
-
|
5
|
+
|
6
|
+
|
7
|
+
# DESCRIPTION #
|
6
8
|
|
7
9
|
Blendris is a Ruby interface to a Redis database.
|
8
10
|
|
9
|
-
== FEATURES/PROBLEMS:
|
10
11
|
|
11
|
-
== SYNOPSIS:
|
12
12
|
|
13
|
-
|
13
|
+
# FEATURES/PROBLEMS #
|
14
|
+
|
15
|
+
BLENDRIS IS IN VERY EARLY ALPHA!!!
|
16
|
+
|
17
|
+
PLEASE DON'T USE IT FOR ANYTHING IMPORTANT YET!!!
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
# REQUIREMENTS #
|
14
22
|
|
15
23
|
* Blendris uses the redis RubyGem.
|
16
24
|
|
17
|
-
|
25
|
+
|
26
|
+
|
27
|
+
# INSTALL #
|
18
28
|
|
19
29
|
* gem install blendris
|
20
30
|
|
21
|
-
|
31
|
+
|
32
|
+
|
33
|
+
# EXAMPLES #
|
22
34
|
|
23
35
|
The following would create a Website model that knows its url and
|
24
36
|
paths within the website.
|
25
37
|
|
26
|
-
|
27
|
-
|
38
|
+
class Website < Blendris::Model
|
39
|
+
key "website", :title
|
28
40
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
41
|
+
string :title
|
42
|
+
string :url
|
43
|
+
set :paths
|
44
|
+
end
|
33
45
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
46
|
+
website = Website.create("One Fake Website")
|
47
|
+
website.url = "http://fakewebsite.com"
|
48
|
+
website.paths << "/blog/index"
|
49
|
+
website.paths << "/admin/index"
|
38
50
|
|
39
51
|
The above would create the following Redis keys:
|
40
52
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
53
|
+
website:One_Fake_Website => "Website" (This identifies the model type)
|
54
|
+
website:One_Fake_Website:name => "One Fake Website"
|
55
|
+
website:One_Fake_Website:url => "http://fakewebsite.com"
|
56
|
+
website:One_Fake_Website:paths => [ "/blog/index", "/admin/index" ]
|
45
57
|
|
46
58
|
Now suppose we want to open the Website model back up to add a concept of sister sites:
|
47
59
|
|
48
|
-
|
49
|
-
|
50
|
-
|
60
|
+
class Website
|
61
|
+
refs :sister_sites, :class => Website, :reverse => :sister_sites
|
62
|
+
end
|
51
63
|
|
52
64
|
This will cause the website to maintain a set of other websites. The reverse tag
|
53
65
|
causes the other website's sister_sites set to be updated when it is added or removed
|
54
66
|
from this site's list.
|
55
67
|
|
56
|
-
|
68
|
+
|
69
|
+
|
70
|
+
# LICENSE #
|
57
71
|
|
58
72
|
(The MIT License)
|
59
73
|
|
data/Rakefile
CHANGED
@@ -5,10 +5,11 @@ gem "redis", ">= 0.1.2"
|
|
5
5
|
|
6
6
|
require "echoe"
|
7
7
|
|
8
|
-
require
|
9
|
-
require
|
8
|
+
require "redis"
|
9
|
+
require "fileutils"
|
10
|
+
require "./lib/blendris"
|
10
11
|
|
11
|
-
Echoe.new("blendris", "0.0.
|
12
|
+
Echoe.new("blendris", "0.0.2") do |p|
|
12
13
|
|
13
14
|
p.description = "A redis library for Ruby"
|
14
15
|
p.url = "http://github.com/alexmchale/blendris"
|
data/blendris.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{blendris}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Alex McHale"]
|
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.date = %q{2010-02-11}
|
11
11
|
s.description = %q{A redis library for Ruby}
|
12
12
|
s.email = %q{alexmchale@gmail.com}
|
13
|
-
s.extra_rdoc_files = ["README.
|
14
|
-
s.files = ["History.txt", "Manifest", "PostInstall.txt", "README.
|
13
|
+
s.extra_rdoc_files = ["README.markdown", "lib/blendris.rb", "lib/blendris/accessor.rb", "lib/blendris/errors.rb", "lib/blendris/integer.rb", "lib/blendris/list.rb", "lib/blendris/model.rb", "lib/blendris/node.rb", "lib/blendris/reference.rb", "lib/blendris/reference_base.rb", "lib/blendris/reference_set.rb", "lib/blendris/set.rb", "lib/blendris/string.rb", "lib/blendris/types.rb", "lib/blendris/utils.rb", "tasks/rspec.rake"]
|
14
|
+
s.files = ["History.txt", "Manifest", "PostInstall.txt", "README.markdown", "Rakefile", "autotest/discover.rb", "blendris.gemspec", "lib/blendris.rb", "lib/blendris/accessor.rb", "lib/blendris/errors.rb", "lib/blendris/integer.rb", "lib/blendris/list.rb", "lib/blendris/model.rb", "lib/blendris/node.rb", "lib/blendris/reference.rb", "lib/blendris/reference_base.rb", "lib/blendris/reference_set.rb", "lib/blendris/set.rb", "lib/blendris/string.rb", "lib/blendris/types.rb", "lib/blendris/utils.rb", "script/console", "script/destroy", "script/generate", "spec/list_spec.rb", "spec/model_spec.rb", "spec/redis-tools_spec.rb", "spec/ref_spec.rb", "spec/set_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/string_spec.rb", "tasks/rspec.rake"]
|
15
15
|
s.homepage = %q{http://github.com/alexmchale/blendris}
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Blendris", "--main", "README.
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Blendris", "--main", "README.markdown"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{blendris}
|
19
19
|
s.rubygems_version = %q{1.3.5}
|
data/lib/blendris.rb
CHANGED
data/lib/blendris/accessor.rb
CHANGED
data/lib/blendris/model.rb
CHANGED
@@ -108,10 +108,12 @@ module Blendris
|
|
108
108
|
# Defines a new data type for Blendris:Model construction.
|
109
109
|
def type(name, klass)
|
110
110
|
(class << self; self; end).instance_eval do
|
111
|
-
define_method
|
112
|
-
|
111
|
+
define_method(name) do |*args|
|
112
|
+
varname = args.shift.to_s
|
113
|
+
options = args.shift || {}
|
114
|
+
|
113
115
|
options[:type] = klass
|
114
|
-
redis_symbols[varname
|
116
|
+
redis_symbols[varname] = options
|
115
117
|
end
|
116
118
|
end
|
117
119
|
end
|
data/spec/redis-tools_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,9 @@ rescue LoadError
|
|
7
7
|
end
|
8
8
|
|
9
9
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
|
-
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
require "./lib/blendris"
|
11
13
|
|
12
14
|
include Blendris
|
13
15
|
|
@@ -59,10 +61,9 @@ module TestFixtures
|
|
59
61
|
end
|
60
62
|
|
61
63
|
Spec::Runner.configure do |config|
|
62
|
-
|
63
|
-
extend RedisAccessor
|
64
|
-
extend TestFixtures
|
64
|
+
include TestFixtures
|
65
65
|
|
66
|
+
config.before(:each) do
|
66
67
|
RedisAccessor.prefix = "blendris-spec:"
|
67
68
|
RedisAccessor.flush_keys
|
68
69
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blendris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex McHale
|
@@ -41,7 +41,7 @@ executables: []
|
|
41
41
|
extensions: []
|
42
42
|
|
43
43
|
extra_rdoc_files:
|
44
|
-
- README.
|
44
|
+
- README.markdown
|
45
45
|
- lib/blendris.rb
|
46
46
|
- lib/blendris/accessor.rb
|
47
47
|
- lib/blendris/errors.rb
|
@@ -61,9 +61,10 @@ files:
|
|
61
61
|
- History.txt
|
62
62
|
- Manifest
|
63
63
|
- PostInstall.txt
|
64
|
-
- README.
|
64
|
+
- README.markdown
|
65
65
|
- Rakefile
|
66
66
|
- autotest/discover.rb
|
67
|
+
- blendris.gemspec
|
67
68
|
- lib/blendris.rb
|
68
69
|
- lib/blendris/accessor.rb
|
69
70
|
- lib/blendris/errors.rb
|
@@ -90,7 +91,6 @@ files:
|
|
90
91
|
- spec/spec_helper.rb
|
91
92
|
- spec/string_spec.rb
|
92
93
|
- tasks/rspec.rake
|
93
|
-
- blendris.gemspec
|
94
94
|
has_rdoc: true
|
95
95
|
homepage: http://github.com/alexmchale/blendris
|
96
96
|
licenses: []
|
@@ -102,7 +102,7 @@ rdoc_options:
|
|
102
102
|
- --title
|
103
103
|
- Blendris
|
104
104
|
- --main
|
105
|
-
- README.
|
105
|
+
- README.markdown
|
106
106
|
require_paths:
|
107
107
|
- lib
|
108
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|