ruote-redis 2.1.11 → 2.2.0

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.
@@ -2,6 +2,12 @@
2
2
  = ruote-redis - CHANGELOG.txt
3
3
 
4
4
 
5
+ == ruote-redis 2.2.0 released 2011/03/01
6
+
7
+ - Ruote::Redis::Storage (instead of RedisStorage)
8
+ - fixed get_many result order (was broken for 1.8.7)
9
+
10
+
5
11
  == ruote-redis 2.1.11 released 2010/10/01
6
12
 
7
13
  - storage format change (thanks @wwkeyboard)
@@ -9,6 +9,7 @@
9
9
 
10
10
  == contributors
11
11
 
12
+ - John Le - http://github.com/sandbox
12
13
  - Aaron Lee - http://github.com/wwkeyboard
13
14
 
14
15
 
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2001-2010, John Mettraux, jmettraux@gmail.com
2
+ Copyright (c) 2001-2011, John Mettraux, jmettraux@gmail.com
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
1
1
 
2
2
  = ruote-redis
3
3
 
4
- Redis persistence for ruote 2.1 (a ruby workflow engine)
4
+ Redis persistence for ruote (a Ruby workflow engine)
5
5
 
6
6
 
7
7
  == usage
@@ -14,14 +14,14 @@ The storage is instantiate by passing a redis-rb instance to the storage.
14
14
 
15
15
  engine = Ruote::Engine.new(
16
16
  Ruote::Worker.new(
17
- Ruote::Redis::RedisStorage.new(
17
+ Ruote::Redis::Storage.new(
18
18
  ::Redis.new(:db => 14, :thread_safe => true), {})))
19
19
 
20
20
  # ...
21
21
 
22
22
  Passing an em-redis instance might work, but I haven't tried.
23
23
 
24
- Tested with Redis 1.3.8 (redis-rb 2.0.1).
24
+ Tested with Redis 1.2.6 and 2.0.4 (redis-rb 2.1.1).
25
25
 
26
26
 
27
27
  == running tests
data/Rakefile CHANGED
@@ -1,75 +1,92 @@
1
1
 
2
+ $:.unshift('.') # 1.9.2
3
+
2
4
  require 'rubygems'
5
+
3
6
  require 'rake'
7
+ require 'rake/clean'
8
+ require 'rake/rdoctask'
4
9
 
5
- require 'lib/ruote/redis/version.rb'
6
10
 
7
11
  #
8
- # CLEAN
12
+ # clean
9
13
 
10
- require 'rake/clean'
11
- CLEAN.include('pkg', 'tmp', 'html')
12
- task :default => [ :clean ]
14
+ CLEAN.include('pkg', 'rdoc')
13
15
 
14
16
 
15
17
  #
16
- # GEM
18
+ # test / spec
19
+
20
+ task :test do
21
+
22
+ puts
23
+ puts "to test ruote-redis, head to your ruote/ dir and run"
24
+ puts
25
+ puts " ruby test/test.rb -- --redis"
26
+ puts
27
+ puts "but first, make sure your ruote-dm/test/functional_connection.rb"
28
+ puts "is set correctly."
29
+ puts
30
+ end
17
31
 
18
- require 'jeweler'
32
+ task :default => [ :test ]
19
33
 
20
- Jeweler::Tasks.new do |gem|
21
34
 
22
- gem.version = Ruote::Redis::VERSION
23
- gem.name = 'ruote-redis'
24
- gem.summary = 'Redis storage for ruote (a ruby workflow engine)'
25
- gem.description = %{
26
- Redis storage for ruote (a ruby workflow engine)
27
- }.strip
28
- gem.email = 'jmettraux@gmail.com'
29
- gem.homepage = 'http://github.com/jmettraux/ruote-redis'
30
- gem.authors = [ 'John Mettraux' ]
31
- gem.rubyforge_project = 'ruote'
35
+ #
36
+ # gem
37
+
38
+ GEMSPEC_FILE = Dir['*.gemspec'].first
39
+ GEMSPEC = eval(File.read(GEMSPEC_FILE))
40
+ GEMSPEC.validate
32
41
 
33
- #gem.test_file = 'test/test.rb'
34
42
 
35
- gem.add_dependency 'ruote', ">= #{Ruote::Redis::VERSION}"
36
- gem.add_dependency 'redis', '>= 2.0.5'
37
- gem.add_development_dependency 'yard'
38
- gem.add_development_dependency 'rake'
39
- gem.add_development_dependency 'jeweler'
43
+ desc %{
44
+ builds the gem and places it in pkg/
45
+ }
46
+ task :build do
40
47
 
41
- # gemspec spec : http://www.rubygems.org/read/chapter/20
48
+ sh "gem build #{GEMSPEC_FILE}"
49
+ sh "mkdir pkg" rescue nil
50
+ sh "mv #{GEMSPEC.name}-#{GEMSPEC.version}.gem pkg/"
42
51
  end
43
- Jeweler::GemcutterTasks.new
44
52
 
53
+ desc %{
54
+ builds the gem and pushes it to rubygems.org
55
+ }
56
+ task :push => :build do
57
+
58
+ sh "gem push pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
59
+ end
45
60
 
46
- #
47
- # DOC
48
61
 
49
62
  #
50
- # make sure to have rdoc 2.5.x to run that
63
+ # rdoc
51
64
  #
52
- require 'rake/rdoctask'
65
+ # make sure to have rdoc 2.5.x to run that
66
+
53
67
  Rake::RDocTask.new do |rd|
54
68
 
55
69
  rd.main = 'README.rdoc'
56
- rd.rdoc_dir = 'rdoc/ruote-redis_rdoc'
70
+ rd.rdoc_dir = 'rdoc'
57
71
 
58
72
  rd.rdoc_files.include(
59
73
  'README.rdoc', 'CHANGELOG.txt', 'CREDITS.txt', 'lib/**/*.rb')
60
74
 
61
- rd.title = "ruote-redis #{Ruote::Redis::VERSION}"
75
+ rd.title = "#{GEMSPEC.name} #{GEMSPEC.version}"
62
76
  end
63
77
 
64
78
 
65
79
  #
66
- # TO THE WEB
80
+ # upload_rdoc
67
81
 
82
+ desc %{
83
+ upload the rdoc to rubyforge
84
+ }
68
85
  task :upload_rdoc => [ :clean, :rdoc ] do
69
86
 
70
87
  account = 'jmettraux@rubyforge.org'
71
88
  webdir = '/var/www/gforge-projects/ruote'
72
89
 
73
- sh "rsync -azv -e ssh rdoc/ruote-redis_rdoc #{account}:#{webdir}/"
90
+ sh "rsync -azv -e ssh rdoc/#{GEMSPEC.name}_rdoc #{account}:#{webdir}/"
74
91
  end
75
92
 
data/TODO.txt CHANGED
@@ -1,10 +1,9 @@
1
1
 
2
2
  [x] methods specific to StorageParticipant
3
3
  [o] redis -> @redis
4
-
5
- [ ] 1 ::Redis instance per thread ? (instead of :thread_safe => true)
6
- [ ] update to redis-rb 2.0 (which has sthing about threads)
4
+ [o] update to redis-rb 2.0 (which has sthing about threads)
7
5
  http://blog.citrusbyte.com/2010/05/14/redis-rb-200/
6
+ [x] 1 ::Redis instance per thread ? (instead of :thread_safe => true)
8
7
 
9
- [ ] double-check for deletion of old keys
8
+ [ ] resque participant ?
10
9
 
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright(c) 2005-2010, John Mettraux, jmettraux@gmail.com
2
+ # Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files(the "Software"), to deal
@@ -60,7 +60,7 @@ module Redis
60
60
  # If you try and it works, feedback is welcome
61
61
  # http://groups.google.com/group/openwferu-users
62
62
  #
63
- class RedisStorage
63
+ class Storage
64
64
 
65
65
  include Ruote::StorageBase
66
66
 
@@ -74,24 +74,23 @@ module Redis
74
74
  @options = options
75
75
 
76
76
  def @redis.keys_to_a(opt)
77
- r = keys(opt)
78
- r.is_a?(Array) ? r : r.split(' ')
77
+ keys(opt) rescue []
79
78
  end
80
79
 
81
80
  put_configuration
82
81
  end
83
82
 
83
+ # Returns true if the doc is successfully deleted.
84
+ #
84
85
  def reserve(doc)
85
86
 
86
- @redis.del(key_for(doc))
87
+ (@redis.del(key_for(doc)) == 1)
87
88
  end
88
89
 
89
90
  def put_msg(action, options)
90
91
 
91
92
  doc = prepare_msg_doc(action, options)
92
93
 
93
- puts "XXX" if @redis.nil?
94
-
95
94
  @redis.set(key_for(doc), to_json(doc))
96
95
 
97
96
  nil
@@ -110,6 +109,8 @@ module Redis
110
109
 
111
110
  def delete_schedule(schedule_id)
112
111
 
112
+ return unless schedule_id
113
+
113
114
  @redis.del(key_for('schedules', schedule_id))
114
115
  end
115
116
 
@@ -233,7 +234,11 @@ module Redis
233
234
  h
234
235
  end
235
236
 
236
- opts[:count] ? docs.size : docs.values
237
+ return docs.size if opts[:count]
238
+
239
+ docs = docs.values.sort_by { |d| d['_id'] }
240
+
241
+ opts[:descending] ? docs.reverse : docs
237
242
  end
238
243
 
239
244
  def ids(type)
@@ -258,21 +263,36 @@ module Redis
258
263
  @redis.keys_to_a("#{type}/*").sort.join("\n")
259
264
  end
260
265
 
266
+ # Shuts this worker down.
267
+ #
268
+ # (This close / shutdown dichotomy has to be resolved at some point...)
269
+ #
261
270
  def close
262
271
 
263
272
  @redis.quit
264
273
  end
265
274
 
275
+ # Shuts this worker down.
276
+ #
277
+ # (This close / shutdown dichotomy has to be resolved at some point...)
278
+ #
279
+ def shutdown
280
+
281
+ @redis.quit
282
+ end
283
+
266
284
  # Mainly used by ruote's test/unit/ut_17_storage.rb
267
285
  #
268
286
  def add_type(type)
287
+
288
+ # nothing to be done
269
289
  end
270
290
 
271
291
  # Nukes a db type and reputs it(losing all the documents that were in it).
272
292
  #
273
293
  def purge_type!(type)
274
294
 
275
- @redis.keys_to_a("#{type}/*").each { |k| @redis.del(k) }
295
+ @redis.keys_to_a("#{type}/*").each { |k| (@redis.del(k) rescue nil) }
276
296
  end
277
297
 
278
298
  protected
@@ -352,6 +372,12 @@ module Redis
352
372
  put({ '_id' => 'engine', 'type' => 'configurations' }.merge(@options))
353
373
  end
354
374
  end
375
+
376
+ #
377
+ # Keeping Ruote::Redis::RedisStorage for backward compatibility.
378
+ #
379
+ class RedisStorage < Storage
380
+ end
355
381
  end
356
382
  end
357
383
 
@@ -1,7 +1,8 @@
1
1
 
2
2
  module Ruote
3
3
  module Redis
4
- VERSION = '2.1.11'
4
+
5
+ VERSION = '2.2.0'
5
6
  end
6
7
  end
7
8
 
@@ -1,68 +1,31 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
1
+ # encoding: utf-8
5
2
 
6
3
  Gem::Specification.new do |s|
7
- s.name = %q{ruote-redis}
8
- s.version = "2.1.11"
9
4
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["John Mettraux"]
12
- s.date = %q{2010-10-01}
13
- s.description = %q{Redis storage for ruote (a ruby workflow engine)}
14
- s.email = %q{jmettraux@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- "CHANGELOG.txt",
21
- "CREDITS.txt",
22
- "LICENSE.txt",
23
- "README.rdoc",
24
- "Rakefile",
25
- "TODO.txt",
26
- "lib/ruote-redis.rb",
27
- "lib/ruote/redis.rb",
28
- "lib/ruote/redis/storage.rb",
29
- "lib/ruote/redis/version.rb",
30
- "ruote-redis.gemspec",
31
- "test/functional_connection.rb"
32
- ]
33
- s.homepage = %q{http://github.com/jmettraux/ruote-redis}
34
- s.rdoc_options = ["--charset=UTF-8"]
35
- s.require_paths = ["lib"]
36
- s.rubyforge_project = %q{ruote}
37
- s.rubygems_version = %q{1.3.6}
38
- s.summary = %q{Redis storage for ruote (a ruby workflow engine)}
39
- s.test_files = [
40
- "test/functional_connection.rb"
5
+ s.name = 'ruote-redis'
6
+ s.version = File.read('lib/ruote/redis/version.rb').match(/VERSION = '([^']+)'/)[1]
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = [ 'John Mettraux' ]
9
+ s.email = [ 'jmettraux@gmail.com' ]
10
+ s.homepage = 'http://ruote.rubyforge.org'
11
+ s.rubyforge_project = 'ruote'
12
+ s.summary = 'Redis storage for ruote (a Ruby workflow engine)'
13
+ s.description = %q{
14
+ Redis storage for ruote (a Ruby workflow engine)
15
+ }
16
+
17
+ #s.files = `git ls-files`.split("\n")
18
+ s.files = Dir[
19
+ 'Rakefile',
20
+ 'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb',
21
+ '*.gemspec', '*.txt', '*.rdoc', '*.md'
41
22
  ]
42
23
 
43
- if s.respond_to? :specification_version then
44
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
- s.specification_version = 3
24
+ s.add_runtime_dependency 'redis', '2.1.1'
25
+ s.add_runtime_dependency 'ruote', ">= #{s.version}"
26
+
27
+ s.add_development_dependency 'rake'
46
28
 
47
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
- s.add_runtime_dependency(%q<ruote>, [">= 2.1.11"])
49
- s.add_runtime_dependency(%q<redis>, [">= 2.0.5"])
50
- s.add_development_dependency(%q<yard>, [">= 0"])
51
- s.add_development_dependency(%q<rake>, [">= 0"])
52
- s.add_development_dependency(%q<jeweler>, [">= 0"])
53
- else
54
- s.add_dependency(%q<ruote>, [">= 2.1.11"])
55
- s.add_dependency(%q<redis>, [">= 2.0.5"])
56
- s.add_dependency(%q<yard>, [">= 0"])
57
- s.add_dependency(%q<rake>, [">= 0"])
58
- s.add_dependency(%q<jeweler>, [">= 0"])
59
- end
60
- else
61
- s.add_dependency(%q<ruote>, [">= 2.1.11"])
62
- s.add_dependency(%q<redis>, [">= 2.0.5"])
63
- s.add_dependency(%q<yard>, [">= 0"])
64
- s.add_dependency(%q<rake>, [">= 0"])
65
- s.add_dependency(%q<jeweler>, [">= 0"])
66
- end
29
+ s.require_path = 'lib'
67
30
  end
68
31
 
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  def new_storage (opts)
25
25
 
26
- Ruote::Redis::RedisStorage.new(
26
+ Ruote::Redis::Storage.new(
27
27
  ::Redis.new(:db => 14, :thread_safe => true),
28
28
  #::Redis.new(:db => 14, :thread_safe => true, :logger => RrLogger.new),
29
29
  opts)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 2
7
- - 1
8
- - 11
9
- version: 2.1.11
7
+ - 2
8
+ - 0
9
+ version: 2.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Mettraux
@@ -14,41 +14,44 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-01 00:00:00 +09:00
17
+ date: 2011-03-01 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: ruote
21
+ name: redis
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
- - - ">="
26
+ - - "="
26
27
  - !ruby/object:Gem::Version
27
28
  segments:
28
29
  - 2
29
30
  - 1
30
- - 11
31
- version: 2.1.11
31
+ - 1
32
+ version: 2.1.1
32
33
  type: :runtime
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
35
- name: redis
36
+ name: ruote
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
41
43
  segments:
42
44
  - 2
45
+ - 2
43
46
  - 0
44
- - 5
45
- version: 2.0.5
47
+ version: 2.2.0
46
48
  type: :runtime
47
49
  version_requirements: *id002
48
50
  - !ruby/object:Gem::Dependency
49
- name: yard
51
+ name: rake
50
52
  prerelease: false
51
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
52
55
  requirements:
53
56
  - - ">="
54
57
  - !ruby/object:Gem::Version
@@ -57,62 +60,40 @@ dependencies:
57
60
  version: "0"
58
61
  type: :development
59
62
  version_requirements: *id003
60
- - !ruby/object:Gem::Dependency
61
- name: rake
62
- prerelease: false
63
- requirement: &id004 !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
- version: "0"
70
- type: :development
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
84
- description: Redis storage for ruote (a ruby workflow engine)
85
- email: jmettraux@gmail.com
63
+ description: "\n\
64
+ Redis storage for ruote (a Ruby workflow engine)\n"
65
+ email:
66
+ - jmettraux@gmail.com
86
67
  executables: []
87
68
 
88
69
  extensions: []
89
70
 
90
- extra_rdoc_files:
91
- - LICENSE.txt
92
- - README.rdoc
71
+ extra_rdoc_files: []
72
+
93
73
  files:
94
- - CHANGELOG.txt
95
- - CREDITS.txt
96
- - LICENSE.txt
97
- - README.rdoc
98
74
  - Rakefile
99
- - TODO.txt
100
- - lib/ruote-redis.rb
101
- - lib/ruote/redis.rb
102
75
  - lib/ruote/redis/storage.rb
103
76
  - lib/ruote/redis/version.rb
104
- - ruote-redis.gemspec
77
+ - lib/ruote/redis.rb
78
+ - lib/ruote-redis.rb
105
79
  - test/functional_connection.rb
80
+ - ruote-redis.gemspec
81
+ - CHANGELOG.txt
82
+ - CREDITS.txt
83
+ - LICENSE.txt
84
+ - TODO.txt
85
+ - README.rdoc
106
86
  has_rdoc: true
107
- homepage: http://github.com/jmettraux/ruote-redis
87
+ homepage: http://ruote.rubyforge.org
108
88
  licenses: []
109
89
 
110
90
  post_install_message:
111
- rdoc_options:
112
- - --charset=UTF-8
91
+ rdoc_options: []
92
+
113
93
  require_paths:
114
94
  - lib
115
95
  required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
116
97
  requirements:
117
98
  - - ">="
118
99
  - !ruby/object:Gem::Version
@@ -120,6 +101,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
101
  - 0
121
102
  version: "0"
122
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
123
105
  requirements:
124
106
  - - ">="
125
107
  - !ruby/object:Gem::Version
@@ -129,9 +111,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
111
  requirements: []
130
112
 
131
113
  rubyforge_project: ruote
132
- rubygems_version: 1.3.6
114
+ rubygems_version: 1.3.7
133
115
  signing_key:
134
116
  specification_version: 3
135
- summary: Redis storage for ruote (a ruby workflow engine)
136
- test_files:
137
- - test/functional_connection.rb
117
+ summary: Redis storage for ruote (a Ruby workflow engine)
118
+ test_files: []
119
+