acts_as_executor 1.0.0.rc3 → 1.0.0.rc5
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.
- data/README.markdown +1 -1
- data/acts_as_executor.gemspec +1 -1
- data/lib/acts_as_executor/executor/model/instance_methods.rb +1 -0
- data/lib/acts_as_executor/task/model/instance_methods.rb +2 -2
- data/lib/acts_as_executor/version.rb +1 -1
- data/spec/acts_as_executor_spec.rb +1 -1
- data/spec/support/blueprints.rb +4 -3
- data/spec/task/model/instance_methods_spec.rb +27 -1
- metadata +6 -4
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# acts_as_executor
|
2
2
|
|
3
|
-
acts_as_executor seamlessly integrates Java’s Executor framework with
|
3
|
+
acts_as_executor seamlessly integrates Java’s Executor framework with Ruby on Rails, enabling an application to use executors in a familiar Rails’eque way.
|
4
4
|
|
5
5
|
[RubyGems][ruby_gems] | [GitHub][github] | [Travis CI][travis_ci] | [RubyDoc][ruby_doc] | [Wiki][wiki]
|
6
6
|
|
data/acts_as_executor.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ["philostler@gmail.com"]
|
11
11
|
s.homepage = "https://github.com/philostler/acts_as_executor"
|
12
12
|
s.summary = %q{Java Executor framework integration for Rails}
|
13
|
-
s.description = %q{Seamlessly integrates Java's Executor framework with
|
13
|
+
s.description = %q{Seamlessly integrates Java's Executor framework with Ruby on Rails}
|
14
14
|
|
15
15
|
s.files = Dir[".rspec"] +
|
16
16
|
Dir["acts_as_executor.gemspec"] +
|
@@ -13,6 +13,7 @@ module ActsAsExecutor
|
|
13
13
|
|
14
14
|
# Validations
|
15
15
|
base.validates :name, :presence => true, :uniqueness => true
|
16
|
+
base.validates :max_tasks, :presence => true, :if => :schedulable?
|
16
17
|
base.validates :max_tasks, :numericality => { :only_integer => true, :greater_than_or_equal_to => 1 }, :allow_nil => true
|
17
18
|
end
|
18
19
|
|
@@ -31,8 +31,8 @@ module ActsAsExecutor
|
|
31
31
|
instance = instantiate executable, arguments
|
32
32
|
|
33
33
|
self.future = executor.send(:execute, instance, id.to_s, schedule, start, every, units)
|
34
|
-
future.done_handler = method :done_handler
|
35
|
-
rescue
|
34
|
+
future.done_handler = method :done_handler unless executor.send(:schedulable?)
|
35
|
+
rescue RuntimeError => exception
|
36
36
|
executor.send(:log).error log_message executor.name, "creating", id.to_s, executable, "encountered an unexpected exception. " + exception.to_s
|
37
37
|
end
|
38
38
|
end
|
data/spec/support/blueprints.rb
CHANGED
@@ -23,7 +23,33 @@ describe ActsAsExecutor::Task::Model::InstanceMethods do
|
|
23
23
|
@model.send(:future).should == future
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
it "should set done handler on future" do
|
27
|
+
future = double "Future"
|
28
|
+
future.stub :done_handler=
|
29
|
+
|
30
|
+
@model.should_receive(:instantiate).and_return @executable
|
31
|
+
@model.executor.should_receive(:execute).with(@executable, @model.id.to_s, @model.schedule, @model.start, @model.every, @model.units).and_return future
|
32
|
+
future.should_receive(:done_handler=).with @model.method(:done_handler)
|
33
|
+
|
34
|
+
@model.send :enqueue
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when executor is schedulable" do
|
38
|
+
before(:each) { @model = ExecutorTask.make(:executor => Executor.make(:schedulable => true)) }
|
39
|
+
|
40
|
+
it "should not set done handler on future" do
|
41
|
+
future = double "Future"
|
42
|
+
future.stub :done_handler=
|
43
|
+
|
44
|
+
@model.should_receive(:instantiate).and_return @executable
|
45
|
+
@model.executor.should_receive(:execute).with(@executable, @model.id.to_s, @model.schedule, @model.start, @model.every, @model.units).and_return future
|
46
|
+
future.should_not_receive :done_handler=
|
47
|
+
|
48
|
+
@model.send :enqueue
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "when runtime exception is thrown" do
|
27
53
|
it "should log exception" do
|
28
54
|
exception = RuntimeError.new
|
29
55
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: acts_as_executor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 1.0.0.
|
5
|
+
version: 1.0.0.rc5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Phil Ostler
|
@@ -10,7 +10,8 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-24 00:00:00 +01:00
|
14
|
+
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: activemodel
|
@@ -67,7 +68,7 @@ dependencies:
|
|
67
68
|
version: "2.6"
|
68
69
|
type: :development
|
69
70
|
version_requirements: *id005
|
70
|
-
description: Seamlessly integrates Java's Executor framework with
|
71
|
+
description: Seamlessly integrates Java's Executor framework with Ruby on Rails
|
71
72
|
email:
|
72
73
|
- philostler@gmail.com
|
73
74
|
executables: []
|
@@ -125,6 +126,7 @@ files:
|
|
125
126
|
- spec/task/model/instance_support_methods_spec.rb
|
126
127
|
- spec/validators/class_exists_validator_spec.rb
|
127
128
|
- spec/validators/class_subclasses_validator_spec.rb
|
129
|
+
has_rdoc: true
|
128
130
|
homepage: https://github.com/philostler/acts_as_executor
|
129
131
|
licenses: []
|
130
132
|
|
@@ -148,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
150
|
requirements: []
|
149
151
|
|
150
152
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.
|
153
|
+
rubygems_version: 1.5.1
|
152
154
|
signing_key:
|
153
155
|
specification_version: 3
|
154
156
|
summary: Java Executor framework integration for Rails
|