rufus-doric 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -2,6 +2,14 @@
2
2
  = rufus-doric CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-doric - 0.1.17 released 2010/09/30
6
+
7
+ - basic auth thanks to rufus-jig 0.1.22
8
+ - Model.count (hopefully cheaper than Model.all.size)
9
+ - more efficient neutralize(would_be_id) method
10
+ - view with a reduce returns [] instead of nil when no values
11
+
12
+
5
13
  == rufus-doric - 0.1.16 released 2010/07/12
6
14
 
7
15
  - OneDocModel#attach
data/Rakefile CHANGED
@@ -35,11 +35,10 @@ 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.beta4'
39
- gem.add_dependency 'rufus-jig', '>= 0.1.20'
38
+ gem.add_dependency 'activerecord', '~> 3.0.0'
39
+ gem.add_dependency 'rufus-jig', '>= 0.1.22'
40
40
  gem.add_dependency 'mime-types', '>= 1.16'
41
41
  gem.add_development_dependency 'rake'
42
- gem.add_development_dependency 'yard'
43
42
  gem.add_development_dependency 'jeweler'
44
43
 
45
44
  # gemspec spec : http://www.rubygems.org/read/chapter/20
@@ -50,20 +49,6 @@ Jeweler::GemcutterTasks.new
50
49
  #
51
50
  # DOC
52
51
 
53
- #begin
54
- # require 'yard'
55
- # YARD::Rake::YardocTask.new do |doc|
56
- # doc.options = [
57
- # '-o', 'html/rufus-doric', '--title',
58
- # "rufus-doric #{Rufus::Doric::VERSION}"
59
- # ]
60
- # end
61
- #rescue LoadError
62
- # task :yard do
63
- # abort "YARD is not available : sudo gem install yard"
64
- # end
65
- #end
66
-
67
52
  #
68
53
  # make sure to have rdoc 2.5.x to run that
69
54
  #
data/TODO.txt CHANGED
@@ -27,3 +27,7 @@
27
27
  http://www.mikealrogers.com/archives/785
28
28
  http://wiki.apache.org/couchdb/Built-In_Reduce_Functions
29
29
 
30
+ [ ] JOINs http://blog.couch.io/post/446015664/whats-new-in-apache-couchdb-0-11-part-two-views
31
+
32
+ [ ] finder... defauld id { type.singularize + '_' + name }...
33
+
@@ -211,7 +211,6 @@ module Doric
211
211
  end
212
212
  end
213
213
  end
214
-
215
214
  end
216
215
  end
217
216
 
@@ -734,6 +734,17 @@ module Doric
734
734
  result['rows'].collect { |r| r['doc'] }
735
735
  end
736
736
 
737
+ # Returns the count of all the elements.
738
+ #
739
+ def self.count
740
+
741
+ get_result(
742
+ "_design/doric/_view/by_doric_type?key=%22#{@doric_type}%22",
743
+ nil,
744
+ {}
745
+ )['rows'].size
746
+ end
747
+
737
748
  # A helper method for .by
738
749
  #
739
750
  def self.is_option_hash (h)
@@ -782,7 +793,7 @@ module Doric
782
793
 
783
794
  if reduce
784
795
  r = result['rows'].first
785
- r ? r['value'] : nil
796
+ r ? r['value'] : []
786
797
  else
787
798
  result['rows'].collect { |r| self.new(r['doc']) }.uniq
788
799
  end
@@ -33,7 +33,7 @@ module Doric
33
33
 
34
34
  def self.neutralize_id (s)
35
35
 
36
- s.to_s.strip.gsub(/[\.\s\/:;\*\\\+\?"]/, '_')
36
+ s.to_s.strip.gsub(/[\.\s\/:;\*\\\+\?"#=&]/, '_')
37
37
  end
38
38
 
39
39
  def self.escape (o)
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Rufus
3
3
  module Doric
4
- VERSION = '0.1.16'
4
+ VERSION = '0.1.17'
5
5
  end
6
6
  end
7
7
 
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.16"
8
+ s.version = "0.1.17"
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-07-12}
12
+ s.date = %q{2010-09-30}
13
13
  s.description = %q{
14
14
  something at the intersection of Rails3, CouchDB and rufus-jig
15
15
  }
@@ -84,26 +84,23 @@ something at the intersection of Rails3, CouchDB and rufus-jig
84
84
  s.specification_version = 3
85
85
 
86
86
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
87
- s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0.beta4"])
88
- s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.20"])
87
+ s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0"])
88
+ s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.22"])
89
89
  s.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
90
90
  s.add_development_dependency(%q<rake>, [">= 0"])
91
- s.add_development_dependency(%q<yard>, [">= 0"])
92
91
  s.add_development_dependency(%q<jeweler>, [">= 0"])
93
92
  else
94
- s.add_dependency(%q<activerecord>, ["~> 3.0.0.beta4"])
95
- s.add_dependency(%q<rufus-jig>, [">= 0.1.20"])
93
+ s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
94
+ s.add_dependency(%q<rufus-jig>, [">= 0.1.22"])
96
95
  s.add_dependency(%q<mime-types>, [">= 1.16"])
97
96
  s.add_dependency(%q<rake>, [">= 0"])
98
- s.add_dependency(%q<yard>, [">= 0"])
99
97
  s.add_dependency(%q<jeweler>, [">= 0"])
100
98
  end
101
99
  else
102
- s.add_dependency(%q<activerecord>, ["~> 3.0.0.beta4"])
103
- s.add_dependency(%q<rufus-jig>, [">= 0.1.20"])
100
+ s.add_dependency(%q<activerecord>, ["~> 3.0.0"])
101
+ s.add_dependency(%q<rufus-jig>, [">= 0.1.22"])
104
102
  s.add_dependency(%q<mime-types>, [">= 1.16"])
105
103
  s.add_dependency(%q<rake>, [">= 0"])
106
- s.add_dependency(%q<yard>, [">= 0"])
107
104
  s.add_dependency(%q<jeweler>, [">= 0"])
108
105
  end
109
106
  end
@@ -61,5 +61,10 @@ class UtModelMapReduceTest < Test::Unit::TestCase
61
61
  [ 'president', 'prime minister', 'minister of war' ],
62
62
  Auth.by_roles(nil))
63
63
  end
64
+
65
+ def test_when_empty
66
+
67
+ assert_equal [], Auth.roles(nil)
68
+ end
64
69
  end
65
70
 
@@ -24,6 +24,12 @@ class UtNeutralizeTest < Test::Unit::TestCase
24
24
  assert_equal "横浜", n("横浜")
25
25
  end
26
26
 
27
+ def test_common_pitfalls
28
+
29
+ assert_equal 'project__3', n('project #3')
30
+ assert_equal 'project__3_a_b_c', n('project #3?a&b=c')
31
+ end
32
+
27
33
  protected
28
34
 
29
35
  def n (s)
data/test/ut_1_model.rb CHANGED
@@ -215,5 +215,14 @@ class UtModelTest < Test::Unit::TestCase
215
215
  Thing.new('name' => '横浜').save!
216
216
  assert_not_nil Thing.find('横浜')
217
217
  end
218
+
219
+ def test_all_and_count
220
+
221
+ Thing.new('name' => "Xi'anTse").save!
222
+ Thing.new('name' => "Xi'anTseu").save!
223
+
224
+ assert_equal 2, Thing.all.size
225
+ assert_equal 2, Thing.count
226
+ end
218
227
  end
219
228
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 16
9
- version: 0.1.16
8
+ - 17
9
+ version: 0.1.17
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-07-12 00:00:00 +09:00
17
+ date: 2010-09-30 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -28,8 +28,7 @@ dependencies:
28
28
  - 3
29
29
  - 0
30
30
  - 0
31
- - beta4
32
- version: 3.0.0.beta4
31
+ version: 3.0.0
33
32
  type: :runtime
34
33
  version_requirements: *id001
35
34
  - !ruby/object:Gem::Dependency
@@ -42,8 +41,8 @@ dependencies:
42
41
  segments:
43
42
  - 0
44
43
  - 1
45
- - 20
46
- version: 0.1.20
44
+ - 22
45
+ version: 0.1.22
47
46
  type: :runtime
48
47
  version_requirements: *id002
49
48
  - !ruby/object:Gem::Dependency
@@ -72,7 +71,7 @@ dependencies:
72
71
  type: :development
73
72
  version_requirements: *id004
74
73
  - !ruby/object:Gem::Dependency
75
- name: yard
74
+ name: jeweler
76
75
  prerelease: false
77
76
  requirement: &id005 !ruby/object:Gem::Requirement
78
77
  requirements:
@@ -83,18 +82,6 @@ dependencies:
83
82
  version: "0"
84
83
  type: :development
85
84
  version_requirements: *id005
86
- - !ruby/object:Gem::Dependency
87
- name: jeweler
88
- prerelease: false
89
- requirement: &id006 !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- segments:
94
- - 0
95
- version: "0"
96
- type: :development
97
- version_requirements: *id006
98
85
  description: "\n\
99
86
  something at the intersection of Rails3, CouchDB and rufus-jig\n "
100
87
  email: jmettraux@gmail.com