ayl-beanstalk 0.1.2 → 0.1.3
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/VERSION +1 -1
- data/ayl-beanstalk.gemspec +3 -2
- data/bin/ayl_worker_control +11 -1
- data/lib/ayl-beanstalk/command_line.rb +4 -0
- data/spec/ayl_worker_control_spec.rb +30 -0
- data/spec/command_line_spec.rb +4 -4
- metadata +20 -19
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/ayl-beanstalk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ayl-beanstalk"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["j0hnds@gmail.com"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-09"
|
13
13
|
s.description = "Ayl extension to provide beanstalk support."
|
14
14
|
s.email = "j0hnds@gmail.com"
|
15
15
|
s.executables = ["ayl_beanstalk", "ayl_worker", "ayl_worker_control"]
|
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/ayl-beanstalk/engine.rb",
|
36
36
|
"lib/ayl-beanstalk/pool.rb",
|
37
37
|
"lib/ayl-beanstalk/worker.rb",
|
38
|
+
"spec/ayl_worker_control_spec.rb",
|
38
39
|
"spec/ayl_worker_spec.rb",
|
39
40
|
"spec/command_line_spec.rb",
|
40
41
|
"spec/engine_spec.rb",
|
data/bin/ayl_worker_control
CHANGED
@@ -11,4 +11,14 @@ options = Ayl::CommandLine.parse! Ayl::CommandLine.grab_app_arguments
|
|
11
11
|
raise "Must specify the path to the PID file" if options[:pid_path].nil?
|
12
12
|
raise "PID path does not exist" if !File.exists?(options[:pid_path])
|
13
13
|
|
14
|
-
|
14
|
+
daemon_options = {
|
15
|
+
:log_dir => '/tmp',
|
16
|
+
:log_output => true,
|
17
|
+
:dir_mode => :normal,
|
18
|
+
:dir => options[:pid_path],
|
19
|
+
:multiple => true
|
20
|
+
}
|
21
|
+
|
22
|
+
daemon_options.merge!({ :app_name => options[:app_name] }) if options.has_key?(:app_name)
|
23
|
+
|
24
|
+
Daemons.run(spath, daemon_options)
|
@@ -53,6 +53,10 @@ module Ayl
|
|
53
53
|
options[:pid_path] = pid_path
|
54
54
|
end
|
55
55
|
|
56
|
+
opts.on '-n', '--name NAME', 'The name to use for the worker daemon (overrides script name)', do | name |
|
57
|
+
options[:app_name] = name
|
58
|
+
end
|
59
|
+
|
56
60
|
opts.on '-h', '--help', 'Display the help message' do
|
57
61
|
puts opts
|
58
62
|
exit(0)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'daemons'
|
3
|
+
require 'ayl-beanstalk/command_line'
|
4
|
+
|
5
|
+
describe 'ayl_worker_control script' do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
ARGV.clear
|
9
|
+
@ayl_control_script = File.expand_path('../bin/ayl_worker_control', File.dirname(__FILE__))
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'handling command line' do
|
13
|
+
|
14
|
+
it "should honor the use of the -a option to name the daemon" do
|
15
|
+
ARGV.concat [ '--', '--pid-path', '/tmp', '--name', 'the_name' ]
|
16
|
+
Daemons.should_receive(:run).with(anything, { :log_dir => '/tmp', :log_output => true, :dir_mode => :normal, :dir => '/tmp', :app_name => 'the_name' })
|
17
|
+
|
18
|
+
load(@ayl_control_script, true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should assume the use of the script for the daemon name if no name argument is specified" do
|
22
|
+
ARGV.concat [ '--', '--pid-path', '/tmp' ]
|
23
|
+
Daemons.should_receive(:run).with(anything, { :log_dir => '/tmp', :log_output => true, :dir_mode => :normal, :dir => '/tmp' })
|
24
|
+
|
25
|
+
load(@ayl_control_script, true)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/spec/command_line_spec.rb
CHANGED
@@ -23,15 +23,15 @@ describe Ayl::CommandLine do
|
|
23
23
|
context "when parsing the command line" do
|
24
24
|
|
25
25
|
it "should extract the correct options from the command line when the short options are used" do
|
26
|
-
argv = %w{ -t tube_name -e development -a app_path -r -c config/environment -p pid_path }
|
26
|
+
argv = %w{ -t tube_name -e development -a app_path -r -c config/environment -p pid_path -n the_name }
|
27
27
|
parsed_options = Ayl::CommandLine.parse!(argv)
|
28
|
-
parsed_options.should == { :tube => 'tube_name', :env => 'development', :app_path => 'app_path', :rails_app => true, :app_require => 'config/environment', :pid_path => 'pid_path' }
|
28
|
+
parsed_options.should == { :tube => 'tube_name', :env => 'development', :app_path => 'app_path', :rails_app => true, :app_require => 'config/environment', :pid_path => 'pid_path', :app_name => 'the_name' }
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should extract the correct options from the command line when the long options are used" do
|
32
|
-
argv = %w{ --tube tube_name --environment development --app-path app_path --rails --require config/environment --pid-path pid_path }
|
32
|
+
argv = %w{ --tube tube_name --environment development --app-path app_path --rails --require config/environment --pid-path pid_path --name the_name }
|
33
33
|
parsed_options = Ayl::CommandLine.parse!(argv)
|
34
|
-
parsed_options.should == { :tube => 'tube_name', :env => 'development', :app_path => 'app_path', :rails_app => true, :app_require => 'config/environment', :pid_path => 'pid_path' }
|
34
|
+
parsed_options.should == { :tube => 'tube_name', :env => 'development', :app_path => 'app_path', :rails_app => true, :app_require => 'config/environment', :pid_path => 'pid_path', :app_name => 'the_name' }
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should raise an exception if invalid arguments are provided" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ayl-beanstalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ayl
|
16
|
-
requirement: &
|
16
|
+
requirement: &84206020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *84206020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: beanstalk-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &84205740 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *84205740
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: daemons
|
38
|
-
requirement: &
|
38
|
+
requirement: &84205400 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.1.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *84205400
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &84205080 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.3.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *84205080
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &84204740 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *84204740
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &84204380 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *84204380
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rcov
|
82
|
-
requirement: &
|
82
|
+
requirement: &84204030 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *84204030
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: pry
|
93
|
-
requirement: &
|
93
|
+
requirement: &84197390 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *84197390
|
102
102
|
description: Ayl extension to provide beanstalk support.
|
103
103
|
email: j0hnds@gmail.com
|
104
104
|
executables:
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/ayl-beanstalk/engine.rb
|
128
128
|
- lib/ayl-beanstalk/pool.rb
|
129
129
|
- lib/ayl-beanstalk/worker.rb
|
130
|
+
- spec/ayl_worker_control_spec.rb
|
130
131
|
- spec/ayl_worker_spec.rb
|
131
132
|
- spec/command_line_spec.rb
|
132
133
|
- spec/engine_spec.rb
|
@@ -149,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
150
|
version: '0'
|
150
151
|
segments:
|
151
152
|
- 0
|
152
|
-
hash:
|
153
|
+
hash: 347162333
|
153
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
155
|
none: false
|
155
156
|
requirements:
|