deferred 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/MIT_LICENSE +19 -0
- data/README.markdown +215 -0
- data/Rakefile +1 -0
- data/deferred.gemspec +23 -0
- data/examples/threadpool_job_subtask.rb +203 -0
- data/lib/deferred.rb +32 -0
- data/lib/deferred/accessors.rb +170 -0
- data/lib/deferred/default.rb +36 -0
- data/lib/deferred/extensions.rb +22 -0
- data/lib/deferred/instance_methods.rb +82 -0
- data/lib/deferred/threadpool_job.rb +63 -0
- data/lib/deferred/version.rb +3 -0
- data/spec/deferred/accessors_spec.rb +95 -0
- data/spec/deferred/instance_methods_spec.rb +297 -0
- data/spec/deferred/threadpool_job_spec.rb +172 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/support/accessorized.rb +8 -0
- data/spec/support/bollocks_error.rb +2 -0
- data/spec/support/deferred_state_xtn.rb +22 -0
- metadata +166 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'deferred'
|
3
|
+
require 'evented-spec'
|
4
|
+
|
5
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
6
|
+
# in spec/support/ and its subdirectories.
|
7
|
+
$stderr.puts "loading: #{File.expand_path(File.join(File.dirname(__FILE__), "support/**/*.rb"))}"
|
8
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__), "support/**/*.rb"))].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
# == Mock Framework
|
12
|
+
#
|
13
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
+
#
|
15
|
+
# config.mock_with :mocha
|
16
|
+
# config.mock_with :flexmock
|
17
|
+
# config.mock_with :rr
|
18
|
+
config.mock_with :rspec
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
#config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
#config.use_transactional_fixtures = true
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class DeferredStateXtn
|
2
|
+
include Deferred::Accessors
|
3
|
+
|
4
|
+
deferred_event :start
|
5
|
+
|
6
|
+
attr_reader :start_called_times, :start_run_times
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@start_called_times = 0
|
10
|
+
@start_run_times = 0
|
11
|
+
end
|
12
|
+
|
13
|
+
def start(&blk)
|
14
|
+
@start_called_times += 1
|
15
|
+
|
16
|
+
deferred_state_transition(:on_start, blk) do
|
17
|
+
@start_run_times += 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deferred
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 13
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 3
|
10
|
+
version: 0.5.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jonathan D. Simms
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-01-28 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: eventmachine
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 59
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 12
|
32
|
+
- 10
|
33
|
+
version: 0.12.10
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 27
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 5
|
48
|
+
- 0
|
49
|
+
version: 2.5.0
|
50
|
+
- - <
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
hash: 7
|
53
|
+
segments:
|
54
|
+
- 3
|
55
|
+
- 0
|
56
|
+
- 0
|
57
|
+
version: 3.0.0
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id002
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: ZenTest
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 43
|
69
|
+
segments:
|
70
|
+
- 4
|
71
|
+
- 5
|
72
|
+
- 0
|
73
|
+
version: 4.5.0
|
74
|
+
type: :development
|
75
|
+
version_requirements: *id003
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: evented-spec
|
78
|
+
prerelease: false
|
79
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 13
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
- 4
|
88
|
+
- 1
|
89
|
+
version: 0.4.1
|
90
|
+
type: :development
|
91
|
+
version_requirements: *id004
|
92
|
+
description: |
|
93
|
+
Syntactical sugar around an EM::Deferrable
|
94
|
+
|
95
|
+
email:
|
96
|
+
- simms@hp.com
|
97
|
+
executables: []
|
98
|
+
|
99
|
+
extensions: []
|
100
|
+
|
101
|
+
extra_rdoc_files: []
|
102
|
+
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- .rspec
|
106
|
+
- Gemfile
|
107
|
+
- MIT_LICENSE
|
108
|
+
- README.markdown
|
109
|
+
- Rakefile
|
110
|
+
- deferred.gemspec
|
111
|
+
- examples/threadpool_job_subtask.rb
|
112
|
+
- lib/deferred.rb
|
113
|
+
- lib/deferred/accessors.rb
|
114
|
+
- lib/deferred/default.rb
|
115
|
+
- lib/deferred/extensions.rb
|
116
|
+
- lib/deferred/instance_methods.rb
|
117
|
+
- lib/deferred/threadpool_job.rb
|
118
|
+
- lib/deferred/version.rb
|
119
|
+
- spec/deferred/accessors_spec.rb
|
120
|
+
- spec/deferred/instance_methods_spec.rb
|
121
|
+
- spec/deferred/threadpool_job_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
- spec/support/accessorized.rb
|
124
|
+
- spec/support/bollocks_error.rb
|
125
|
+
- spec/support/deferred_state_xtn.rb
|
126
|
+
homepage:
|
127
|
+
licenses: []
|
128
|
+
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
140
|
+
segments:
|
141
|
+
- 0
|
142
|
+
version: "0"
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
hash: 3
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
version: "0"
|
152
|
+
requirements: []
|
153
|
+
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 1.8.10
|
156
|
+
signing_key:
|
157
|
+
specification_version: 3
|
158
|
+
summary: Syntactical sugar around an EM::Deferrable
|
159
|
+
test_files:
|
160
|
+
- spec/deferred/accessors_spec.rb
|
161
|
+
- spec/deferred/instance_methods_spec.rb
|
162
|
+
- spec/deferred/threadpool_job_spec.rb
|
163
|
+
- spec/spec_helper.rb
|
164
|
+
- spec/support/accessorized.rb
|
165
|
+
- spec/support/bollocks_error.rb
|
166
|
+
- spec/support/deferred_state_xtn.rb
|