gearman-ruby 2.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/Rakefile +5 -6
  2. data/VERSION.yml +2 -2
  3. data/examples/calculus_client.rb +8 -10
  4. data/examples/calculus_worker.rb +4 -1
  5. data/examples/client.php +23 -0
  6. data/examples/client.rb +6 -10
  7. data/examples/client_background.rb +7 -7
  8. data/examples/client_data.rb +4 -4
  9. data/examples/client_epoch.rb +23 -0
  10. data/examples/client_exception.rb +4 -2
  11. data/examples/client_prefix.rb +4 -2
  12. data/examples/client_reverse.rb +27 -0
  13. data/examples/scale_image.rb +4 -3
  14. data/examples/scale_image_worker.rb +1 -1
  15. data/examples/worker.rb +2 -4
  16. data/examples/worker_data.rb +2 -2
  17. data/examples/worker_exception.rb +1 -1
  18. data/examples/worker_prefix.rb +1 -1
  19. data/examples/worker_reverse_string.rb +27 -0
  20. data/examples/worker_reverse_to_file.rb +18 -0
  21. data/examples/{evented_worker.rb → worker_signals.rb} +18 -8
  22. data/lib/gearman.rb +68 -21
  23. data/lib/gearman/client.rb +137 -65
  24. data/lib/gearman/server.rb +4 -4
  25. data/lib/gearman/task.rb +140 -20
  26. data/lib/gearman/taskset.rb +280 -5
  27. data/lib/gearman/testlib.rb +95 -0
  28. data/lib/gearman/util.rb +184 -28
  29. data/lib/gearman/worker.rb +356 -20
  30. data/test/client_test.rb +145 -0
  31. data/test/mock_client_test.rb +629 -0
  32. data/test/mock_worker_test.rb +321 -0
  33. data/test/util_test.rb +8 -3
  34. data/test/worker_test.rb +50 -34
  35. metadata +41 -41
  36. data/examples/client_echo.rb +0 -16
  37. data/examples/evented_client.rb +0 -23
  38. data/examples/worker_echo.rb +0 -20
  39. data/examples/worker_echo_pprof.rb +0 -5
  40. data/gearman-ruby.gemspec +0 -111
  41. data/lib/gearman/evented/client.rb +0 -99
  42. data/lib/gearman/evented/reactor.rb +0 -86
  43. data/lib/gearman/evented/worker.rb +0 -118
  44. data/lib/gearman/job.rb +0 -38
  45. data/lib/gearman/protocol.rb +0 -110
  46. data/test/basic_integration_test.rb +0 -121
  47. data/test/crash_test.rb +0 -69
  48. data/test/job_test.rb +0 -30
  49. data/test/protocol_test.rb +0 -132
  50. data/test/test_helper.rb +0 -31
data/test/test_helper.rb DELETED
@@ -1,31 +0,0 @@
1
- $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
2
- require 'gearman'
3
- require 'test/unit'
4
- require 'mocha'
5
-
6
- def start_gearmand(port = 4730, debug = false)
7
- log = debug ? "-l /tmp/gearmand.log -vvv" : ""
8
- system "gearmand -d -p #{port} --pid-file=#{gearmand_pidfile(port)} #{log}"
9
- gearmand_pid(port)
10
- end
11
-
12
- def stop_gearmand(port = 4730)
13
- Process.kill "KILL", gearmand_pid(port)
14
- File.unlink gearmand_pidfile(port)
15
- end
16
-
17
- def teardown_gearmands
18
- glob = "/tmp/gearmand_*_#{$$}.pid"
19
- Dir[glob].each do |pidfile|
20
- Process.kill "KILL", `cat #{pidfile}`.to_i
21
- File.unlink pidfile
22
- end
23
- end
24
-
25
- def gearmand_pid(port = 4730)
26
- `cat #{gearmand_pidfile(port)}`.to_i
27
- end
28
-
29
- def gearmand_pidfile(port)
30
- "/tmp/gearmand_#{port}_#{$$}.pid"
31
- end