navvy 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/navvy/job.rb +18 -1
- data/navvy.gemspec +5 -5
- data/spec/job_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- metadata +9 -9
data/Rakefile
CHANGED
@@ -10,11 +10,12 @@ begin
|
|
10
10
|
gem.email = "jeff@kreeftmeijer.nl"
|
11
11
|
gem.homepage = "http://github.com/jeffkreeftmeijer/navvy"
|
12
12
|
gem.authors = ["Jeff Kreeftmeijer"]
|
13
|
+
|
13
14
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
15
|
gem.add_development_dependency "yard", ">= 0.5.2"
|
15
|
-
gem.add_development_dependency "mongo_mapper", ">= 0.6.10"
|
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
19
|
end
|
19
20
|
Jeweler::GemcutterTasks.new
|
20
21
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/navvy/job.rb
CHANGED
@@ -64,7 +64,7 @@ module Navvy
|
|
64
64
|
def run
|
65
65
|
begin
|
66
66
|
started
|
67
|
-
result =
|
67
|
+
result = constantize(object).send(method_name, *args)
|
68
68
|
Navvy::Job.keep? ? completed : destroy
|
69
69
|
result
|
70
70
|
rescue Exception => exception
|
@@ -152,5 +152,22 @@ module Navvy
|
|
152
152
|
|
153
153
|
alias_method :completed?, :completed_at?
|
154
154
|
alias_method :failed?, :failed_at?
|
155
|
+
|
156
|
+
private
|
157
|
+
|
158
|
+
##
|
159
|
+
# Turn a constant with potential namespacing into an object
|
160
|
+
#
|
161
|
+
# @return [Class] class
|
162
|
+
|
163
|
+
def constantize(str)
|
164
|
+
names = str.split('::')
|
165
|
+
names.shift if names.empty? || names.first.empty?
|
166
|
+
constant = Object
|
167
|
+
names.each do |name|
|
168
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
169
|
+
end
|
170
|
+
constant
|
171
|
+
end
|
155
172
|
end
|
156
173
|
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.
|
8
|
+
s.version = "0.2.2"
|
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-
|
12
|
+
s.date = %q{2010-02-23}
|
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 = [
|
@@ -76,21 +76,21 @@ Gem::Specification.new do |s|
|
|
76
76
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
77
77
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
78
78
|
s.add_development_dependency(%q<yard>, [">= 0.5.2"])
|
79
|
-
s.add_development_dependency(%q<mongo_mapper>, [">= 0.6.10"])
|
80
79
|
s.add_development_dependency(%q<sequel>, [">= 3.8.0"])
|
81
80
|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
81
|
+
s.add_runtime_dependency(%q<daemons>, [">= 1.0.0"])
|
82
82
|
else
|
83
83
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
84
84
|
s.add_dependency(%q<yard>, [">= 0.5.2"])
|
85
|
-
s.add_dependency(%q<mongo_mapper>, [">= 0.6.10"])
|
86
85
|
s.add_dependency(%q<sequel>, [">= 3.8.0"])
|
87
86
|
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
87
|
+
s.add_dependency(%q<daemons>, [">= 1.0.0"])
|
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
|
-
s.add_dependency(%q<mongo_mapper>, [">= 0.6.10"])
|
93
92
|
s.add_dependency(%q<sequel>, [">= 3.8.0"])
|
94
93
|
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
94
|
+
s.add_dependency(%q<daemons>, [">= 1.0.0"])
|
95
95
|
end
|
96
96
|
end
|
data/spec/job_spec.rb
CHANGED
@@ -486,4 +486,11 @@ describe 'Navvy::Job' do
|
|
486
486
|
job.args.count.should == 2
|
487
487
|
end
|
488
488
|
end
|
489
|
+
|
490
|
+
describe '#namespaced' do
|
491
|
+
it 'should accept a namespaced class name' do
|
492
|
+
job = Navvy::Job.enqueue(Animals::Cow, :speak)
|
493
|
+
job.run.should == 'moo'
|
494
|
+
end
|
495
|
+
end
|
489
496
|
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.2.2
|
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-
|
12
|
+
date: 2010-02-23 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -33,34 +33,34 @@ dependencies:
|
|
33
33
|
version: 0.5.2
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: sequel
|
37
37
|
type: :development
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 3.8.0
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
46
|
+
name: sqlite3-ruby
|
47
47
|
type: :development
|
48
48
|
version_requirement:
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 1.2.5
|
54
54
|
version:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
type: :
|
56
|
+
name: daemons
|
57
|
+
type: :runtime
|
58
58
|
version_requirement:
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 1.
|
63
|
+
version: 1.0.0
|
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
|