workforce 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
data/bin/workforce CHANGED
@@ -26,6 +26,11 @@ optparser = OptionParser.new do |opts|
26
26
  opts.on("--log-dir LOG_DIR", "Store logs on directory LOG_DIR", "Default: #{config.log_dir}") do |log_dir|
27
27
  config.log_dir = log_dir
28
28
  end
29
+
30
+ opts.on("-h", "--help", "Show this screen") do
31
+ puts optparser
32
+ exit
33
+ end
29
34
  end
30
35
 
31
36
  optparser.parse!
@@ -35,6 +40,7 @@ $:.unshift(config.workers_dir)
35
40
 
36
41
  begin
37
42
  Workforce::Controller.instance.dispatch(action, *args)
38
- rescue ArgumentError
43
+ rescue ArgumentError => e
44
+ puts e.message
39
45
  puts optparser
40
46
  end
@@ -7,12 +7,11 @@ module Workforce
7
7
  include Singleton
8
8
 
9
9
  def dispatch(action, *args)
10
- unless ACTIONS.include?(action.to_s)
11
- puts "Invalid action #{action}"
12
- exit(1)
10
+ if ACTIONS.include?(action.to_s)
11
+ send(action, *args)
12
+ else
13
+ raise ArgumentError, "Invalid action"
13
14
  end
14
-
15
- send(action, *args)
16
15
  end
17
16
 
18
17
  def list
@@ -89,10 +89,9 @@ module Workforce
89
89
  ensure_running!
90
90
 
91
91
  logger.info "Shutting down child processes"
92
- @pids.each do |pid|
93
- Process.kill(:QUIT, pid)
94
- end
95
-
92
+ @pids.each { |pid| Process.kill(:QUIT, pid) }
93
+ Process.waitall
94
+
96
95
  @pipe_out.write(1)
97
96
  end
98
97
  end
@@ -1,4 +1,5 @@
1
1
  base_path = File.dirname(__FILE__)
2
2
 
3
+ workers_dir "#{base_path}/workers"
3
4
  pid_dir "#{base_path}/pid"
4
- log_dir "#{base_path}/log"
5
+ log_dir "#{base_path}/log"
File without changes
data/workforce.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{workforce}
8
- s.version = "0.2.3"
8
+ s.version = "0.2.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rodrigo Kochenburger"]
@@ -26,16 +26,15 @@ Gem::Specification.new do |s|
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "bin/workforce",
29
- "config_sample.rb",
30
29
  "lib/workforce.rb",
31
30
  "lib/workforce/configuration.rb",
32
31
  "lib/workforce/controller.rb",
33
32
  "lib/workforce/inflector.rb",
34
33
  "lib/workforce/manager.rb",
34
+ "sample/config_sample.rb",
35
+ "sample/workers/sleep_daemon.rb",
35
36
  "spec/spec.opts",
36
37
  "spec/spec_helper.rb",
37
- "workers/simple_daemon.rb",
38
- "workers/sleep_daemon.rb",
39
38
  "workforce.gemspec"
40
39
  ]
41
40
  s.homepage = %q{http://github.com/divoxx/workforce}
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rodrigo Kochenburger
@@ -62,16 +62,15 @@ files:
62
62
  - Rakefile
63
63
  - VERSION
64
64
  - bin/workforce
65
- - config_sample.rb
66
65
  - lib/workforce.rb
67
66
  - lib/workforce/configuration.rb
68
67
  - lib/workforce/controller.rb
69
68
  - lib/workforce/inflector.rb
70
69
  - lib/workforce/manager.rb
70
+ - sample/config_sample.rb
71
+ - sample/workers/sleep_daemon.rb
71
72
  - spec/spec.opts
72
73
  - spec/spec_helper.rb
73
- - workers/simple_daemon.rb
74
- - workers/sleep_daemon.rb
75
74
  - workforce.gemspec
76
75
  has_rdoc: true
77
76
  homepage: http://github.com/divoxx/workforce
File without changes