iron_cuke 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/README.md +86 -0
- data/TODO.md +44 -12
- data/iron_cuke.gemspec +8 -9
- data/iron_cuke.log.0 +136 -0
- data/lib/generators/iron_cuke_generator.rb +17 -0
- data/lib/generators/templates/features/step_definitions/iron_cuke_steps.rb +3 -0
- data/lib/generators/templates/features/support/iron_cuke.rb +10 -0
- data/lib/iron_cuke/queue.rb +48 -0
- data/lib/iron_cuke/queue_item.rb +8 -6
- data/lib/iron_cuke/scheduled_queue.rb +34 -32
- data/lib/iron_cuke/test_service.rb +10 -0
- data/lib/iron_cuke/version.rb +1 -1
- data/lib/iron_cuke.rb +42 -11
- data/spec/lib/iron_cuke_spec.rb +111 -19
- data/spec/spec_helper.rb +1 -2
- data/spec/worker_integration/queue_spec.rb +73 -0
- metadata +46 -50
- data/README +0 -34
data/.gitignore
CHANGED
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
iron_cuke
|
2
|
+
=========
|
3
|
+
|
4
|
+
A small gem to help you mock out [IronWorker](http://iron.io) while using cucumber. iron_cuke provides a set of steps and Cucumber world objects you can use to simulate IronWorker while running cucumber tests, thereby saving time *and* money.
|
5
|
+
|
6
|
+
Help
|
7
|
+
----
|
8
|
+
|
9
|
+
* The [iron_cuke github page](https://github.com/yosemsweet/iron_cuke/) is the best place to start for documentation/help. Eventually I hope to have a wiki in place but that may take a while.
|
10
|
+
* [Patches and bugs](https://github.com/yosemsweet/iron_cuke/issues) at github issues
|
11
|
+
* RDoc - there is no rdoc archive for iron_cuke. This is on the todo list for iron_cuke.
|
12
|
+
|
13
|
+
Installation
|
14
|
+
------------
|
15
|
+
|
16
|
+
iron_cuke is a Rails 3 gem. It is currently tested against Rails 3.1 and should work with Rails 3.2 and 3.0
|
17
|
+
|
18
|
+
Include the gem in your Gemfile within the :test group:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
group :test do
|
22
|
+
gem 'iron_cuke'
|
23
|
+
end
|
24
|
+
```
|
25
|
+
|
26
|
+
I'm assuming you also have cucumber-rails and iron_worker gems installed, if not iron_cuke won't do you much good:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
gem 'cucumber-rails', :group => :test
|
30
|
+
gem 'iron_worker'
|
31
|
+
```
|
32
|
+
Now run:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
bundle install
|
36
|
+
rails generate iron_cuke
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
Basic Usage
|
41
|
+
-----------
|
42
|
+
|
43
|
+
Create and schedule/queue workers as normal. You can run your workers in one of three ways.
|
44
|
+
|
45
|
+
1. Use the `"When iron cuke runs"` step.
|
46
|
+
2. Use the `@iron_cuke` tag for your scenario - this will run IronCuke after every step (NOTE: This doesn't work if you have a scenario with a background)
|
47
|
+
3. Manually invoke it via `IronCuke.run`
|
48
|
+
|
49
|
+
How Does it Work?
|
50
|
+
-----------------
|
51
|
+
|
52
|
+
###IronCuke module###
|
53
|
+
|
54
|
+
The IronCuke module encapsulates access to IronCuke::ScheduledQueue and IronCuke::Queue
|
55
|
+
We monkey patch IronWorker.service to adjust the implementation of schedule and queue to use IronCuke::TestService instead.
|
56
|
+
|
57
|
+
*Functions*
|
58
|
+
* run - runs all workers according to options passed in. Defaults to using time == Time.now and priority == 0 which should run all queued workers and all scheduled workers scheduled to run before or at now. Higher priority items execute before lower priority ones.
|
59
|
+
* queue - takes a worker and priority options (equivalent to IronWorker service) and adds them to a worker queue to be executed the next time run is called. Priority defaults to 0.
|
60
|
+
* schedule - takes a worker and schedule parameters (equivalent to IronWorker service). Adds the worker into the hash at time. returns an array response equivalent to posting to iron worker. The response includes a scheduled_task_id identifying the scheduled worker
|
61
|
+
* clear - clears everything queued or scheduled
|
62
|
+
|
63
|
+
###IronCuke::TestService###
|
64
|
+
|
65
|
+
The IronCuke::TestService is an alternative (and very minimal) implementation of the IronWorker.service. Basically instead of doing all the interesting IronWorker goodness to package your workers and run them on the cloud it fakes doing all that and instead puts them in incredibly boring and simple hash like objects.
|
66
|
+
|
67
|
+
###IronCuke::QueueItem###
|
68
|
+
|
69
|
+
QueueItems wrap your workers in the various internal queues. Basically they allow me to keep track of the options the worker was queued with.
|
70
|
+
|
71
|
+
###IronCuke::ScheduledQueue and IronCuke::Queue###
|
72
|
+
|
73
|
+
These are hash like modules that extend the base IronCuke interface. They provide the schedule and queue management functionality.
|
74
|
+
|
75
|
+
Contribute
|
76
|
+
----------
|
77
|
+
|
78
|
+
Got awesome ideas or want to knock off an item on the TODO list?
|
79
|
+
|
80
|
+
* Fork the project.
|
81
|
+
* Test drive your feature addition or bug fix. Specs make all the difference here.
|
82
|
+
* Commit, do not mess with Rakefile or version.
|
83
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
84
|
+
* Send me a pull request. Bonus points for topic branches.
|
85
|
+
|
86
|
+
Gem started by Yosem Sweet and released (whatever that means) under the MIT license
|
data/TODO.md
CHANGED
@@ -1,13 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
* Create spec for TestService - easy and critical
|
4
|
-
* Support schedule options of: - medium
|
5
|
-
** run_times > 1
|
6
|
-
** every x period
|
7
|
-
* Instead of creating a bunch of mixins we should implement an IronWorker::TestService and have IronWorker.service return that. - hard
|
8
|
-
* Create a more dynamic response system. Right now it is basically just hardcoded. - easy
|
9
|
-
* Set up generators to create an iron_cuke.rb in cucumber features/support if present
|
10
|
-
* Implement cancel_schedule
|
11
|
-
* Implement schedules via TestService
|
12
|
-
* Implement Queueing system
|
1
|
+
Todo
|
2
|
+
====
|
13
3
|
|
4
|
+
* *Testing*
|
5
|
+
* Create spec for TestService - easy and critical
|
6
|
+
* Create specs for QueueItems - easy
|
7
|
+
* Create specs for ScheduledQueue - easy
|
8
|
+
* Create specs for generators
|
9
|
+
* Create specs for cucumber step and support files
|
10
|
+
* *Schedule*
|
11
|
+
* Support schedule options of: - medium
|
12
|
+
* run_times > 1
|
13
|
+
* every x period
|
14
|
+
* Ensure chronological execution order
|
15
|
+
* *Queue*
|
16
|
+
* Support recursive options for queue
|
17
|
+
* Support timeout options for queue
|
18
|
+
* Set an error/timeout mode
|
19
|
+
* Return error response if a worker queues a worker of same class and recursive isn't set to true
|
20
|
+
* Exceptions and errors
|
21
|
+
* Log instead of puts
|
22
|
+
* Provide a callback hook
|
23
|
+
* *Being a good gem
|
24
|
+
* Better generators and options for time mocking (iron_cuke:install, iron_cuke:install --timecop, iron_cuke:install --time-warp, etc)
|
25
|
+
* RDocs
|
26
|
+
* Travis CI
|
27
|
+
* Rails 3, 3.1, 3.2
|
28
|
+
* MRI 1.9.1, 1.9.2, 1.9.3
|
29
|
+
* JRuby
|
30
|
+
* REE
|
31
|
+
* Rubinius
|
32
|
+
* Wiki with details examples
|
33
|
+
* Samples of how to use Rack::Test to make requests via workers in test environment
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
Notes
|
39
|
+
=====
|
40
|
+
|
41
|
+
* Needs to work with cucumber (rspec later)
|
42
|
+
* Run jobs locally
|
43
|
+
* We don't need to run them asynchronously although it is awesome if they are.
|
44
|
+
* Scheduled events should fire when the timecop time says they should
|
45
|
+
* Rspec integration test not needed, just unit test
|
data/iron_cuke.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = IronCuke::VERSION
|
8
8
|
s.authors = ["Yosem Sweet"]
|
9
9
|
s.email = ["yosem.sweet@gmail.com"]
|
10
|
-
s.homepage = ""
|
11
|
-
s.summary = %q{A small
|
10
|
+
s.homepage = "https://github.com/yosemsweet/iron_cuke"
|
11
|
+
s.summary = %q{A small gem to help you mock out iron worker while using cucumber}
|
12
12
|
s.description = %q{iron_cuke provides a set of steps and Cucumber world objects you can use to simulate IronWorker while running cucumber tests.}
|
13
13
|
|
14
14
|
s.rubyforge_project = "iron_cuke"
|
@@ -19,16 +19,15 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
|
-
s.add_dependency "iron_worker"
|
23
|
-
s.add_dependency "cucumber", "
|
24
|
-
s.add_dependency "
|
22
|
+
s.add_dependency "iron_worker", '~>2.3'
|
23
|
+
s.add_dependency "cucumber", "~>1.1"
|
24
|
+
s.add_dependency "rails", "~>3.0"
|
25
|
+
s.add_dependency "json", '~>1.4'
|
25
26
|
|
26
|
-
s.add_development_dependency "require_all"
|
27
27
|
s.add_development_dependency "rack"
|
28
28
|
s.add_development_dependency "bundler"
|
29
29
|
s.add_development_dependency "git"
|
30
|
-
s.add_development_dependency "rspec-rails",
|
31
|
-
s.add_development_dependency "rails",
|
32
|
-
s.add_development_dependency "cucumber-rails"
|
30
|
+
s.add_development_dependency "rspec-rails", '~>2.8'
|
31
|
+
s.add_development_dependency "cucumber-rails", '~>1.1'
|
33
32
|
s.add_development_dependency "ruby-debug19"
|
34
33
|
end
|
data/iron_cuke.log.0
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
# Logfile created on 2012-02-01 18:56:13 -0800 by logger.rb/25413
|
2
|
+
Test worker run #<TestWorker:0x00000101e265d8>
|
3
|
+
Test worker run #<TestWorker:0x00000101e265b0>
|
4
|
+
Test worker run #<TestWorker:0x00000101576910>
|
5
|
+
Test worker run #<TestWorker:0x000001015768e8>
|
6
|
+
Test worker run #<TestWorker:0x0000010138e6e8>
|
7
|
+
Test worker run #<TestWorker:0x0000010138e6c0>
|
8
|
+
Test worker run #<TestWorker:0x00000101421f10>
|
9
|
+
Test worker run #<TestWorker:0x00000101421da8>
|
10
|
+
Test worker run #<TestWorker:0x00000101bc16a8>
|
11
|
+
Test worker run #<TestWorker:0x00000101bc1680>
|
12
|
+
Test worker run #<TestWorker:0x00000101530ed8>
|
13
|
+
Test worker run #<TestWorker:0x00000101530eb0>
|
14
|
+
Test worker run #<TestWorker:0x000001014f0900>
|
15
|
+
Test worker run #<TestWorker:0x000001014f08d8>
|
16
|
+
Test worker run #<TestWorker:0x000001013f64f0>
|
17
|
+
Test worker run #<TestWorker:0x000001013f64c8>
|
18
|
+
Test worker run #<TestWorker:0x00000101402228>
|
19
|
+
Test worker run #<TestWorker:0x00000101402200>
|
20
|
+
Test worker run #<TestWorker:0x00000101466908>
|
21
|
+
Test worker run #<TestWorker:0x000001014668e0>
|
22
|
+
Test worker run #<TestWorker:0x00000101d84a58>
|
23
|
+
Test worker run #<TestWorker:0x00000101d84a30>
|
24
|
+
Test worker run #<TestWorker:0x000001029eb878>
|
25
|
+
Test worker run #<TestWorker:0x000001029eb850>
|
26
|
+
Test worker run #<TestWorker:0x000001016a2e38>
|
27
|
+
Test worker run #<TestWorker:0x000001016a2e10>
|
28
|
+
Test worker run #<TestWorker:0x00000101ca7928>
|
29
|
+
Test worker run #<TestWorker:0x00000101ca7900>
|
30
|
+
Test worker run #<TestWorker:0x00000102946af8>
|
31
|
+
Test worker run #<TestWorker:0x00000102946ad0>
|
32
|
+
Test worker run #<TestWorker:0x00000102b0e728>
|
33
|
+
Test worker run #<TestWorker:0x00000102b0e700>
|
34
|
+
Test worker run #<TestWorker:0x0000010122fe28>
|
35
|
+
Test worker run #<TestWorker:0x0000010122fe00>
|
36
|
+
Test worker run #<TestWorker:0x00000100cd4000>
|
37
|
+
Test worker run #<TestWorker:0x00000100cd3fd8>
|
38
|
+
Test worker run #<TestWorker:0x00000102a803b0>
|
39
|
+
Test worker run #<TestWorker:0x00000102a80388>
|
40
|
+
Test worker run #<TestWorker:0x00000102a4edb0>
|
41
|
+
Test worker run #<TestWorker:0x00000102a4ed88>
|
42
|
+
Test worker run #<TestWorker:0x000001028bd168>
|
43
|
+
Test worker run #<TestWorker:0x000001028bd140>
|
44
|
+
Test worker run #<TestWorker:0x000001012e5278>
|
45
|
+
Test worker run #<TestWorker:0x000001012e5250>
|
46
|
+
Test worker run #<TestWorker:0x0000010292ce28>
|
47
|
+
Test worker run #<TestWorker:0x0000010292ce00>
|
48
|
+
Test worker run #<TestWorker:0x00000100f4dae8>
|
49
|
+
Test worker run #<TestWorker:0x00000100f4dac0>
|
50
|
+
Test worker run #<TestWorker:0x00000102a4a418>
|
51
|
+
Test worker run #<TestWorker:0x00000102a4a3f0>
|
52
|
+
Test worker run #<TestWorker:0x0000010280f2e8>
|
53
|
+
Test worker run #<TestWorker:0x0000010280f2c0>
|
54
|
+
Test worker run #<TestWorker:0x0000010288ddf0>
|
55
|
+
Test worker run #<TestWorker:0x0000010288ddc8>
|
56
|
+
Test worker run #<TestWorker:0x00000101da8430>
|
57
|
+
Test worker run #<TestWorker:0x00000101da8408>
|
58
|
+
Test worker run #<TestWorker:0x000001017484c8>
|
59
|
+
Test worker run #<TestWorker:0x000001017484a0>
|
60
|
+
Test worker run #<TestWorker:0x0000010162fb68 @foo="bar">
|
61
|
+
Test worker run #<TestWorker:0x0000010162fb18 @foo="bar">
|
62
|
+
Test worker run #<TestWorker:0x000001013bc778 @foo="bar">
|
63
|
+
Test worker run #<TestWorker:0x000001013bc728 @foo="bar">
|
64
|
+
Test worker run #<TestWorker:0x00000100d7d920 @foo="bar">
|
65
|
+
Test worker run #<TestWorker:0x00000100d7d8d0 @foo="bar">
|
66
|
+
Test worker run #<TestWorker:0x00000102a94450 @foo="bar">
|
67
|
+
Test worker run #<TestWorker:0x00000102a94400 @foo="bar">
|
68
|
+
Test worker run #<TestWorker:0x00000102a891b8 @foo="bar">
|
69
|
+
Test worker run #<TestWorker:0x00000102a89168 @foo="bar">
|
70
|
+
Test worker run #<TestWorker:0x00000102beab60 @foo="bar">
|
71
|
+
Test worker run #<TestWorker:0x00000102beab10 @foo="bar">
|
72
|
+
Test worker run #<TestWorker:0x000001029b7d98 @foo="bar", @schedule_id="8d6d336eff37ab72bb263828da9eba7f">
|
73
|
+
Test worker run #<TestWorker:0x000001029b7d48 @foo="bar", @schedule_id="d52604d0d4c172d4734a73f245ec025f">
|
74
|
+
Test worker run #<TestWorker:0x00000102b4f340 @foo="bar">
|
75
|
+
Test worker run #<TestWorker:0x00000102b4f2f0 @foo="bar">
|
76
|
+
Test worker run #<TestWorker:0x0000010291f2a0 @foo="bar", @schedule_id="67d259334f141712bcbd9f827f7d79eb">
|
77
|
+
Test worker run #<TestWorker:0x0000010291f250 @foo="bar", @schedule_id="67aa8a8dccd37f5329d6135ccc20df93">
|
78
|
+
Test worker run #<TestWorker:0x00000102976528 @foo="bar", @schedule_id="39a4ce57f9ee992caf57350d25de51ea">
|
79
|
+
Test worker run #<TestWorker:0x000001029764d8 @foo="bar", @schedule_id="911192e9d8e66f4040a26cbb65cb4093">
|
80
|
+
Test worker run #<TestWorker:0x000001028729b0 @foo="bar", @schedule_id="1469b43b9fc95128ecf8b0e7c23c30a7">
|
81
|
+
Test worker run #<TestWorker:0x00000102872960 @foo="bar", @schedule_id="d8a2f20de008fa74e58ac410e4c3bc5d">
|
82
|
+
Test worker run #<TestWorker:0x00000100f64b30 @foo="bar", @schedule_id="5dd35626957bb0fbd374e5bd7c177b62">
|
83
|
+
Test worker run #<TestWorker:0x00000100f64ae0 @foo="bar", @schedule_id="3dc350e174845b1a8ca490f79631b71c">
|
84
|
+
Test worker run #<TestWorker:0x00000100cee4f0 @foo="bar", @schedule_id="51570bd10f35148a9b586241dccda16f">
|
85
|
+
Test worker run #<TestWorker:0x00000100cee4a0 @foo="bar", @schedule_id="900c026c0aa8b8ad703cfc96651457f6">
|
86
|
+
Test worker run #<TestWorker:0x00000102b065c8 @foo="bar", @schedule_id="f8ffdc282814ba16797f49a637812a34">
|
87
|
+
Test worker run #<TestWorker:0x00000102b06578 @foo="bar", @schedule_id="ce85ea4b03ae12bc58b444e88f00448c">
|
88
|
+
Test worker run #<TestWorker:0x00000100fc2ff0 @foo="bar", @schedule_id="dbf95442c73354988581f1e0f46bd01a">
|
89
|
+
Test worker run #<TestWorker:0x00000100fc2fa0 @foo="bar", @schedule_id="7d9e59d2a877f1f693b212099a0c98e7">
|
90
|
+
Test worker run #<TestWorker:0x0000010281dff0 @foo="bar", @schedule_id="3383ed85f110e1564cb9cad4581e95fc">
|
91
|
+
Test worker run #<TestWorker:0x0000010281df50 @foo="bar", @schedule_id="4914ebeea477d6364b396239f407320f">
|
92
|
+
Test worker run #<TestWorker:0x00000102ae4630 @foo="bar", @schedule_id="6d3230619373b8af7f611e2e71921575">
|
93
|
+
Test worker run #<TestWorker:0x00000102ae45e0 @foo="bar", @schedule_id="56c6bf5d4537b8484de5d0634a47494a">
|
94
|
+
Test worker run #<TestWorker:0x00000100e3b1c8 @foo="bar", @schedule_id="dd1638248f88d3c7f12cc63959e5173e">
|
95
|
+
Test worker run #<TestWorker:0x00000100e3fd90 @foo="bar", @schedule_id="e8bf3abcc19c611bd2688c8cf9dce222">
|
96
|
+
Test worker run #<TestWorker:0x00000100e3fd40 @foo="bar", @schedule_id="0aed940a940b39ff0e442ebdb489159e">
|
97
|
+
Test worker run #<TestWorker:0x00000100fbb340 @foo="bar", @schedule_id="64162ec5c64a89052763e7b7e5df094b">
|
98
|
+
Test worker run #<TestWorker:0x00000100fbb2f0 @foo="bar", @schedule_id="451254cf5bf1baaddba5cbb7bba32edf">
|
99
|
+
Test worker run #<TestWorker:0x000001029ddea8 @foo="bar", @schedule_id="4e742f13c1fbd11fbd3ff6cdedbd1e1d">
|
100
|
+
Test worker run #<TestWorker:0x000001029e2a70 @foo="bar", @schedule_id="d24d3ed4f0befd2a2118559a738b011f">
|
101
|
+
Test worker run #<TestWorker:0x000001029e2a20 @foo="bar", @schedule_id="8bda70e467c96b31873518538841ed8c">
|
102
|
+
Test worker run #<TestWorker:0x000001029fd1e0 @foo="bar", @schedule_id="3b65971ebbe2a2274aeeb6383f803526">
|
103
|
+
Test worker run #<TestWorker:0x000001029fd190 @foo="bar", @schedule_id="f9312f5db1be65791babf4d4707ba1f2">
|
104
|
+
Test worker run #<TestWorker:0x000001013f83e0 @foo="bar", @schedule_id="eec31629f6c768913f5970510893c0d2">
|
105
|
+
Test worker run #<TestWorker:0x000001013f8390 @foo="bar", @schedule_id="fe07ec3e8cf867e01813b5e8edcf34ed">
|
106
|
+
Test worker run #<TestWorker:0x00000101df58c0 @foo="bar", @schedule_id="738b087069b1c3d35179d7397bc4e88d">
|
107
|
+
Test worker run #<TestWorker:0x00000101df5870 @foo="bar", @schedule_id="ae20539fb3fe4630c153cf5ca3d1301b">
|
108
|
+
Test worker run #<TestWorker:0x00000101793798 @foo="bar", @schedule_id="14dcf7fd42356bc1229e0e9e1d7479b7">
|
109
|
+
Test worker run #<TestWorker:0x00000101793748 @foo="bar", @schedule_id="6f79412919928de38e06aecabff9a4ff">
|
110
|
+
Test worker run #<TestWorker:0x000001028ec760 @foo="bar", @schedule_id="4e80cb573119dcdd1a58a2233840473a">
|
111
|
+
Test worker run #<TestWorker:0x000001028ec710 @foo="bar", @schedule_id="5f18ab8ca05fb229d71596f9f682135c">
|
112
|
+
Test worker run #<TestWorker:0x000001016372f0 @foo="bar", @schedule_id="cab998626440a501b453276a6191494a">
|
113
|
+
Test worker run #<TestWorker:0x000001016372a0 @foo="bar", @schedule_id="def095270b6d32c4a628129724a68bdc">
|
114
|
+
Test worker run #<TestWorker:0x00000102899df8 @foo="bar", @schedule_id="e809ab00c84d04ae496f39001efd1791">
|
115
|
+
Test worker run #<TestWorker:0x00000102899da8 @foo="bar", @schedule_id="b00992e133ec0d6dbd9b8c418c3c13e5">
|
116
|
+
Test worker run #<TestWorker:0x000001014e66a8 @foo="bar", @schedule_id="1e1c80b83832f0219b08b7a3a840ace6">
|
117
|
+
Test worker run #<TestWorker:0x000001014e6658 @foo="bar", @schedule_id="b315497c70c7367c1065818ce318d975">
|
118
|
+
Test worker run #<TestWorker:0x00000101bf9fd0 @foo="bar", @schedule_id="49251810e92b3b747178f23ece7b3ffa">
|
119
|
+
Test worker run #<TestWorker:0x00000101bf9f80 @foo="bar", @schedule_id="659b3d2cf137e600722b2a245380b07a">
|
120
|
+
Test worker run #<TestWorker:0x000001015fe5e0 @foo="bar", @schedule_id="8f20b331574d48f68fdfc8f7436cb670">
|
121
|
+
Test worker run #<TestWorker:0x000001015fe590 @foo="bar", @schedule_id="11be4eca4e7dcc5096450ed25ab5eae4">
|
122
|
+
Test worker run #<TestWorker:0x00000101dff2d0 @foo="bar", @schedule_id="5f8690f6c365a9fc195ced2ad4de99bf">
|
123
|
+
Test worker run #<TestWorker:0x00000101dff280 @foo="bar", @schedule_id="7fe369b39873021a882cc518ef3905ee">
|
124
|
+
Test worker run #<TestWorker:0x0000010294a400 @foo="bar", @schedule_id="1bd29396d7619016b744dc73b466268d">
|
125
|
+
Test worker run #<TestWorker:0x0000010294a3b0 @foo="bar", @schedule_id="5a04943f40b36415b2ea5da843aeca21">
|
126
|
+
Test worker run #<TestWorker:0x000001028820e0 @foo="bar", @schedule_id="785753a6c81bd273005280307ee2c524">
|
127
|
+
Test worker run #<TestWorker:0x00000102882090 @foo="bar", @schedule_id="3fad938fa4ee39625e237b3836bb3311">
|
128
|
+
Test worker run #<TestWorker:0x000001028dec50 @foo="bar", @schedule_id="c96ee1bad18e875d04f2ec0de1c4a59f">
|
129
|
+
Test worker run #<TestWorker:0x000001028dec00 @foo="bar", @schedule_id="9af4153d14ecad815258a2034434df54">
|
130
|
+
Test worker run #<TestWorker:0x00000100fe75f8 @foo="bar", @schedule_id="04157db242ecacbcb0b937952dfe274a">
|
131
|
+
Test worker run #<TestWorker:0x00000100fe75a8 @foo="bar", @schedule_id="67adadff312137459298686ba6b01e96">
|
132
|
+
Test worker run #<TestWorker:0x00000102832d38 @foo="bar", @schedule_id="67e3340fa1985bf9ef2ee089a1771aa4">
|
133
|
+
Test worker run #<TestWorker:0x00000102832ce8 @foo="bar", @schedule_id="c504a974592bb6aaee9a5f188072597b">
|
134
|
+
Test worker run #<TestWorker:0x0000010292edb8 @foo="bar", @schedule_id="aea60d1c68c005de58a5fd5a059c7f72">
|
135
|
+
Test worker run #<TestWorker:0x0000010292ed68 @foo="bar", @schedule_id="2a366d40595e9cfa7bd3117ed742bfd3">
|
136
|
+
Test worker run #<TestWorker:0x000001015f5b20 @foo="bar", @schedule_id="1622281de3307a191e5ee63b51616cc2">
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class IronCukeGenerator < Rails::Generators::Base
|
4
|
+
desc "Generates Iron Cuke step and support files."
|
5
|
+
|
6
|
+
def self.source_root
|
7
|
+
File.join(File.dirname(__FILE__), 'templates')
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_features_support
|
11
|
+
copy_file "features/support/iron_cuke.rb", "features/support/iron_cuke.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_features_step_definitions
|
15
|
+
copy_file "features/step_definitions/iron_cuke_steps.rb", "features/step_definitions/iron_cuke_steps.rb"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "iron_cuke/queue_item"
|
2
|
+
|
3
|
+
module IronCuke
|
4
|
+
module Queue
|
5
|
+
|
6
|
+
def queued(priority = 0)
|
7
|
+
raise ArgumentError unless priority.between?(0,2)
|
8
|
+
worker_queue.select{|p, workers| p >= priority}.values.map { |p|
|
9
|
+
p.map { |data|
|
10
|
+
data.worker
|
11
|
+
}
|
12
|
+
}.flatten
|
13
|
+
end
|
14
|
+
|
15
|
+
def queue(worker, options)
|
16
|
+
options = {:priority => 0}.merge(options)
|
17
|
+
raise NotImplementedError unless options[:priority].between?(0,2)
|
18
|
+
|
19
|
+
worker_queue[options[:priority]] ||= []
|
20
|
+
item = IronCuke::QueueItem.new(worker, options)
|
21
|
+
worker_queue[options[:priority]] << item
|
22
|
+
worker.task_id = item.id
|
23
|
+
response = IronCuke::Queue.create_response(item)
|
24
|
+
end
|
25
|
+
|
26
|
+
def clear_queue
|
27
|
+
worker_queue.clear
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def worker_queue
|
33
|
+
@worker_queue ||= Hash.new
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.create_response(item)
|
37
|
+
{
|
38
|
+
"msg" => "Tasks",
|
39
|
+
"tasks" => [
|
40
|
+
{
|
41
|
+
"id" => item.id
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"status_code" => 200
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/iron_cuke/queue_item.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'digest/md5'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module IronCuke
|
4
|
+
class QueueItem
|
5
|
+
attr_reader :worker, :options, :id
|
6
|
+
def initialize(worker, options)
|
7
|
+
@worker = worker
|
8
|
+
@options = options
|
9
|
+
@id = Digest::MD5.hexdigest(self.worker.inspect + self.options.inspect)
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
@@ -1,44 +1,46 @@
|
|
1
1
|
require "iron_cuke/queue_item"
|
2
2
|
|
3
|
-
module
|
3
|
+
module IronCuke
|
4
|
+
module ScheduledQueue
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def schedules
|
7
|
+
scheduled_queue.values.map { |scheduled| scheduled.map { |data| data.worker } }.flatten
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
def schedule(worker, schedule_options)
|
11
|
+
raise NotImplementedError if schedule_options[:run_times] > 1
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
scheduled_queue[schedule_options[:start_at]] ||= []
|
14
|
+
item = IronCuke::QueueItem.new(worker, schedule_options)
|
15
|
+
scheduled_queue[schedule_options[:start_at]] << item
|
16
|
+
worker.schedule_id = item.id
|
17
|
+
response = IronCuke::ScheduledQueue.create_response(item)
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def cancel_schedule(scheduled_task_id)
|
21
|
+
scheduled_queue.each { |k,v| v.delete_if{ |data| data.id == scheduled_task_id } }
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
def clear_schedules
|
25
|
+
scheduled_queue.clear
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
+
protected
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def scheduled_queue
|
31
|
+
@scheduled_queue ||= Hash.new
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
34
|
+
def self.create_response(item)
|
35
|
+
{
|
36
|
+
"msg" => "Scheduled",
|
37
|
+
"schedules" => [
|
38
|
+
{
|
39
|
+
"id" => item.id
|
40
|
+
}
|
41
|
+
],
|
42
|
+
"status_code" => 200
|
43
|
+
}
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
@@ -23,5 +23,15 @@ module IronWorker
|
|
23
23
|
IronCuke.cancel_schedule(scheduled_task_id)
|
24
24
|
end
|
25
25
|
end
|
26
|
+
module Queue
|
27
|
+
def queue(name, data, options)
|
28
|
+
worker = name.classify.constantize.new
|
29
|
+
variables = JSON.parse(Base64.decode64(data[:attr_encoded])) if data[:attr_encoded].present?
|
30
|
+
variables.each do |k, v|
|
31
|
+
worker.instance_variable_set(k.to_sym, v)
|
32
|
+
end
|
33
|
+
IronCuke.queue(worker, options)
|
34
|
+
end
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
data/lib/iron_cuke/version.rb
CHANGED
data/lib/iron_cuke.rb
CHANGED
@@ -1,21 +1,52 @@
|
|
1
1
|
require "iron_cuke/version"
|
2
2
|
require "iron_cuke/scheduled_queue"
|
3
|
+
require "iron_cuke/queue"
|
3
4
|
require "iron_cuke/test_service"
|
4
5
|
|
5
6
|
|
6
7
|
module IronCuke
|
7
|
-
extend ScheduledQueue
|
8
|
+
extend IronCuke::ScheduledQueue
|
9
|
+
extend IronCuke::Queue
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
class << self
|
12
|
+
|
13
|
+
def run(*args)
|
14
|
+
options = {:time => Time.now, :priority => 0}
|
15
|
+
options.merge! args.pop if args.last.is_a? Hash
|
16
|
+
run_scheduled_workers(options[:time])
|
17
|
+
run_queued(options[:priority])
|
18
|
+
end
|
19
|
+
|
20
|
+
def clear
|
21
|
+
clear_queue
|
22
|
+
clear_schedules
|
23
|
+
end
|
24
|
+
|
25
|
+
private:
|
26
|
+
def run_scheduled_workers(time)
|
27
|
+
to_execute = scheduled_queue.keys.select { |run_at| run_at <= time }
|
28
|
+
to_execute.each do |k|
|
29
|
+
begin
|
30
|
+
scheduled_queue[k].each { |data| data.worker.run_local }
|
31
|
+
scheduled_queue.delete(k)
|
32
|
+
rescue Exception => e
|
33
|
+
puts e
|
34
|
+
end
|
18
35
|
end
|
19
36
|
end
|
20
|
-
|
37
|
+
|
38
|
+
def run_queued(priority)
|
39
|
+
to_execute = worker_queue.keys.select { |p| p >= priority }
|
40
|
+
to_execute.sort{|x,y| y <=> x }.each do |p|
|
41
|
+
begin
|
42
|
+
worker_queue[p].each { |data| data.worker.run_local }
|
43
|
+
worker_queue.delete(p)
|
44
|
+
rescue Exception => e
|
45
|
+
puts e
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
21
52
|
end
|
data/spec/lib/iron_cuke_spec.rb
CHANGED
@@ -2,11 +2,61 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe IronCuke do
|
4
4
|
it { should respond_to(:run) }
|
5
|
+
|
6
|
+
it { should respond_to(:queue).with(2).arguments }
|
7
|
+
it { should respond_to(:queued) }
|
5
8
|
|
6
9
|
it { should respond_to(:schedule).with(2).arguments }
|
7
10
|
it { should respond_to(:schedules) }
|
8
11
|
it { should respond_to(:cancel_schedule).with(1).argument }
|
9
12
|
|
13
|
+
context "::queue" do
|
14
|
+
after(:each) do
|
15
|
+
IronCuke.clear
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with empty options" do
|
19
|
+
let!(:options) { {} }
|
20
|
+
|
21
|
+
it "should add a worker to queued" do
|
22
|
+
worker = TestWorker.new
|
23
|
+
|
24
|
+
expect {
|
25
|
+
IronCuke.queue(worker, options)
|
26
|
+
}.to change{IronCuke.queued.count}.by(1)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return a response hash include status_code and list of task_ids" do
|
30
|
+
worker = TestWorker.new
|
31
|
+
response = IronCuke.queue(worker, options)
|
32
|
+
response.should have_key "status_code"
|
33
|
+
response.should have_key "tasks"
|
34
|
+
response["tasks"].each do |s| s.should have_key "id" end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with a priority" do
|
39
|
+
let(:priority) { 1 }
|
40
|
+
let!(:options) { {:priority => priority} }
|
41
|
+
|
42
|
+
it "should add a worker to queued with the same priority" do
|
43
|
+
worker = TestWorker.new
|
44
|
+
|
45
|
+
expect {
|
46
|
+
IronCuke.queue(worker, options)
|
47
|
+
}.to change{IronCuke.queued(priority).count}.by(1)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return a response hash include status_code and list of task_ids" do
|
51
|
+
worker = TestWorker.new
|
52
|
+
response = IronCuke.queue(worker, options)
|
53
|
+
response.should have_key "status_code"
|
54
|
+
response.should have_key "tasks"
|
55
|
+
response["tasks"].each do |s| s.should have_key "id" end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
10
60
|
context "::schedule" do
|
11
61
|
after(:each) do
|
12
62
|
IronCuke.clear
|
@@ -88,30 +138,72 @@ describe IronCuke do
|
|
88
138
|
end
|
89
139
|
|
90
140
|
context "::run" do
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
141
|
+
context "with scheduled workers" do
|
142
|
+
let(:current_time) { Time.now }
|
143
|
+
let!(:past_worker) { TestWorker.new }
|
144
|
+
let!(:present_worker) { TestWorker.new }
|
145
|
+
let!(:future_worker) { TestWorker.new }
|
96
146
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
147
|
+
before(:each) do
|
148
|
+
IronCuke.schedule(past_worker, {:start_at => current_time - 1.second, :run_times => 1})
|
149
|
+
IronCuke.schedule(present_worker, {:start_at => current_time, :run_times => 1})
|
150
|
+
IronCuke.schedule(future_worker, {:start_at => current_time + 1.second, :run_times => 1})
|
151
|
+
end
|
101
152
|
|
102
|
-
|
103
|
-
|
104
|
-
|
153
|
+
after(:each) do
|
154
|
+
IronCuke.clear
|
155
|
+
end
|
105
156
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
157
|
+
it "should call run for each worker with a start at time before or equal to Time.now" do
|
158
|
+
past_worker.should_receive(:run_local)
|
159
|
+
present_worker.should_receive(:run_local)
|
160
|
+
IronCuke.run(:time => current_time)
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should not call run for each worker with a start at time after Time.now" do
|
164
|
+
future_worker.should_not_receive(:run_local)
|
165
|
+
IronCuke.run(:time => current_time)
|
166
|
+
end
|
110
167
|
end
|
168
|
+
context "with queued workers" do
|
169
|
+
let(:high_priority) { 2 }; let(:medium_priority) { 1 }; let(:low_priority) { 0 }
|
170
|
+
let!(:high_priority_worker) { TestWorker.new }
|
171
|
+
let!(:medium_priority_worker) { TestWorker.new }
|
172
|
+
let!(:low_priority_worker) { TestWorker.new }
|
173
|
+
|
174
|
+
before(:each) do
|
175
|
+
IronCuke.queue(high_priority_worker, {:priority => high_priority})
|
176
|
+
IronCuke.queue(medium_priority_worker, {:priority => medium_priority})
|
177
|
+
IronCuke.queue(low_priority_worker, {:priority => low_priority})
|
178
|
+
end
|
179
|
+
|
180
|
+
after(:each) do
|
181
|
+
IronCuke.clear
|
182
|
+
end
|
111
183
|
|
112
|
-
|
113
|
-
|
114
|
-
|
184
|
+
context "with no priority specified" do
|
185
|
+
it "should call run for all workers" do
|
186
|
+
high_priority_worker.should_receive(:run_local)
|
187
|
+
medium_priority_worker.should_receive(:run_local)
|
188
|
+
low_priority_worker.should_receive(:run_local)
|
189
|
+
IronCuke.run()
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
context "with a priority" do
|
194
|
+
let(:priority) { medium_priority}
|
195
|
+
it "should call run for all workers of that priority or higher" do
|
196
|
+
high_priority_worker.should_receive(:run_local)
|
197
|
+
medium_priority_worker.should_receive(:run_local)
|
198
|
+
IronCuke.run(:priority => priority)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should not call run for all workers with less than that priority" do
|
202
|
+
low_priority_worker.should_not_receive(:run_local)
|
203
|
+
IronCuke.run(:priority => priority)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
115
207
|
end
|
116
208
|
end
|
117
209
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'iron_cuke/test_service'
|
3
|
+
|
4
|
+
IronWorker.configure do |config|
|
5
|
+
config.token = 'IRON_WORKER_TOKEN'
|
6
|
+
config.project_id = 'IRON_WORKER_PROJECT_ID'
|
7
|
+
end
|
8
|
+
|
9
|
+
IronWorker.service.instance_eval do
|
10
|
+
extend IronWorker::TestService::Queue
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "IronWorker::Base.queue" do
|
14
|
+
let!(:worker) { TestWorker.new }
|
15
|
+
|
16
|
+
it "should add the worker to IronCuke.queue" do
|
17
|
+
expect {
|
18
|
+
worker.queue()
|
19
|
+
}.to change{IronCuke.queued.count}.by(1)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should set worker.response" do
|
23
|
+
expect {
|
24
|
+
worker.queue()
|
25
|
+
}.to change{worker.response}
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should set worker.task_id" do
|
29
|
+
expect {
|
30
|
+
worker.queue()
|
31
|
+
}.to change{worker.task_id}
|
32
|
+
|
33
|
+
worker.task_id.should_not be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should add a worker with the same task id in to IronCuke.queue" do
|
37
|
+
worker.queue()
|
38
|
+
|
39
|
+
IronCuke.queued.select { |w| w.task_id == worker.task_id }.should_not be_empty
|
40
|
+
end
|
41
|
+
|
42
|
+
context "response" do
|
43
|
+
let(:response) { worker.queue() }
|
44
|
+
it { response["status_code"].should == 200 }
|
45
|
+
it { response.should have_key "tasks" }
|
46
|
+
it { response["tasks"].should be_kind_of Array }
|
47
|
+
it { response["tasks"][0].should have_key "id" }
|
48
|
+
it { response["tasks"][0]["id"].should_not be_nil }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "with options" do
|
52
|
+
context "with a priority" do
|
53
|
+
context "with valid priorities" do
|
54
|
+
valid_priorities = (0..2)
|
55
|
+
valid_priorities.each do |priority|
|
56
|
+
context "with priority #{priority}" do
|
57
|
+
let!(:options) { { :priority => priority} }
|
58
|
+
|
59
|
+
it "queues the worker in priority #{priority}" do
|
60
|
+
lower_priority = [valid_priorities.min, priority - 1].max
|
61
|
+
higher_priority = [valid_priorities.max, priority + 1].min
|
62
|
+
|
63
|
+
expect {
|
64
|
+
worker.queue(options)
|
65
|
+
}.to change{ IronCuke.queued(priority).count}.by(1) # and to_not change{ IronCuke.queued(lower_priority).count }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_cuke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,55 +9,55 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_worker
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152301200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '2.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152301200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cucumber
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152299860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '1.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152299860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: rails
|
38
|
+
requirement: &2152277900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0'
|
43
|
+
version: '3.0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152277900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
49
|
-
requirement: &
|
48
|
+
name: json
|
49
|
+
requirement: &2152276200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
type: :
|
54
|
+
version: '1.4'
|
55
|
+
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152276200
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rack
|
60
|
-
requirement: &
|
60
|
+
requirement: &2152274760 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152274760
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &2152273400 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2152273400
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: git
|
82
|
-
requirement: &
|
82
|
+
requirement: &2152271840 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,43 +87,32 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2152271840
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec-rails
|
93
|
-
requirement: &
|
93
|
+
requirement: &2152251360 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.8
|
98
|
+
version: '2.8'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
102
|
-
- !ruby/object:Gem::Dependency
|
103
|
-
name: rails
|
104
|
-
requirement: &2153335980 !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 3.1.0
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: *2153335980
|
101
|
+
version_requirements: *2152251360
|
113
102
|
- !ruby/object:Gem::Dependency
|
114
103
|
name: cucumber-rails
|
115
|
-
requirement: &
|
104
|
+
requirement: &2152249960 !ruby/object:Gem::Requirement
|
116
105
|
none: false
|
117
106
|
requirements:
|
118
|
-
- -
|
107
|
+
- - ~>
|
119
108
|
- !ruby/object:Gem::Version
|
120
|
-
version: '
|
109
|
+
version: '1.1'
|
121
110
|
type: :development
|
122
111
|
prerelease: false
|
123
|
-
version_requirements: *
|
112
|
+
version_requirements: *2152249960
|
124
113
|
- !ruby/object:Gem::Dependency
|
125
114
|
name: ruby-debug19
|
126
|
-
requirement: &
|
115
|
+
requirement: &2152248320 !ruby/object:Gem::Requirement
|
127
116
|
none: false
|
128
117
|
requirements:
|
129
118
|
- - ! '>='
|
@@ -131,7 +120,7 @@ dependencies:
|
|
131
120
|
version: '0'
|
132
121
|
type: :development
|
133
122
|
prerelease: false
|
134
|
-
version_requirements: *
|
123
|
+
version_requirements: *2152248320
|
135
124
|
description: iron_cuke provides a set of steps and Cucumber world objects you can
|
136
125
|
use to simulate IronWorker while running cucumber tests.
|
137
126
|
email:
|
@@ -145,11 +134,16 @@ files:
|
|
145
134
|
- .rvmrc
|
146
135
|
- Gemfile
|
147
136
|
- License.txt
|
148
|
-
- README
|
137
|
+
- README.md
|
149
138
|
- Rakefile
|
150
139
|
- TODO.md
|
151
140
|
- iron_cuke.gemspec
|
141
|
+
- iron_cuke.log.0
|
142
|
+
- lib/generators/iron_cuke_generator.rb
|
143
|
+
- lib/generators/templates/features/step_definitions/iron_cuke_steps.rb
|
144
|
+
- lib/generators/templates/features/support/iron_cuke.rb
|
152
145
|
- lib/iron_cuke.rb
|
146
|
+
- lib/iron_cuke/queue.rb
|
153
147
|
- lib/iron_cuke/queue_item.rb
|
154
148
|
- lib/iron_cuke/scheduled_queue.rb
|
155
149
|
- lib/iron_cuke/test_service.rb
|
@@ -157,8 +151,9 @@ files:
|
|
157
151
|
- spec/lib/iron_cuke_spec.rb
|
158
152
|
- spec/spec_helper.rb
|
159
153
|
- spec/support/test_worker.rb
|
154
|
+
- spec/worker_integration/queue_spec.rb
|
160
155
|
- spec/worker_integration/schedule_spec.rb
|
161
|
-
homepage:
|
156
|
+
homepage: https://github.com/yosemsweet/iron_cuke
|
162
157
|
licenses: []
|
163
158
|
post_install_message:
|
164
159
|
rdoc_options: []
|
@@ -181,9 +176,10 @@ rubyforge_project: iron_cuke
|
|
181
176
|
rubygems_version: 1.8.11
|
182
177
|
signing_key:
|
183
178
|
specification_version: 3
|
184
|
-
summary: A small
|
179
|
+
summary: A small gem to help you mock out iron worker while using cucumber
|
185
180
|
test_files:
|
186
181
|
- spec/lib/iron_cuke_spec.rb
|
187
182
|
- spec/spec_helper.rb
|
188
183
|
- spec/support/test_worker.rb
|
184
|
+
- spec/worker_integration/queue_spec.rb
|
189
185
|
- spec/worker_integration/schedule_spec.rb
|
data/README
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
Development Notes and Todos:
|
2
|
-
|
3
|
-
Needs to work with cucumber and rspec
|
4
|
-
|
5
|
-
Notes
|
6
|
-
Run jobs locally
|
7
|
-
We don't need to run them asynchronously although it is awesome if they are.
|
8
|
-
Scheduled events should fire when the timecop time says they should
|
9
|
-
Initial pass can have a cucumber step for all jobs complete - this should not stick around for long though. ALternative is to have the ScheduledWorkerQueue run after every step
|
10
|
-
Rspec integration test not needed, just unit test
|
11
|
-
|
12
|
-
Basic model
|
13
|
-
|
14
|
-
IronCuke module encapsulates access to ScheduledWorkerQueue
|
15
|
-
|
16
|
-
Scheduled Workers:
|
17
|
-
ScheduledWorkerQueue - A hash where each worker is keyed by the time they run.
|
18
|
-
Functions
|
19
|
-
run - runs all workers before current time (should this be run_with_time?)
|
20
|
-
schedule - takes a worker and schedule parameters (equivalent to IronWorker service). Adds the worker into the hash at time. returns an array response equivalent to posting to iron worker. The response includes a scheduled_task_id identifying the scheduled worker
|
21
|
-
cancel - takes scheduled_task_id and removes from schedule
|
22
|
-
|
23
|
-
Workers
|
24
|
-
stub worker.schedule to write to scheduled workers
|
25
|
-
stub IronWorker.service.cancel_schedule to delegate to ScheduledWorkerQueue
|
26
|
-
|
27
|
-
## Contribute
|
28
|
-
* Fork the project.
|
29
|
-
* Test drive your feature addition or bug fix. Specs make all the difference here.
|
30
|
-
* Commit, do not mess with Rakefile, version, or ChangeLog.
|
31
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
32
|
-
* Send me a pull request. Bonus points for topic branches.
|
33
|
-
|
34
|
-
Gem developed by Yosem Sweet and released (whenever that is) under the MIT license
|