rufus-doric 0.1.3 → 0.1.4
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/CHANGELOG.txt +5 -0
- data/README.rdoc +3 -1
- data/Rakefile +1 -1
- data/lib/rufus/doric/model.rb +11 -1
- data/lib/rufus/doric/one_doc_model.rb +26 -0
- data/lib/rufus/doric/version.rb +1 -1
- data/rufus-doric.gemspec +7 -6
- data/test/base.rb +4 -0
- data/test/{ut_5_value.rb → ut_10_value.rb} +0 -0
- data/test/ut_5_one_doc_model_lint.rb +29 -0
- metadata +7 -6
data/CHANGELOG.txt
CHANGED
data/README.rdoc
CHANGED
@@ -29,7 +29,9 @@ Then the database is determined by calling Rufus::Doric.db(name)
|
|
29
29
|
# => "http://127.0.0.1:5984/mydb_camelia"
|
30
30
|
|
31
31
|
p Rufus::Doric.db('mydb', :env => 'camelia')
|
32
|
-
# => #<Rufus::Jig::Couch:0x00000102325120
|
32
|
+
# => #<Rufus::Jig::Couch:0x00000102325120
|
33
|
+
# @http=#<Rufus::Jig::Http:0x00000102324908 @host="127.0.0.1",
|
34
|
+
# @port=5984, @path="/toot_test", ...>...>
|
33
35
|
|
34
36
|
In summary, you only have to create a couch_url.txt file that contains the http:://{host}:{port} of your couch server. The rest is taken care of.
|
35
37
|
|
data/Rakefile
CHANGED
@@ -35,7 +35,7 @@ something at the intersection of Rails3, CouchDB and rufus-jig
|
|
35
35
|
|
36
36
|
gem.test_file = 'test/test.rb'
|
37
37
|
|
38
|
-
gem.add_dependency 'activerecord', '~> 3.0.0.
|
38
|
+
gem.add_dependency 'activerecord', '~> 3.0.0.beta2'
|
39
39
|
gem.add_dependency 'rufus-jig', '>= 0.1.17'
|
40
40
|
gem.add_dependency 'mime-types', '>= 1.16'
|
41
41
|
gem.add_development_dependency 'rake'
|
data/lib/rufus/doric/model.rb
CHANGED
@@ -183,9 +183,14 @@ module Doric
|
|
183
183
|
end
|
184
184
|
|
185
185
|
#--
|
186
|
-
# methods required by ActiveModel (see test/unit/
|
186
|
+
# methods required by ActiveModel (see test/unit/ut_3_model_lint.rb)
|
187
187
|
#++
|
188
188
|
|
189
|
+
def to_key
|
190
|
+
|
191
|
+
@h['_id'] ? [ @h['_id'] ] : nil
|
192
|
+
end
|
193
|
+
|
189
194
|
def to_model
|
190
195
|
|
191
196
|
self
|
@@ -196,6 +201,11 @@ module Doric
|
|
196
201
|
@h['_destroyed'] == true
|
197
202
|
end
|
198
203
|
|
204
|
+
def persisted?
|
205
|
+
|
206
|
+
@h['_id'] != nil
|
207
|
+
end
|
208
|
+
|
199
209
|
def new_record?
|
200
210
|
|
201
211
|
@h['_id'].nil?
|
@@ -124,6 +124,32 @@ module Doric
|
|
124
124
|
h ? self.new(h, doc) : nil
|
125
125
|
end
|
126
126
|
|
127
|
+
#--
|
128
|
+
# methods required by ActiveModel (see test/unit/ut_5_one_doc_model_lint.rb
|
129
|
+
#++
|
130
|
+
|
131
|
+
def to_model
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
def persisted?
|
137
|
+
|
138
|
+
true
|
139
|
+
end
|
140
|
+
|
141
|
+
def to_key
|
142
|
+
|
143
|
+
@h['_id'] ? [ @h['_id'] ] : nil
|
144
|
+
end
|
145
|
+
|
146
|
+
# Is used by <resource>_path and <resource>_url
|
147
|
+
#
|
148
|
+
def to_param
|
149
|
+
|
150
|
+
@h['_id']
|
151
|
+
end
|
152
|
+
|
127
153
|
protected
|
128
154
|
|
129
155
|
def self.do_get (doc_id)
|
data/lib/rufus/doric/version.rb
CHANGED
data/rufus-doric.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rufus-doric}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John Mettraux"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-09}
|
13
13
|
s.description = %q{
|
14
14
|
something at the intersection of Rails3, CouchDB and rufus-jig
|
15
15
|
}
|
@@ -46,11 +46,12 @@ something at the intersection of Rails3, CouchDB and rufus-jig
|
|
46
46
|
"test/fixtures/test/doric_ENV_workitems/workitem0.json",
|
47
47
|
"test/test.rb",
|
48
48
|
"test/ut_0_fixtures.rb",
|
49
|
+
"test/ut_10_value.rb",
|
49
50
|
"test/ut_1_model.rb",
|
50
51
|
"test/ut_2_model_view.rb",
|
51
52
|
"test/ut_3_model_lint.rb",
|
52
53
|
"test/ut_4_one_doc_model.rb",
|
53
|
-
"test/
|
54
|
+
"test/ut_5_one_doc_model_lint.rb",
|
54
55
|
"test/ut_6_model_associations.rb",
|
55
56
|
"test/ut_7_looser_associations.rb",
|
56
57
|
"test/ut_8_belongings.rb",
|
@@ -71,14 +72,14 @@ something at the intersection of Rails3, CouchDB and rufus-jig
|
|
71
72
|
s.specification_version = 3
|
72
73
|
|
73
74
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
74
|
-
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0.
|
75
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0.beta2"])
|
75
76
|
s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.17"])
|
76
77
|
s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
|
77
78
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
78
79
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
79
80
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
80
81
|
else
|
81
|
-
s.add_dependency(%q<activerecord>, ["~> 3.0.0.
|
82
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.0.beta2"])
|
82
83
|
s.add_dependency(%q<rufus-jig>, [">= 0.1.17"])
|
83
84
|
s.add_dependency(%q<mime-types>, [">= 1.16"])
|
84
85
|
s.add_dependency(%q<rake>, [">= 0"])
|
@@ -86,7 +87,7 @@ something at the intersection of Rails3, CouchDB and rufus-jig
|
|
86
87
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
87
88
|
end
|
88
89
|
else
|
89
|
-
s.add_dependency(%q<activerecord>, ["~> 3.0.0.
|
90
|
+
s.add_dependency(%q<activerecord>, ["~> 3.0.0.beta2"])
|
90
91
|
s.add_dependency(%q<rufus-jig>, [">= 0.1.17"])
|
91
92
|
s.add_dependency(%q<mime-types>, [">= 1.16"])
|
92
93
|
s.add_dependency(%q<rake>, [">= 0"])
|
data/test/base.rb
CHANGED
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# testing rufus-doric
|
4
|
+
#
|
5
|
+
# Thu Apr 8 18:24:26 JST 2010
|
6
|
+
#
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'base')
|
9
|
+
|
10
|
+
|
11
|
+
class Hobo < Rufus::Doric::OneDocModel
|
12
|
+
|
13
|
+
doc_id :hobos
|
14
|
+
db :doric
|
15
|
+
|
16
|
+
h_accessor :name
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
class UtOneDocModelLintTest < Test::Unit::TestCase
|
21
|
+
include ActiveModel::Lint::Tests
|
22
|
+
|
23
|
+
def setup
|
24
|
+
@model = Hobo.new(:name => 'john')
|
25
|
+
end
|
26
|
+
#def teardown
|
27
|
+
#end
|
28
|
+
end
|
29
|
+
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Mettraux
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-09 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -28,8 +28,8 @@ dependencies:
|
|
28
28
|
- 3
|
29
29
|
- 0
|
30
30
|
- 0
|
31
|
-
-
|
32
|
-
version: 3.0.0.
|
31
|
+
- beta2
|
32
|
+
version: 3.0.0.beta2
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
@@ -133,11 +133,12 @@ files:
|
|
133
133
|
- test/fixtures/test/doric_ENV_workitems/workitem0.json
|
134
134
|
- test/test.rb
|
135
135
|
- test/ut_0_fixtures.rb
|
136
|
+
- test/ut_10_value.rb
|
136
137
|
- test/ut_1_model.rb
|
137
138
|
- test/ut_2_model_view.rb
|
138
139
|
- test/ut_3_model_lint.rb
|
139
140
|
- test/ut_4_one_doc_model.rb
|
140
|
-
- test/
|
141
|
+
- test/ut_5_one_doc_model_lint.rb
|
141
142
|
- test/ut_6_model_associations.rb
|
142
143
|
- test/ut_7_looser_associations.rb
|
143
144
|
- test/ut_8_belongings.rb
|