guard-rails 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -6
- data/Gemfile +4 -1
- data/Gemfile.lock +47 -51
- data/README.md +15 -6
- data/Rakefile +9 -9
- data/VERSION +1 -1
- data/guard-rails.gemspec +1 -6
- data/spec/lib/guard/rails/runner_spec.rb +40 -42
- data/spec/lib/guard/rails_spec.rb +25 -23
- data/spec/spec_helper.rb +0 -4
- metadata +8 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f3480f730afa98578307399c04d66f9b48d98ec
|
4
|
+
data.tar.gz: 52b9d335d4dc44afeeee0297b5aa9b20c352c08b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed236c4cf68fc1067d847be58e24189421867b7a9b05d5871475e7f348ccbd1fd782954c58de4fd66b314f5c90e7400e928faed4649c39634ac09e88113da297
|
7
|
+
data.tar.gz: f4155cbd8b8a665a5d98fb77dcd942a6269a047bc7b53773581d981b2f02236267b97f32755c4759a6faa63886c52530aec515f4a7d3c53f15638fbd86439f4b
|
data/.travis.yml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
rvm:
|
2
|
-
-
|
3
|
-
- 2.
|
4
|
-
-
|
5
|
-
|
6
|
-
- jruby
|
7
|
-
script: "bundle exec rake spec"
|
2
|
+
- 2.2.3
|
3
|
+
- 2.3.0
|
4
|
+
- jruby-9.0.5.0
|
5
|
+
script: "bundle && bundle exec rake spec"
|
8
6
|
addons:
|
9
7
|
code_climate:
|
10
8
|
repo_token: 2188902454f0733604836cd02e84f17634b7a49e337269905e0757051db2e3ca
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,27 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
guard-rails (0.7.
|
4
|
+
guard-rails (0.7.3)
|
5
5
|
guard (~> 2.11)
|
6
6
|
guard-compat (~> 1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
timers (~> 4.0.0)
|
13
|
-
codeclimate-test-reporter (0.4.6)
|
11
|
+
codeclimate-test-reporter (0.6.0)
|
14
12
|
simplecov (>= 0.7.1, < 1.0.0)
|
15
|
-
coderay (1.1.
|
13
|
+
coderay (1.1.1)
|
16
14
|
diff-lcs (1.2.5)
|
17
15
|
docile (1.1.5)
|
18
|
-
fakefs (0.
|
19
|
-
ffi (1.9.
|
20
|
-
ffi (1.9.
|
16
|
+
fakefs (0.9.0)
|
17
|
+
ffi (1.9.14)
|
18
|
+
ffi (1.9.14-java)
|
21
19
|
formatador (0.2.5)
|
22
|
-
guard (2.
|
20
|
+
guard (2.14.0)
|
23
21
|
formatador (>= 0.2.4)
|
24
|
-
listen (
|
22
|
+
listen (>= 2.7, < 4.0)
|
25
23
|
lumberjack (~> 1.0)
|
26
24
|
nenv (~> 0.1)
|
27
25
|
notiffany (~> 0.0)
|
@@ -33,66 +31,63 @@ GEM
|
|
33
31
|
guard (~> 2.2)
|
34
32
|
guard-compat (~> 1.1)
|
35
33
|
guard-compat (1.2.1)
|
36
|
-
guard-rspec (4.
|
34
|
+
guard-rspec (4.7.2)
|
37
35
|
guard (~> 2.1)
|
38
36
|
guard-compat (~> 1.1)
|
39
37
|
rspec (>= 2.99.0, < 4.0)
|
40
|
-
|
41
|
-
|
38
|
+
json (2.0.1)
|
39
|
+
json (2.0.1-java)
|
42
40
|
libnotify (0.9.1)
|
43
41
|
ffi (>= 1.0.11)
|
44
|
-
listen (
|
45
|
-
|
46
|
-
rb-
|
47
|
-
|
48
|
-
lumberjack (1.0.
|
42
|
+
listen (3.1.5)
|
43
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
44
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
45
|
+
ruby_dep (~> 1.2)
|
46
|
+
lumberjack (1.0.10)
|
49
47
|
method_source (0.8.2)
|
50
|
-
|
51
|
-
|
52
|
-
notiffany (0.0.4)
|
48
|
+
nenv (0.3.0)
|
49
|
+
notiffany (0.1.0)
|
53
50
|
nenv (~> 0.1)
|
54
51
|
shellany (~> 0.0)
|
55
|
-
pry (0.10.
|
52
|
+
pry (0.10.4)
|
56
53
|
coderay (~> 1.1.0)
|
57
54
|
method_source (~> 0.8.1)
|
58
55
|
slop (~> 3.4)
|
59
|
-
pry (0.10.
|
56
|
+
pry (0.10.4-java)
|
60
57
|
coderay (~> 1.1.0)
|
61
58
|
method_source (~> 0.8.1)
|
62
59
|
slop (~> 3.4)
|
63
60
|
spoon (~> 0.0)
|
64
|
-
rake (
|
65
|
-
rb-fsevent (0.9.
|
66
|
-
rb-inotify (0.9.
|
61
|
+
rake (11.2.2)
|
62
|
+
rb-fsevent (0.9.7)
|
63
|
+
rb-inotify (0.9.7)
|
67
64
|
ffi (>= 0.5.0)
|
68
|
-
|
69
|
-
|
70
|
-
rspec-
|
71
|
-
rspec-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
rspec-expectations (3.2.0)
|
65
|
+
rspec (3.5.0)
|
66
|
+
rspec-core (~> 3.5.0)
|
67
|
+
rspec-expectations (~> 3.5.0)
|
68
|
+
rspec-mocks (~> 3.5.0)
|
69
|
+
rspec-core (3.5.1)
|
70
|
+
rspec-support (~> 3.5.0)
|
71
|
+
rspec-expectations (3.5.0)
|
76
72
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
|
-
rspec-support (~> 3.
|
78
|
-
rspec-mocks (3.
|
73
|
+
rspec-support (~> 3.5.0)
|
74
|
+
rspec-mocks (3.5.0)
|
79
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
|
-
rspec-support (~> 3.
|
81
|
-
rspec-support (3.
|
76
|
+
rspec-support (~> 3.5.0)
|
77
|
+
rspec-support (3.5.0)
|
78
|
+
ruby_dep (1.3.1)
|
82
79
|
shellany (0.0.1)
|
83
|
-
simplecov (0.
|
80
|
+
simplecov (0.12.0)
|
84
81
|
docile (~> 1.1.0)
|
85
|
-
|
86
|
-
simplecov-html (~> 0.
|
87
|
-
simplecov-html (0.
|
82
|
+
json (>= 1.8, < 3)
|
83
|
+
simplecov-html (~> 0.10.0)
|
84
|
+
simplecov-html (0.10.0)
|
88
85
|
slop (3.6.0)
|
89
86
|
spoon (0.0.4)
|
90
87
|
ffi
|
91
|
-
terminal-notifier (1.6.
|
92
|
-
terminal-notifier-guard (1.
|
88
|
+
terminal-notifier (1.6.3)
|
89
|
+
terminal-notifier-guard (1.7.0)
|
93
90
|
thor (0.19.1)
|
94
|
-
timers (4.0.1)
|
95
|
-
hitimes
|
96
91
|
version (1.0.0)
|
97
92
|
|
98
93
|
PLATFORMS
|
@@ -101,15 +96,16 @@ PLATFORMS
|
|
101
96
|
|
102
97
|
DEPENDENCIES
|
103
98
|
codeclimate-test-reporter
|
104
|
-
fakefs
|
105
|
-
guard
|
99
|
+
fakefs
|
106
100
|
guard-bundler
|
107
101
|
guard-rails!
|
108
102
|
guard-rspec
|
109
103
|
libnotify
|
110
104
|
rake
|
111
|
-
|
112
|
-
rspec (~> 3.0)
|
105
|
+
rspec
|
113
106
|
terminal-notifier
|
114
107
|
terminal-notifier-guard
|
115
|
-
version
|
108
|
+
version
|
109
|
+
|
110
|
+
BUNDLED WITH
|
111
|
+
1.12.5
|
data/README.md
CHANGED
@@ -28,6 +28,14 @@ Add the default Guard::Rails template to your `Guardfile` by running:
|
|
28
28
|
$ guard init rails
|
29
29
|
```
|
30
30
|
|
31
|
+
Add options in Guardfile
|
32
|
+
```rb
|
33
|
+
guard :rails, port: 3000, host: '0.0.0.0' do
|
34
|
+
watch('Gemfile.lock')
|
35
|
+
watch(%r{^(config|lib)/.*})
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
31
39
|
Now I can automatically restart your Rails development server as your files change!
|
32
40
|
|
33
41
|
## Lots of fun options growing!
|
@@ -56,7 +64,7 @@ Now I can automatically restart your Rails development server as your files chan
|
|
56
64
|
## Philosophy
|
57
65
|
|
58
66
|
* **All Platforms** MRI is the main test case. But will be tested under REE and JRuby.
|
59
|
-
* **Live on the edge**
|
67
|
+
* **Live on the edge** Guard-Rails will be tested under Ruby 2.2.3 to 2.3.0 with newest gems.
|
60
68
|
* [Semantic Version](http://semver.org/)
|
61
69
|
|
62
70
|
## Contribute
|
@@ -73,23 +81,24 @@ And I will be there as your call.
|
|
73
81
|
* John Bintz
|
74
82
|
* cablegram
|
75
83
|
* Joel Moss
|
76
|
-
* Paul Schyska
|
77
84
|
* Sidney Burks
|
85
|
+
* Paul Schyska
|
78
86
|
* Adam Michel
|
79
87
|
* Adib Saad
|
80
88
|
* Cezary Baginski
|
81
89
|
* Nathan Broadbent
|
82
90
|
* Tim Preston
|
83
91
|
* killphi
|
92
|
+
* Michael
|
84
93
|
* Benjamin Sullivan
|
85
|
-
* Darrin Holst
|
86
|
-
* Everard Brown
|
87
|
-
* Grant Hutchins and Jonathan Mukai-Heidt
|
88
94
|
* Johnny Robeson
|
95
|
+
* Grant Hutchins and Jonathan Mukai-Heidt
|
96
|
+
* Everard Brown
|
97
|
+
* Sho Kusano
|
98
|
+
* Darrin Holst
|
89
99
|
* Leo Lou
|
90
100
|
* Luciano Sousa
|
91
101
|
* Michel Pavan Macedo
|
92
|
-
* Sho Kusano
|
93
102
|
|
94
103
|
## Copyright
|
95
104
|
|
data/Rakefile
CHANGED
@@ -8,25 +8,25 @@ require 'rake/version_task'
|
|
8
8
|
Rake::VersionTask.new
|
9
9
|
|
10
10
|
include Rake::DSL if defined?(Rake::DSL)
|
11
|
-
|
11
|
+
RVM_DO_ALL = "rvm all do"
|
12
12
|
|
13
13
|
|
14
14
|
namespace :spec do
|
15
15
|
desc "Run on three Rubies"
|
16
16
|
task :platforms do
|
17
|
-
exit $?.exitstatus unless system "#{
|
18
|
-
exit $?.exitstatus unless system "#{
|
17
|
+
exit $?.exitstatus unless system "#{RVM_DO_ALL} bundle install 2>&1 1>/dev/null "
|
18
|
+
exit $?.exitstatus unless system "#{RVM_DO_ALL} bundle exec rake spec"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
task :default => 'spec:platforms'
|
23
23
|
|
24
|
-
# Add to .git/config:
|
25
|
-
# [remote "all"]
|
26
|
-
# url = git@github.com:ranmocy/guard-rails.git
|
27
|
-
# url = git@gitcafe.com:ranmocy/guard-rails.git
|
28
24
|
desc 'Push everywhere!'
|
29
25
|
task :publish do
|
30
|
-
system %{git push
|
31
|
-
system %{git push
|
26
|
+
system %{git push}
|
27
|
+
system %{git push --tags}
|
28
|
+
end
|
29
|
+
|
30
|
+
task :contributors do
|
31
|
+
puts `git summary | grep "%" | sed 's/ *[0-9]*\.[0-9]*%//g' | cut -f2 | sed 's/^/* /g'`
|
32
32
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
data/guard-rails.gemspec
CHANGED
@@ -16,13 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.required_ruby_version = '>=
|
19
|
+
s.required_ruby_version = '>= 2.2.3'
|
20
20
|
|
21
21
|
s.add_dependency 'guard', '~> 2.11'
|
22
22
|
s.add_dependency('guard-compat', '~> 1.0')
|
23
|
-
|
24
|
-
s.add_development_dependency 'rspec', '~> 3.0'
|
25
|
-
s.add_development_dependency 'rr', '~> 1.0'
|
26
|
-
s.add_development_dependency 'fakefs', '~> 0.5'
|
27
|
-
s.add_development_dependency 'version', '>= 1.0.0'
|
28
23
|
end
|
@@ -220,7 +220,7 @@ describe Guard::Rails::Runner do
|
|
220
220
|
describe '#run_rails_command' do
|
221
221
|
before do
|
222
222
|
@bundler_env = ENV['BUNDLE_GEMFILE']
|
223
|
-
|
223
|
+
allow(runner).to receive(:build_command).and_return("printenv BUNDLE_GEMFILE > /dev/null")
|
224
224
|
end
|
225
225
|
after do
|
226
226
|
ENV['BUNDLE_GEMFILE'] = @bundler_env
|
@@ -288,20 +288,18 @@ describe Guard::Rails::Runner do
|
|
288
288
|
end
|
289
289
|
|
290
290
|
describe '#start' do
|
291
|
-
let(:kill_expectation) { mock(runner).kill_unmanaged_pid! }
|
292
|
-
let(:pid_stub) { stub(runner).has_pid? }
|
293
291
|
|
294
292
|
context 'without options[:zeus]' do
|
295
293
|
before do
|
296
|
-
|
297
|
-
|
294
|
+
expect(runner).to receive(:wait_for_zeus).never
|
295
|
+
expect(runner).to receive(:run_rails_command!).once
|
298
296
|
end
|
299
297
|
|
300
298
|
context 'without options[:force_run]' do
|
301
299
|
before do
|
302
|
-
|
303
|
-
|
304
|
-
|
300
|
+
allow(runner).to receive(:has_pid?).and_return(true)
|
301
|
+
expect(runner).to receive(:kill_unmanaged_pid!).never
|
302
|
+
expect(runner).to receive(:wait_for_pid_action).never
|
305
303
|
end
|
306
304
|
|
307
305
|
it "starts as normal" do
|
@@ -313,9 +311,9 @@ describe Guard::Rails::Runner do
|
|
313
311
|
let(:options) { default_options.merge(force_run: true) }
|
314
312
|
|
315
313
|
before do
|
316
|
-
|
317
|
-
|
318
|
-
|
314
|
+
allow(runner).to receive(:has_pid?).and_return(true)
|
315
|
+
expect(runner).to receive(:kill_unmanaged_pid!).once
|
316
|
+
expect(runner).to receive(:wait_for_pid_action).never
|
319
317
|
end
|
320
318
|
|
321
319
|
it "starts as normal" do
|
@@ -325,9 +323,9 @@ describe Guard::Rails::Runner do
|
|
325
323
|
|
326
324
|
context "doesn't write the pid" do
|
327
325
|
before do
|
328
|
-
|
329
|
-
|
330
|
-
|
326
|
+
allow(runner).to receive(:has_pid?).and_return(false)
|
327
|
+
expect(runner).to receive(:kill_unmanaged_pid!).never
|
328
|
+
expect(runner).to receive(:wait_for_pid_action).exactly(Guard::Rails::Runner::MAX_WAIT_COUNT).times
|
331
329
|
end
|
332
330
|
|
333
331
|
it "doesn't start" do
|
@@ -341,8 +339,8 @@ describe Guard::Rails::Runner do
|
|
341
339
|
|
342
340
|
context 'when zeus socket file is absent' do
|
343
341
|
before do
|
344
|
-
|
345
|
-
|
342
|
+
allow(runner).to receive(:sleep).and_return(1)
|
343
|
+
expect(File).to receive(:exist?).with(File.join(Dir.pwd, '.zeus.sock')).and_return(false).at_least(1)
|
346
344
|
end
|
347
345
|
|
348
346
|
it "waits for zeus" do
|
@@ -350,17 +348,17 @@ describe Guard::Rails::Runner do
|
|
350
348
|
end
|
351
349
|
|
352
350
|
it 'returns false' do
|
353
|
-
|
354
|
-
|
355
|
-
|
351
|
+
expect(Guard::UI).to receive(:info).with("[Guard::Rails::Error] Could not find zeus socket file.")
|
352
|
+
expect(runner).to receive(:run_rails_command!).never
|
353
|
+
expect(runner).to receive(:wait_for_pid).never
|
356
354
|
expect(runner.start).to be false
|
357
355
|
end
|
358
356
|
end
|
359
357
|
|
360
358
|
context 'when zeus socket file is present' do
|
361
359
|
before do
|
362
|
-
|
363
|
-
|
360
|
+
expect(runner).to receive(:sleep).never
|
361
|
+
expect(File).to receive(:exist?).with(File.join(Dir.pwd, '.zeus.sock')).and_return(true).once
|
364
362
|
end
|
365
363
|
|
366
364
|
it "doesn't wait for zeus" do
|
@@ -368,9 +366,9 @@ describe Guard::Rails::Runner do
|
|
368
366
|
end
|
369
367
|
|
370
368
|
it 'returns true' do
|
371
|
-
#
|
372
|
-
|
373
|
-
|
369
|
+
# expect(runner).to receive(:wait_for_zeus).and_return(true)
|
370
|
+
expect(runner).to receive(:run_rails_command!).once
|
371
|
+
expect(runner).to receive(:wait_for_pid).and_return(true).once
|
374
372
|
expect(runner.start).to be true
|
375
373
|
end
|
376
374
|
end
|
@@ -399,23 +397,23 @@ describe Guard::Rails::Runner do
|
|
399
397
|
end
|
400
398
|
|
401
399
|
it 'kills the process with INT' do
|
402
|
-
|
403
|
-
|
404
|
-
|
400
|
+
expect(runner).to receive(:kill_process).with("INT", pid).and_return(true)
|
401
|
+
allow(runner).to receive(:sleep)
|
402
|
+
expect(runner).to receive(:kill_process).with("KILL", pid).once
|
405
403
|
runner.stop
|
406
404
|
end
|
407
405
|
|
408
406
|
it 'kills the process with KILL when INT not work' do
|
409
|
-
|
410
|
-
|
407
|
+
expect(runner).to receive(:kill_process).with("INT", pid).and_return(false)
|
408
|
+
expect(runner).to receive(:kill_process).with("KILL", pid).once
|
411
409
|
runner.stop
|
412
410
|
end
|
413
411
|
end
|
414
412
|
|
415
413
|
context "when pid file doesn't exist" do
|
416
414
|
it 'does nothing' do
|
415
|
+
expect(runner).to receive(:kill_process).never
|
417
416
|
runner.stop
|
418
|
-
mock(runner).kill_process.never
|
419
417
|
end
|
420
418
|
end
|
421
419
|
|
@@ -426,7 +424,7 @@ describe Guard::Rails::Runner do
|
|
426
424
|
end
|
427
425
|
|
428
426
|
it 'does nothing' do
|
429
|
-
|
427
|
+
expect(runner).to receive(:kill_process).never
|
430
428
|
runner.stop
|
431
429
|
end
|
432
430
|
|
@@ -440,8 +438,8 @@ describe Guard::Rails::Runner do
|
|
440
438
|
|
441
439
|
describe '#restart' do
|
442
440
|
it 'calls stop and start' do
|
443
|
-
|
444
|
-
|
441
|
+
expect(runner).to receive(:stop).once
|
442
|
+
expect(runner).to receive(:start).once
|
445
443
|
runner.restart
|
446
444
|
end
|
447
445
|
end
|
@@ -450,14 +448,14 @@ describe Guard::Rails::Runner do
|
|
450
448
|
let(:pid) { 12345 }
|
451
449
|
|
452
450
|
it 'kill processes if any' do
|
453
|
-
|
454
|
-
|
451
|
+
expect(runner).to receive(:unmanaged_pid).and_return(pid)
|
452
|
+
expect(runner).to receive(:kill_process).with("KILL", pid).once
|
455
453
|
runner.send(:kill_unmanaged_pid!)
|
456
454
|
end
|
457
455
|
|
458
456
|
it 'does nothing if none' do
|
459
|
-
|
460
|
-
|
457
|
+
expect(runner).to receive(:unmanaged_pid).and_return(nil)
|
458
|
+
expect(runner).to receive(:kill_process).with("KILL", pid).never
|
461
459
|
runner.send(:kill_unmanaged_pid!)
|
462
460
|
end
|
463
461
|
end
|
@@ -466,14 +464,14 @@ describe Guard::Rails::Runner do
|
|
466
464
|
let(:pid) { 12345 }
|
467
465
|
|
468
466
|
it 'returns pid if any' do
|
469
|
-
|
467
|
+
expect(runner).to receive(:'`').with(anything) {
|
470
468
|
"ruby #{pid} ranmocy 12u IPv4 0x9c30720e04d31a0f 0t0 TCP *:#{default_port} (LISTEN)"
|
471
469
|
}
|
472
470
|
expect(runner.send(:unmanaged_pid)).to eq pid
|
473
471
|
end
|
474
472
|
|
475
473
|
it 'returns nil if none' do
|
476
|
-
|
474
|
+
expect(runner).to receive(:'`').with(anything).and_return("\n")
|
477
475
|
expect(runner.send(:unmanaged_pid)).to be nil
|
478
476
|
end
|
479
477
|
end
|
@@ -484,7 +482,7 @@ describe Guard::Rails::Runner do
|
|
484
482
|
let(:pid) { 12345 }
|
485
483
|
|
486
484
|
it 'returns true if killed' do
|
487
|
-
|
485
|
+
expect(Process).to receive(:kill).with(signal, pid).and_return(0)
|
488
486
|
expect(runner.send(:kill_process, signal, pid)).to be true
|
489
487
|
end
|
490
488
|
|
@@ -493,8 +491,8 @@ describe Guard::Rails::Runner do
|
|
493
491
|
end
|
494
492
|
|
495
493
|
it 'returns false if no permission to kill' do
|
496
|
-
|
497
|
-
|
494
|
+
expect(Process).to receive(:kill).with(signal, pid).and_raise(Errno::EPERM)
|
495
|
+
expect(Guard::UI).to receive(:info).with("[Guard::Rails::Error] Don't have permission to KILL!")
|
498
496
|
expect(runner.send(:kill_process, signal, pid)).to be false
|
499
497
|
end
|
500
498
|
end
|
@@ -14,12 +14,14 @@ describe Guard::Rails do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#start" do
|
17
|
-
let(:
|
17
|
+
let(:expect_ui_update) {
|
18
|
+
expect(Guard::UI).to receive(:info).with(/#{Guard::Rails::DEFAULT_OPTIONS[:port]}/)
|
19
|
+
}
|
18
20
|
|
19
21
|
context "starts when Guard starts" do
|
20
22
|
it "shows the right message and runs startup" do
|
21
|
-
|
22
|
-
|
23
|
+
expect(guard).to receive(:reload).with("start").once
|
24
|
+
expect_ui_update
|
23
25
|
guard.start
|
24
26
|
end
|
25
27
|
end
|
@@ -28,8 +30,8 @@ describe Guard::Rails do
|
|
28
30
|
let(:options) { { start_on_start: false } }
|
29
31
|
|
30
32
|
it "shows the right message and doesn't run startup" do
|
31
|
-
|
32
|
-
|
33
|
+
expect(guard).to receive(:reload).never
|
34
|
+
expect_ui_update
|
33
35
|
guard.start
|
34
36
|
end
|
35
37
|
end
|
@@ -39,19 +41,19 @@ describe Guard::Rails do
|
|
39
41
|
let(:pid) { '12345' }
|
40
42
|
|
41
43
|
before do
|
42
|
-
|
44
|
+
allow_any_instance_of(Guard::Rails::Runner).to receive(:pid).and_return(pid)
|
43
45
|
end
|
44
46
|
|
45
47
|
context 'at start' do
|
46
48
|
before do
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
expect(Guard::UI).to receive(:info).with('Starting Rails...')
|
50
|
+
expect(Guard::Notifier).to receive(:notify).with(/Rails starting/, hash_including(image: :pending))
|
51
|
+
allow_any_instance_of(Guard::Rails::Runner).to receive(:restart).and_return(true)
|
50
52
|
end
|
51
53
|
|
52
54
|
it "starts and shows the pid file" do
|
53
|
-
|
54
|
-
|
55
|
+
expect(Guard::UI).to receive(:info).with(/#{pid}/)
|
56
|
+
expect(Guard::Notifier).to receive(:notify).with(/Rails started/, hash_including(image: :success))
|
55
57
|
|
56
58
|
guard.reload("start")
|
57
59
|
end
|
@@ -59,19 +61,19 @@ describe Guard::Rails do
|
|
59
61
|
|
60
62
|
context "after start" do
|
61
63
|
before do
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
allow_any_instance_of(Guard::Rails::Runner).to receive(:pid).and_return(pid)
|
65
|
+
expect(Guard::UI).to receive(:info).with('Restarting Rails...')
|
66
|
+
expect(Guard::Notifier).to receive(:notify).with(/Rails restarting/, hash_including(image: :pending))
|
65
67
|
end
|
66
68
|
|
67
69
|
context "with pid file" do
|
68
70
|
before do
|
69
|
-
|
71
|
+
allow_any_instance_of(Guard::Rails::Runner).to receive(:restart).and_return(true)
|
70
72
|
end
|
71
73
|
|
72
74
|
it "restarts and shows the pid file" do
|
73
|
-
|
74
|
-
|
75
|
+
expect(Guard::UI).to receive(:info).with(/#{pid}/)
|
76
|
+
expect(Guard::Notifier).to receive(:notify).with(/Rails restarted/, hash_including(image: :success))
|
75
77
|
|
76
78
|
guard.reload
|
77
79
|
end
|
@@ -79,13 +81,13 @@ describe Guard::Rails do
|
|
79
81
|
|
80
82
|
context "without pid file" do
|
81
83
|
before do
|
82
|
-
|
84
|
+
allow_any_instance_of(Guard::Rails::Runner).to receive(:restart).and_return(false)
|
83
85
|
end
|
84
86
|
|
85
87
|
it "restarts and shows the pid file" do
|
86
|
-
|
87
|
-
|
88
|
-
|
88
|
+
expect(Guard::UI).to receive(:info).with(/#{pid}/).never
|
89
|
+
expect(Guard::UI).to receive(:info).with(/Rails NOT restarted/)
|
90
|
+
expect(Guard::Notifier).to receive(:notify).with(/Rails NOT restarted/, hash_including(image: :failed))
|
89
91
|
|
90
92
|
guard.reload
|
91
93
|
end
|
@@ -95,14 +97,14 @@ describe Guard::Rails do
|
|
95
97
|
|
96
98
|
describe "#stop" do
|
97
99
|
it "stops with correct message" do
|
98
|
-
|
100
|
+
expect(Guard::Notifier).to receive(:notify).with('Until next time...', anything)
|
99
101
|
guard.stop
|
100
102
|
end
|
101
103
|
end
|
102
104
|
|
103
105
|
describe '#run_on_change' do
|
104
106
|
it "reloads on change" do
|
105
|
-
|
107
|
+
expect(guard).to receive(:reload).once
|
106
108
|
guard.run_on_change([])
|
107
109
|
end
|
108
110
|
end
|
data/spec/spec_helper.rb
CHANGED
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.3
|
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:
|
12
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
@@ -39,62 +39,6 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rspec
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '3.0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '3.0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: rr
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '1.0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '1.0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: fakefs
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0.5'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0.5'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: version
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 1.0.0
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: 1.0.0
|
98
42
|
description: Restart Rails when things change in your app
|
99
43
|
email:
|
100
44
|
- john@coswellproductions.com
|
@@ -132,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
76
|
requirements:
|
133
77
|
- - ">="
|
134
78
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
79
|
+
version: 2.2.3
|
136
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
81
|
requirements:
|
138
82
|
- - ">="
|
@@ -140,8 +84,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
84
|
version: '0'
|
141
85
|
requirements: []
|
142
86
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
87
|
+
rubygems_version: 2.5.1
|
144
88
|
signing_key:
|
145
89
|
specification_version: 4
|
146
90
|
summary: Guard your Rails to always be there.
|
147
|
-
test_files:
|
91
|
+
test_files:
|
92
|
+
- spec/lib/guard/rails/runner_spec.rb
|
93
|
+
- spec/lib/guard/rails_spec.rb
|
94
|
+
- spec/spec_helper.rb
|