guard-rails 0.7.1 → 0.7.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/LICENSE +17 -18
- data/README.md +10 -8
- data/VERSION +1 -1
- data/lib/guard/rails/runner.rb +18 -6
- data/spec/lib/guard/rails/runner_spec.rb +71 -26
- metadata +4 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 980372bd165663983bfe2fea772e9fd71a1a5f3d
|
4
|
+
data.tar.gz: 46733d354a02061658029e303b3c81379052f462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94923d164e99b0dc22f6d19ff2a0e9177f3b6d653bff8ea4c6f30424685f8064784f86db53f9fc374f6d9837240e45921b225ab0868aa6f0a013e343353cc43c
|
7
|
+
data.tar.gz: 97d23ae5780d127d1a00a91337d5a1ddeb816d2b61b859d8c747e3080b1eedb9acda1b43e48c6c1fe4ff3fcb8ca541b441fc7f3a515191b1f826042da4af0d0f
|
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
|
2
|
-
Version 1, July 2013
|
1
|
+
The MIT License (MIT)
|
3
2
|
|
4
|
-
Copyright (
|
3
|
+
Copyright (c) 2013, Ranmocy Sheng <ranmocy@gmail.com>
|
5
4
|
|
6
|
-
Permission
|
7
|
-
|
8
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
14
|
-
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
15
|
-
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
16
|
-
THIS WORK.
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Add Guard::Rails to your `Gemfile`:
|
|
18
18
|
|
19
19
|
```ruby
|
20
20
|
group :development do
|
21
|
-
gem 'guard-rails'
|
21
|
+
gem 'guard-rails', require: false
|
22
22
|
end
|
23
23
|
```
|
24
24
|
|
@@ -73,28 +73,30 @@ And I will be there as your call.
|
|
73
73
|
* John Bintz
|
74
74
|
* cablegram
|
75
75
|
* Joel Moss
|
76
|
-
* Sidney Burks
|
77
76
|
* Paul Schyska
|
77
|
+
* Sidney Burks
|
78
78
|
* Adam Michel
|
79
|
+
* Adib Saad
|
79
80
|
* Cezary Baginski
|
80
81
|
* Nathan Broadbent
|
81
82
|
* Tim Preston
|
82
83
|
* killphi
|
83
84
|
* Benjamin Sullivan
|
84
|
-
* Grant Hutchins and Jonathan Mukai-Heidt
|
85
|
-
* Everard Brown
|
86
|
-
* Sho Kusano
|
87
85
|
* Darrin Holst
|
86
|
+
* Everard Brown
|
87
|
+
* Grant Hutchins and Jonathan Mukai-Heidt
|
88
|
+
* Johnny Robeson
|
89
|
+
* Leo Lou
|
88
90
|
* Luciano Sousa
|
89
91
|
* Michel Pavan Macedo
|
90
|
-
*
|
92
|
+
* Sho Kusano
|
91
93
|
|
92
94
|
## Copyright
|
93
95
|
|
94
|
-
Guard-rails is under **[
|
96
|
+
Guard-rails is under **[MIT license][MIT]**.
|
95
97
|
|
96
98
|
[ranmocy-guard-rails]: http://github.com/ranmocy/guard-rails
|
97
99
|
[guard]: https://github.com/guard/guard
|
98
100
|
[zeus]: https://github.com/burke/zeus
|
99
101
|
[zeus-custom-plan]: https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
|
100
|
-
[
|
102
|
+
[MIT]: http://opensource.org/licenses/MIT
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/lib/guard/rails/runner.rb
CHANGED
@@ -14,6 +14,12 @@ module Guard
|
|
14
14
|
|
15
15
|
def start
|
16
16
|
kill_unmanaged_pid! if options[:force_run]
|
17
|
+
|
18
|
+
if options[:zeus] && !wait_for_zeus
|
19
|
+
UI.info "[Guard::Rails::Error] Could not find zeus socket file."
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
|
17
23
|
run_rails_command!
|
18
24
|
wait_for_pid
|
19
25
|
end
|
@@ -65,6 +71,10 @@ module Guard
|
|
65
71
|
options[:timeout].to_f / MAX_WAIT_COUNT.to_f
|
66
72
|
end
|
67
73
|
|
74
|
+
def wait_for_zeus
|
75
|
+
wait_for_loop { File.exist?(zeus_sockfile) }
|
76
|
+
end
|
77
|
+
|
68
78
|
private
|
69
79
|
|
70
80
|
# command builders
|
@@ -138,24 +148,22 @@ module Guard
|
|
138
148
|
nil
|
139
149
|
end
|
140
150
|
|
141
|
-
private
|
142
|
-
|
143
151
|
def wait_for_pid
|
144
|
-
|
152
|
+
wait_for_loop { has_pid? }
|
145
153
|
end
|
146
154
|
|
147
155
|
def wait_for_no_pid
|
148
|
-
|
156
|
+
wait_for_loop { !has_pid? }
|
149
157
|
end
|
150
158
|
|
151
159
|
def remove_pid_file_and_wait_for_no_pid
|
152
|
-
|
160
|
+
wait_for_loop do
|
153
161
|
FileUtils.rm pid_file, force: true
|
154
162
|
!has_pid?
|
155
163
|
end
|
156
164
|
end
|
157
165
|
|
158
|
-
def
|
166
|
+
def wait_for_loop
|
159
167
|
count = 0
|
160
168
|
while !yield && count < MAX_WAIT_COUNT
|
161
169
|
wait_for_pid_action
|
@@ -182,6 +190,10 @@ module Guard
|
|
182
190
|
nil
|
183
191
|
end
|
184
192
|
|
193
|
+
def zeus_sockfile
|
194
|
+
File.join(@root, '.zeus.sock')
|
195
|
+
end
|
196
|
+
|
185
197
|
end
|
186
198
|
end
|
187
199
|
end
|
@@ -291,47 +291,91 @@ describe Guard::Rails::Runner do
|
|
291
291
|
let(:kill_expectation) { mock(runner).kill_unmanaged_pid! }
|
292
292
|
let(:pid_stub) { stub(runner).has_pid? }
|
293
293
|
|
294
|
-
|
295
|
-
mock(runner).run_rails_command!.once
|
296
|
-
end
|
297
|
-
|
298
|
-
context 'without options[:force_run]' do
|
294
|
+
context 'without options[:zeus]' do
|
299
295
|
before do
|
300
|
-
|
301
|
-
|
302
|
-
mock(runner).wait_for_pid_action.never
|
296
|
+
mock(runner).wait_for_zeus.never
|
297
|
+
mock(runner).run_rails_command!.once
|
303
298
|
end
|
304
299
|
|
305
|
-
|
306
|
-
|
300
|
+
context 'without options[:force_run]' do
|
301
|
+
before do
|
302
|
+
pid_stub.returns(true)
|
303
|
+
kill_expectation.never
|
304
|
+
mock(runner).wait_for_pid_action.never
|
305
|
+
end
|
306
|
+
|
307
|
+
it "starts as normal" do
|
308
|
+
expect(runner.start).to be true
|
309
|
+
end
|
307
310
|
end
|
308
|
-
end
|
309
311
|
|
310
|
-
|
311
|
-
|
312
|
+
context 'with options[:force_run]' do
|
313
|
+
let(:options) { default_options.merge(force_run: true) }
|
312
314
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
315
|
+
before do
|
316
|
+
pid_stub.returns(true)
|
317
|
+
kill_expectation.once
|
318
|
+
mock(runner).wait_for_pid_action.never
|
319
|
+
end
|
320
|
+
|
321
|
+
it "starts as normal" do
|
322
|
+
expect(runner.start).to be true
|
323
|
+
end
|
317
324
|
end
|
318
325
|
|
319
|
-
|
320
|
-
|
326
|
+
context "doesn't write the pid" do
|
327
|
+
before do
|
328
|
+
pid_stub.returns(false)
|
329
|
+
kill_expectation.never
|
330
|
+
mock(runner).wait_for_pid_action.times(Guard::Rails::Runner::MAX_WAIT_COUNT)
|
331
|
+
end
|
332
|
+
|
333
|
+
it "doesn't start" do
|
334
|
+
expect(runner.start).to be false
|
335
|
+
end
|
321
336
|
end
|
322
337
|
end
|
323
338
|
|
324
|
-
context
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
339
|
+
context 'with options[:zeus]' do
|
340
|
+
let(:options) { default_options.merge(zeus: true) }
|
341
|
+
|
342
|
+
context 'when zeus socket file is absent' do
|
343
|
+
before do
|
344
|
+
stub(runner).sleep { 1 }
|
345
|
+
mock(File).exist?(File.join(Dir.pwd, '.zeus.sock')) { false }.at_least(1)
|
346
|
+
end
|
347
|
+
|
348
|
+
it "waits for zeus" do
|
349
|
+
expect(runner.wait_for_zeus).to be false
|
350
|
+
end
|
351
|
+
|
352
|
+
it 'returns false' do
|
353
|
+
mock(Guard::UI).info("[Guard::Rails::Error] Could not find zeus socket file.")
|
354
|
+
mock(runner).run_rails_command!.never
|
355
|
+
mock(runner).wait_for_pid.never
|
356
|
+
expect(runner.start).to be false
|
357
|
+
end
|
329
358
|
end
|
330
359
|
|
331
|
-
|
332
|
-
|
360
|
+
context 'when zeus socket file is present' do
|
361
|
+
before do
|
362
|
+
mock(runner).sleep(1).never
|
363
|
+
mock(File).exist?(File.join(Dir.pwd, '.zeus.sock')) { true }.once
|
364
|
+
end
|
365
|
+
|
366
|
+
it "doesn't wait for zeus" do
|
367
|
+
expect(runner.wait_for_zeus).to be true
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'returns true' do
|
371
|
+
# mock(runner).wait_for_zeus { true }
|
372
|
+
mock(runner).run_rails_command!.once
|
373
|
+
mock(runner).wait_for_pid.once { true }
|
374
|
+
expect(runner.start).to be true
|
375
|
+
end
|
333
376
|
end
|
334
377
|
end
|
378
|
+
|
335
379
|
end
|
336
380
|
|
337
381
|
describe '#stop' do
|
@@ -463,4 +507,5 @@ describe Guard::Rails::Runner do
|
|
463
507
|
expect(runner.sleep_time).to eq (timeout.to_f / Guard::Rails::Runner::MAX_WAIT_COUNT.to_f)
|
464
508
|
end
|
465
509
|
end
|
510
|
+
|
466
511
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bintz
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -140,11 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.4.
|
143
|
+
rubygems_version: 2.4.6
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Guard your Rails to always be there.
|
147
|
-
test_files:
|
148
|
-
- spec/lib/guard/rails/runner_spec.rb
|
149
|
-
- spec/lib/guard/rails_spec.rb
|
150
|
-
- spec/spec_helper.rb
|
147
|
+
test_files: []
|