guard-delayed 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.markdown +5 -5
- data/guard-delayed.gemspec +6 -5
- data/lib/guard/delayed/version.rb +1 -1
- data/lib/guard/delayed.rb +28 -27
- data/spec/guard/delayed_spec.rb +6 -14
- data/spec/spec_helper.rb +0 -2
- metadata +74 -110
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.1.2 (2012-01-25)
|
2
|
+
|
3
|
+
* Now passing the environment in using 'export RAILS_ENV=test;' before calling script/delayed_job
|
4
|
+
Thanks to @rwz for this patch
|
5
|
+
* Added a meaningful spec that checks the system call using a mock. Much nicer!
|
6
|
+
|
1
7
|
## 0.1.0 (2011-07-28)
|
2
8
|
|
3
9
|
* Fixed options for current delayed_job version (from dbloete)
|
data/README.markdown
CHANGED
@@ -39,10 +39,6 @@ being active.
|
|
39
39
|
Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
|
40
40
|
you make.
|
41
41
|
|
42
|
-
## Testing the gem locally
|
43
|
-
|
44
|
-
|
45
|
-
|
46
42
|
## Building and deploying gem
|
47
43
|
|
48
44
|
* Update the version number in `lib/guard/delayed/version.rb`
|
@@ -53,8 +49,12 @@ you make.
|
|
53
49
|
|
54
50
|
* Push to rubygems.org:
|
55
51
|
|
56
|
-
gem push guard-delayed-0.1.
|
52
|
+
gem push guard-delayed-0.1.2.gem
|
57
53
|
|
54
|
+
## Testing the gem locally
|
55
|
+
|
56
|
+
gem install guard-delayed-0.1.2.gem
|
57
|
+
|
58
58
|
|
59
59
|
## Authors
|
60
60
|
|
data/guard-delayed.gemspec
CHANGED
@@ -15,13 +15,14 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.required_rubygems_version = '>= 1.3.6'
|
16
16
|
s.rubyforge_project = "guard-delayed"
|
17
17
|
|
18
|
-
s.add_dependency 'guard', '
|
18
|
+
s.add_dependency 'guard', '> 0.3'
|
19
19
|
s.add_dependency 'delayed_job'
|
20
|
+
s.add_dependency 'daemons'
|
20
21
|
|
21
|
-
s.add_development_dependency 'bundler', '
|
22
|
-
s.add_development_dependency 'rspec', '
|
23
|
-
s.add_development_dependency 'guard-rspec', '
|
24
|
-
s.add_development_dependency 'guard-bundler', '
|
22
|
+
s.add_development_dependency 'bundler', '> 1.0.10'
|
23
|
+
s.add_development_dependency 'rspec', '> 2.5.0'
|
24
|
+
s.add_development_dependency 'guard-rspec', '> 0.2.0'
|
25
|
+
s.add_development_dependency 'guard-bundler', '> 0.1.1'
|
25
26
|
|
26
27
|
s.files = `git ls-files`.split("\n")
|
27
28
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/guard/delayed.rb
CHANGED
@@ -3,36 +3,37 @@ require 'guard/guard'
|
|
3
3
|
|
4
4
|
module Guard
|
5
5
|
class Delayed < Guard
|
6
|
-
|
6
|
+
|
7
7
|
# Allowable options are:
|
8
|
-
# :environment
|
9
|
-
# :min_priority
|
10
|
-
# :max_priority
|
11
|
-
# :number_of_workers
|
12
|
-
# :pid_dir
|
13
|
-
# :identifier
|
14
|
-
# :monitor
|
15
|
-
# :sleep-delay N
|
16
|
-
# :prefix NAME
|
17
|
-
|
8
|
+
# :environment defaults to 'test'
|
9
|
+
# :min_priority e.g. 2
|
10
|
+
# :max_priority e.g. 10
|
11
|
+
# :number_of_workers e.g. 2
|
12
|
+
# :pid_dir e.g. tmp/pids Specifies an alternate directory in which to store the process ids.
|
13
|
+
# :identifier A numeric identifier for the worker.
|
14
|
+
# :monitor Start monitor process.
|
15
|
+
# :sleep-delay N Amount of time to sleep in seconds when no jobs are found
|
16
|
+
# :prefix NAME String to be prefixed to worker process names
|
17
|
+
|
18
18
|
def initialize(watchers = [], options = {})
|
19
19
|
@options = options
|
20
|
-
super
|
20
|
+
super(watchers, options)
|
21
21
|
end
|
22
22
|
|
23
23
|
def start
|
24
|
-
system(cmd
|
24
|
+
system("#{cmd} stop")
|
25
25
|
UI.info "Starting up delayed_job..."
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
command = cmd
|
27
|
+
command << " start"
|
28
|
+
command << " --min-priority #{@options[:min_priority]}" if @options[:min_priority]
|
29
|
+
command << " --max-priority #{@options[:max_priority]}" if @options[:max_priority]
|
30
|
+
command << " --number_of_workers=#{@options[:number_of_workers]}" if @options[:number_of_workers]
|
31
|
+
command << " --pid-dir=#{@options[:pid_dir]}" if @options[:pid_dir]
|
32
|
+
command << " --identifier=#{@options[:identifier]}" if @options[:identifier]
|
33
|
+
command << " --monitor" if @options[:monitor]
|
34
|
+
command << " --sleep-delay #{@options[:sleep_delay]}" if @options[:sleep_delay]
|
35
|
+
command << " --prefix #{@options[:prefix]} " if @options[:prefix]
|
36
|
+
system(command)
|
36
37
|
end
|
37
38
|
|
38
39
|
# Called on Ctrl-C signal (when Guard quits)
|
@@ -58,16 +59,16 @@ module Guard
|
|
58
59
|
def run_on_change(paths)
|
59
60
|
restart
|
60
61
|
end
|
61
|
-
|
62
|
+
|
62
63
|
private
|
63
|
-
|
64
|
+
|
64
65
|
def restart
|
65
66
|
system(cmd, 'restart')
|
66
67
|
end
|
67
|
-
|
68
|
+
|
68
69
|
def cmd
|
69
70
|
command = "script/delayed_job"
|
70
|
-
command = "RAILS_ENV=#{@options[:environment]} #{command}" if @options[:environment]
|
71
|
+
command = "export RAILS_ENV=#{@options[:environment]}; #{command}" if @options[:environment]
|
71
72
|
command
|
72
73
|
end
|
73
74
|
end
|
data/spec/guard/delayed_spec.rb
CHANGED
@@ -1,20 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Guard::Delayed do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
after do
|
12
|
-
subject.stop
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should create a pid in /tmp/pids" do
|
16
|
-
subject.start
|
17
|
-
Dir.glob("tmp/pids/delayed_job*.pid").should_not be_empty
|
4
|
+
describe "when passing an environment option" do
|
5
|
+
it "calls system with 'export RAILS_ENV=test;' call first" do
|
6
|
+
@delayed = Guard::Delayed.new([], {:environment => 'test'})
|
7
|
+
@delayed.should_receive(:system).with("export RAILS_ENV=test; script/delayed_job stop").and_return(true)
|
8
|
+
@delayed.should_receive(:system).with("export RAILS_ENV=test; script/delayed_job start").and_return(true)
|
9
|
+
@delayed.start
|
18
10
|
end
|
19
11
|
end
|
20
12
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,125 +1,100 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-delayed
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- David Parry
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-25 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: guard
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70255822101020 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 3
|
32
|
-
version: "0.3"
|
18
|
+
requirements:
|
19
|
+
- - ! '>'
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.3'
|
33
22
|
type: :runtime
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70255822101020
|
25
|
+
- !ruby/object:Gem::Dependency
|
36
26
|
name: delayed_job
|
27
|
+
requirement: &70255822100640 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
37
34
|
prerelease: false
|
38
|
-
|
35
|
+
version_requirements: *70255822100640
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: daemons
|
38
|
+
requirement: &70255822100160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: bundler
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *70255822100160
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: &70255822099640 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 3
|
58
|
-
segments:
|
59
|
-
- 1
|
60
|
-
- 0
|
61
|
-
- 10
|
51
|
+
requirements:
|
52
|
+
- - ! '>'
|
53
|
+
- !ruby/object:Gem::Version
|
62
54
|
version: 1.0.10
|
63
55
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: rspec
|
67
56
|
prerelease: false
|
68
|
-
|
57
|
+
version_requirements: *70255822099640
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &70255822099140 !ruby/object:Gem::Requirement
|
69
61
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
hash: 27
|
74
|
-
segments:
|
75
|
-
- 2
|
76
|
-
- 5
|
77
|
-
- 0
|
62
|
+
requirements:
|
63
|
+
- - ! '>'
|
64
|
+
- !ruby/object:Gem::Version
|
78
65
|
version: 2.5.0
|
79
66
|
type: :development
|
80
|
-
version_requirements: *id004
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: guard-rspec
|
83
67
|
prerelease: false
|
84
|
-
|
68
|
+
version_requirements: *70255822099140
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: &70255822098620 !ruby/object:Gem::Requirement
|
85
72
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
hash: 23
|
90
|
-
segments:
|
91
|
-
- 0
|
92
|
-
- 2
|
93
|
-
- 0
|
73
|
+
requirements:
|
74
|
+
- - ! '>'
|
75
|
+
- !ruby/object:Gem::Version
|
94
76
|
version: 0.2.0
|
95
77
|
type: :development
|
96
|
-
version_requirements: *id005
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: guard-bundler
|
99
78
|
prerelease: false
|
100
|
-
|
79
|
+
version_requirements: *70255822098620
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: guard-bundler
|
82
|
+
requirement: &70255822098140 !ruby/object:Gem::Requirement
|
101
83
|
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
hash: 25
|
106
|
-
segments:
|
107
|
-
- 0
|
108
|
-
- 1
|
109
|
-
- 1
|
84
|
+
requirements:
|
85
|
+
- - ! '>'
|
86
|
+
- !ruby/object:Gem::Version
|
110
87
|
version: 0.1.1
|
111
88
|
type: :development
|
112
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70255822098140
|
113
91
|
description: Guard::Delayedjob automatically starts/stops/restarts delayed_job
|
114
|
-
email:
|
92
|
+
email:
|
115
93
|
- david.parry@suranyami.com
|
116
94
|
executables: []
|
117
|
-
|
118
95
|
extensions: []
|
119
|
-
|
120
96
|
extra_rdoc_files: []
|
121
|
-
|
122
|
-
files:
|
97
|
+
files:
|
123
98
|
- .gitignore
|
124
99
|
- CHANGELOG.md
|
125
100
|
- Gemfile
|
@@ -135,39 +110,28 @@ files:
|
|
135
110
|
- spec/spec_helper.rb
|
136
111
|
homepage: http://rubygems.org/gems/guard-delayed
|
137
112
|
licenses: []
|
138
|
-
|
139
113
|
post_install_message:
|
140
114
|
rdoc_options: []
|
141
|
-
|
142
|
-
require_paths:
|
115
|
+
require_paths:
|
143
116
|
- lib
|
144
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
118
|
none: false
|
146
|
-
requirements:
|
147
|
-
- -
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
|
150
|
-
|
151
|
-
- 0
|
152
|
-
version: "0"
|
153
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
124
|
none: false
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
hash: 23
|
159
|
-
segments:
|
160
|
-
- 1
|
161
|
-
- 3
|
162
|
-
- 6
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
163
128
|
version: 1.3.6
|
164
129
|
requirements: []
|
165
|
-
|
166
130
|
rubyforge_project: guard-delayed
|
167
|
-
rubygems_version: 1.8.
|
131
|
+
rubygems_version: 1.8.10
|
168
132
|
signing_key:
|
169
133
|
specification_version: 3
|
170
134
|
summary: guard gem for delayed_job
|
171
|
-
test_files:
|
135
|
+
test_files:
|
172
136
|
- spec/guard/delayed_spec.rb
|
173
137
|
- spec/spec_helper.rb
|