navvy 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ begin
15
15
  gem.add_development_dependency "yard", ">= 0.5.2"
16
16
  gem.add_development_dependency "sequel", ">= 3.8.0"
17
17
  gem.add_development_dependency "sqlite3-ruby", ">= 1.2.5"
18
- gem.add_dependency "daemons", ">= 1.0.0"
18
+ gem.add_dependency "daemons", ">= 1.0.10"
19
19
  end
20
20
  Jeweler::GemcutterTasks.new
21
21
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -22,7 +22,7 @@ module Navvy
22
22
  args.pop if args.last.empty?
23
23
  end
24
24
 
25
- create(
25
+ insert(
26
26
  :object => object.to_s,
27
27
  :method_name => method_name.to_s,
28
28
  :arguments => args.to_yaml,
@@ -31,6 +31,7 @@ module Navvy
31
31
  :run_at => options[:run_at] || Time.now,
32
32
  :created_at => Time.now
33
33
  )
34
+ order(:id.desc).first
34
35
  end
35
36
 
36
37
  ##
@@ -46,8 +47,9 @@ module Navvy
46
47
 
47
48
  def self.next(limit = self.limit)
48
49
  filter(
49
- '`failed_at` IS NULL AND `completed_at` IS NULL AND `run_at` <= ?',
50
- Time.now
50
+ (:run_at <= Time.now),
51
+ {:failed_at => nil,
52
+ :completed_at => nil}
51
53
  ).order(:priority.desc, :created_at).first(limit)
52
54
  end
53
55
 
@@ -60,9 +62,9 @@ module Navvy
60
62
 
61
63
  def self.cleanup
62
64
  if keep.is_a? Fixnum
63
- filter('`completed_at` <= ?', (Time.now - keep)).delete
65
+ filter(:completed_at <= (Time.now - keep)).delete
64
66
  else
65
- filter('`completed_at` IS NOT NULL').delete unless keep?
67
+ filter(~{:completed_at => nil}).delete unless keep?
66
68
  end
67
69
  end
68
70
 
@@ -131,7 +133,7 @@ module Navvy
131
133
  def times_failed
132
134
  i = parent_id || id
133
135
  self.class.filter(
134
- "(`id` == '#{i}' OR `parent_id` == '#{i}') AND `failed_at` IS NOT NULL"
136
+ ({:id => i} | {:parent_id => i}), ~{:failed_at => nil}
135
137
  ).count
136
138
  end
137
139
  end
data/navvy.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{navvy}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeff Kreeftmeijer"]
12
- s.date = %q{2010-02-23}
12
+ s.date = %q{2010-03-30}
13
13
  s.description = %q{Simple background job processor inspired by delayed_job, but aiming for database agnosticism.}
14
14
  s.email = %q{jeff@kreeftmeijer.nl}
15
15
  s.extra_rdoc_files = [
@@ -78,19 +78,19 @@ Gem::Specification.new do |s|
78
78
  s.add_development_dependency(%q<yard>, [">= 0.5.2"])
79
79
  s.add_development_dependency(%q<sequel>, [">= 3.8.0"])
80
80
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
81
- s.add_runtime_dependency(%q<daemons>, [">= 1.0.0"])
81
+ s.add_runtime_dependency(%q<daemons>, [">= 1.0.10"])
82
82
  else
83
83
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
84
84
  s.add_dependency(%q<yard>, [">= 0.5.2"])
85
85
  s.add_dependency(%q<sequel>, [">= 3.8.0"])
86
86
  s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
87
- s.add_dependency(%q<daemons>, [">= 1.0.0"])
87
+ s.add_dependency(%q<daemons>, [">= 1.0.10"])
88
88
  end
89
89
  else
90
90
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
91
91
  s.add_dependency(%q<yard>, [">= 0.5.2"])
92
92
  s.add_dependency(%q<sequel>, [">= 3.8.0"])
93
93
  s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
94
- s.add_dependency(%q<daemons>, [">= 1.0.0"])
94
+ s.add_dependency(%q<daemons>, [">= 1.0.10"])
95
95
  end
96
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navvy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Kreeftmeijer
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-23 00:00:00 +01:00
12
+ date: 2010-03-30 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 1.0.0
63
+ version: 1.0.10
64
64
  version:
65
65
  description: Simple background job processor inspired by delayed_job, but aiming for database agnosticism.
66
66
  email: jeff@kreeftmeijer.nl