blendris 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
Binary file
data/Manifest CHANGED
@@ -1,9 +1,10 @@
1
1
  History.txt
2
2
  Manifest
3
3
  PostInstall.txt
4
- README.rdoc
4
+ README.markdown
5
5
  Rakefile
6
6
  autotest/discover.rb
7
+ blendris.gemspec
7
8
  lib/blendris.rb
8
9
  lib/blendris/accessor.rb
9
10
  lib/blendris/errors.rb
@@ -1,59 +1,73 @@
1
- = blendris
1
+ # Blendris #
2
2
 
3
3
  * http://github.com/alexmchale/blendris
4
4
 
5
- == DESCRIPTION:
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
- == REQUIREMENTS:
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
- == INSTALL:
25
+
26
+
27
+ # INSTALL #
18
28
 
19
29
  * gem install blendris
20
30
 
21
- == EXAMPLES:
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
- class Website < Blendris::Model
27
- key "website", :title
38
+ class Website < Blendris::Model
39
+ key "website", :title
28
40
 
29
- string :title
30
- string :url
31
- set :paths
32
- end
41
+ string :title
42
+ string :url
43
+ set :paths
44
+ end
33
45
 
34
- website = Website.create("One Fake Website")
35
- website.url = "http://fakewebsite.com"
36
- website.paths << "/blog/index"
37
- website.paths << "/admin/index"
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
- website:One_Fake_Website => "Website" (This identifies the model type)
42
- website:One_Fake_Website:name => "One Fake Website"
43
- website:One_Fake_Website:url => "http://fakewebsite.com"
44
- website:One_Fake_Website:paths => [ "/blog/index", "/admin/index" ]
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
- class Website
49
- refs :sister_sites, :class => Website, :reverse => :sister_sites
50
- end
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
- == LICENSE:
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 'fileutils'
9
- require './lib/blendris'
8
+ require "redis"
9
+ require "fileutils"
10
+ require "./lib/blendris"
10
11
 
11
- Echoe.new("blendris", "0.0.1") do |p|
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"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{blendris}
5
- s.version = "0.0.1"
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.rdoc", "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.rdoc", "Rakefile", "autotest/discover.rb", "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", "blendris.gemspec"]
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.rdoc"]
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}
@@ -5,6 +5,8 @@ module Blendris
5
5
  VERSION = '0.0.1'
6
6
  end
7
7
 
8
+ require "redis"
9
+
8
10
  require "blendris/errors"
9
11
  require "blendris/utils"
10
12
 
@@ -1,5 +1,3 @@
1
- require 'redis'
2
-
3
1
  module Blendris
4
2
 
5
3
  module RedisAccessor
@@ -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 name do |varname, options|
112
- options ||= {}
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.to_s] = options
116
+ redis_symbols[varname] = options
115
117
  end
116
118
  end
117
119
  end
@@ -3,6 +3,8 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
3
3
  describe "redis connection accessor" do
4
4
 
5
5
  it "should connect for reading and writing" do
6
+ extend RedisAccessor
7
+
6
8
  testkey = prefix + "test-string"
7
9
 
8
10
  redis.get(testkey).should == nil
@@ -7,7 +7,9 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  $:.unshift(File.dirname(__FILE__) + '/../lib')
10
- require 'blendris'
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
- config.before(:each) do
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.1
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.rdoc
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.rdoc
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.rdoc
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