ruote-couch 2.1.8 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -2,9 +2,16 @@
2
2
  = ruote-couch - CHANGELOG.txt
3
3
 
4
4
 
5
+ == ruote-couch 2.1.9 not yet released
6
+
7
+ - trusting rufus-jig : not closing couches anymore
8
+ - CouchStorage#clear and purge cleanup
9
+
10
+
5
11
  == ruote-couch 2.1.8 released 2010/03/15
6
12
 
7
- - 'prefix' and :prefix as configuration parameter
13
+ - 'couch_timeout' configuration parameter
14
+ - 'couch_prefix' and :prefix as configuration parameter
8
15
 
9
16
 
10
17
  == ruote-couch 2.1.7 released 2010/02/15
data/Rakefile CHANGED
@@ -33,14 +33,30 @@ CouchDB storage for ruote 2.1 (ruby workflow engine)
33
33
  gem.test_file = 'test/test.rb'
34
34
 
35
35
  gem.add_dependency 'ruote', ">= #{Ruote::Couch::VERSION}"
36
- gem.add_dependency 'rufus-jig', '>= 0.1.15'
36
+ gem.add_dependency 'rufus-jig', '>= 0.1.17'
37
37
  gem.add_development_dependency 'yard'
38
+ gem.add_development_dependency 'rake'
38
39
  gem.add_development_dependency 'jeweler'
39
40
 
40
41
  # gemspec spec : http://www.rubygems.org/read/chapter/20
41
42
  end
42
43
  Jeweler::GemcutterTasks.new
43
44
 
45
+ #
46
+ # MISC
47
+
48
+ task :delete_all_test_databases do
49
+
50
+ require 'json'
51
+ require 'rufus/jig'
52
+ couch = Rufus::Jig::Couch.new('127.0.0.1', 5984)
53
+ %w[
54
+ configurations errors expressions msgs schedules variables workitems
55
+ ].each do |type|
56
+ couch.delete("/test_ruote_#{type}")
57
+ end
58
+ end
59
+
44
60
 
45
61
  #
46
62
  # DOC
data/TODO.txt CHANGED
@@ -7,7 +7,5 @@
7
7
 
8
8
  [ ] jig / r-couch should not rely on exceptions
9
9
 
10
- [ ] re-run suite with --patron
11
- [ ] run suite with --net
12
- [ ] run suite with --em
10
+ [ ] issue with cron '* * * * *' and long-polling
13
11
 
@@ -105,25 +105,25 @@ module Ruote::Couch
105
105
  end
106
106
  end
107
107
 
108
- def shutdown
108
+ #def shutdown
109
+ # @couch.close
110
+ #end
111
+ # jig > 0.1.17 is OK without that
109
112
 
110
- @couch.close
111
- end
112
-
113
- # Deletes database and closes it.
113
+ # Deletes all the documents in this database.
114
114
  #
115
115
  def purge!
116
116
 
117
- @couch.delete('.')
118
- @couch.close
119
- end
120
-
121
- # Removes all the documents in this database.
122
- #
123
- def purge_docs!
124
-
125
- @couch.delete('.')
126
- @couch.put('.')
117
+ @couch.get('_all_docs')['rows'].each do |row|
118
+ doc = { '_id' => row['id'], '_rev' => row['value']['rev'] }
119
+ @couch.delete(doc) unless doc['_id'].match(/^\_design\//)
120
+ end
121
+ #
122
+ # which is faster than
123
+ #
124
+ #@couch.delete('.')
125
+ #@couch.put('.')
126
+ #@couch.http.cache.clear
127
127
  end
128
128
 
129
129
  protected
@@ -189,6 +189,13 @@ module Ruote::Couch
189
189
  get_many(/!#{wfid}$/, {})
190
190
  end
191
191
 
192
+ # Returns the design document that goes with this class of database
193
+ #
194
+ def self.design_doc
195
+
196
+ self.allocate.send(:design_doc)
197
+ end
198
+
192
199
  protected
193
200
 
194
201
  def design_doc
@@ -207,7 +214,12 @@ module Ruote::Couch
207
214
  def prepare
208
215
 
209
216
  d = @couch.get('_design/ruote')
210
- @couch.delete(d) if d
217
+
218
+ return if d && d['views'] == design_doc['views']
219
+
220
+ d ||= design_doc
221
+ d['views'] = design_doc['views']
222
+
211
223
  @couch.put(design_doc)
212
224
  end
213
225
  end
@@ -274,6 +286,13 @@ module Ruote::Couch
274
286
  hwis.collect { |hwi| Ruote::Workitem.new(hwi) }
275
287
  end
276
288
 
289
+ # Returns the design document that goes with this class of database
290
+ #
291
+ def self.design_doc
292
+
293
+ self.allocate.send(:design_doc)
294
+ end
295
+
277
296
  protected
278
297
 
279
298
  def design_doc
@@ -120,6 +120,19 @@ module Couch
120
120
  def purge!
121
121
 
122
122
  @dbs.values.each { |db| db.purge! }
123
+ #@dbs.values.each { |db| db.shutdown }
124
+ end
125
+
126
+ # Used when doing integration tests, removes all
127
+ # msgs, schedules, errors, expressions and workitems.
128
+ #
129
+ # NOTE that it doesn't remove engine variables (danger)
130
+ #
131
+ def clear
132
+
133
+ %w[ msgs schedules errors expressions workitems ].each do |type|
134
+ @dbs[type].purge!
135
+ end
123
136
  end
124
137
 
125
138
  def dump (type)
@@ -131,7 +144,7 @@ module Couch
131
144
 
132
145
  @poller.kill if @poller
133
146
 
134
- @dbs.values.each { |db| db.shutdown }
147
+ #@dbs.values.each { |db| db.shutdown }
135
148
  end
136
149
 
137
150
  # Mainly used by ruote's test/unit/ut_17_storage.rb
@@ -147,7 +160,7 @@ module Couch
147
160
  def purge_type! (type)
148
161
 
149
162
  if db = @dbs[type]
150
- db.purge_docs!
163
+ db.purge!
151
164
  end
152
165
  end
153
166
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Ruote
3
3
  module Couch
4
- VERSION = '2.1.8'
4
+ VERSION = '2.1.9'
5
5
  end
6
6
  end
7
7
 
data/ruote-couch.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruote-couch}
8
- s.version = "2.1.8"
8
+ s.version = "2.1.9"
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-03-15}
12
+ s.date = %q{2010-03-23}
13
13
  s.description = %q{CouchDB storage for ruote 2.1 (ruby workflow engine)}
14
14
  s.email = %q{jmettraux@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,9 @@ Gem::Specification.new do |s|
32
32
  "test/functional/ft_0_long_polling.rb",
33
33
  "test/functional/test.rb",
34
34
  "test/integration_connection.rb",
35
- "test/test.rb"
35
+ "test/test.rb",
36
+ "test/unit/test.rb",
37
+ "test/unit/ut_0_design_doc.rb"
36
38
  ]
37
39
  s.homepage = %q{http://github.com/jmettraux/ruote-couch}
38
40
  s.rdoc_options = ["--charset=UTF-8"]
@@ -49,20 +51,23 @@ Gem::Specification.new do |s|
49
51
  s.specification_version = 3
50
52
 
51
53
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
- s.add_runtime_dependency(%q<ruote>, [">= 2.1.8"])
53
- s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.15"])
54
+ s.add_runtime_dependency(%q<ruote>, [">= 2.1.9"])
55
+ s.add_runtime_dependency(%q<rufus-jig>, [">= 0.1.17"])
54
56
  s.add_development_dependency(%q<yard>, [">= 0"])
57
+ s.add_development_dependency(%q<rake>, [">= 0"])
55
58
  s.add_development_dependency(%q<jeweler>, [">= 0"])
56
59
  else
57
- s.add_dependency(%q<ruote>, [">= 2.1.8"])
58
- s.add_dependency(%q<rufus-jig>, [">= 0.1.15"])
60
+ s.add_dependency(%q<ruote>, [">= 2.1.9"])
61
+ s.add_dependency(%q<rufus-jig>, [">= 0.1.17"])
59
62
  s.add_dependency(%q<yard>, [">= 0"])
63
+ s.add_dependency(%q<rake>, [">= 0"])
60
64
  s.add_dependency(%q<jeweler>, [">= 0"])
61
65
  end
62
66
  else
63
- s.add_dependency(%q<ruote>, [">= 2.1.8"])
64
- s.add_dependency(%q<rufus-jig>, [">= 0.1.15"])
67
+ s.add_dependency(%q<ruote>, [">= 2.1.9"])
68
+ s.add_dependency(%q<rufus-jig>, [">= 0.1.17"])
65
69
  s.add_dependency(%q<yard>, [">= 0"])
70
+ s.add_dependency(%q<rake>, [">= 0"])
66
71
  s.add_dependency(%q<jeweler>, [">= 0"])
67
72
  end
68
73
  end
@@ -17,6 +17,8 @@ end
17
17
 
18
18
  require 'ruote/couch/storage'
19
19
 
20
+ # TODO : maybe place delete_all_test_databases here
21
+
20
22
 
21
23
  def new_storage (opts)
22
24
 
data/test/test.rb CHANGED
@@ -1,3 +1,4 @@
1
1
 
2
+ require File.join(File.dirname(__FILE__), 'unit', 'test.rb')
2
3
  require File.join(File.dirname(__FILE__), 'functional', 'test.rb')
3
4
 
data/test/unit/test.rb ADDED
@@ -0,0 +1,9 @@
1
+
2
+ #
3
+ # testing ruote-couch
4
+ #
5
+ # Thu Mar 18 09:38:21 JST 2010
6
+ #
7
+
8
+ Dir.glob(File.join(File.dirname(__FILE__), 'ut_*.rb')).sort.each { |t| load(t) }
9
+
@@ -0,0 +1,28 @@
1
+
2
+ #
3
+ # testing ruote-couch
4
+ #
5
+ # Thu Mar 18 09:15:11 JST 2010
6
+ #
7
+
8
+ #require File.join(File.dirname(__FILE__), 'base')
9
+ $:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'ruote', 'lib'))
10
+ $:.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
11
+ require 'test/unit'
12
+ require 'ruote/couch'
13
+
14
+
15
+ class UtDesignDocTest < Test::Unit::TestCase
16
+
17
+ #def setup
18
+ #end
19
+ #def teardown
20
+ #end
21
+
22
+ def test_design_docs
23
+
24
+ assert_equal Hash, Ruote::Couch::WfidIndexedDatabase.design_doc.class
25
+ assert_equal Hash, Ruote::Couch::WorkitemDatabase.design_doc.class
26
+ end
27
+ end
28
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 1
8
- - 8
9
- version: 2.1.8
8
+ - 9
9
+ version: 2.1.9
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-03-15 00:00:00 +09:00
17
+ date: 2010-03-23 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -27,8 +27,8 @@ dependencies:
27
27
  segments:
28
28
  - 2
29
29
  - 1
30
- - 8
31
- version: 2.1.8
30
+ - 9
31
+ version: 2.1.9
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ dependencies:
41
41
  segments:
42
42
  - 0
43
43
  - 1
44
- - 15
45
- version: 0.1.15
44
+ - 17
45
+ version: 0.1.17
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -58,7 +58,7 @@ dependencies:
58
58
  type: :development
59
59
  version_requirements: *id003
60
60
  - !ruby/object:Gem::Dependency
61
- name: jeweler
61
+ name: rake
62
62
  prerelease: false
63
63
  requirement: &id004 !ruby/object:Gem::Requirement
64
64
  requirements:
@@ -69,6 +69,18 @@ dependencies:
69
69
  version: "0"
70
70
  type: :development
71
71
  version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: jeweler
74
+ prerelease: false
75
+ requirement: &id005 !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ type: :development
83
+ version_requirements: *id005
72
84
  description: CouchDB storage for ruote 2.1 (ruby workflow engine)
73
85
  email: jmettraux@gmail.com
74
86
  executables: []
@@ -95,6 +107,8 @@ files:
95
107
  - test/functional/test.rb
96
108
  - test/integration_connection.rb
97
109
  - test/test.rb
110
+ - test/unit/test.rb
111
+ - test/unit/ut_0_design_doc.rb
98
112
  has_rdoc: true
99
113
  homepage: http://github.com/jmettraux/ruote-couch
100
114
  licenses: []