guard-rails 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f706a3d0e897b3af7c6ae0713db3d8ade6d5cf0
4
- data.tar.gz: 2e21cce2bb912fac6154e3d647bb00165c693798
3
+ metadata.gz: 980372bd165663983bfe2fea772e9fd71a1a5f3d
4
+ data.tar.gz: 46733d354a02061658029e303b3c81379052f462
5
5
  SHA512:
6
- metadata.gz: 13fe51ed5e54ba072118cc082ec0c837a16248624178e0a8a38f865b9c01426933d15524db59ac9af7d59dd7861bae19fdae00cbfc76c82742be66ba3cce5cda
7
- data.tar.gz: 61bca0ffe0aaa08459812f5422de03be15c857b986be57f68e9272ebd8b0d843e68c340f2093b7d99e4d4bb85411d21d3462e41822c1d31e29ec4dc1461048f9
6
+ metadata.gz: 94923d164e99b0dc22f6d19ff2a0e9177f3b6d653bff8ea4c6f30424685f8064784f86db53f9fc374f6d9837240e45921b225ab0868aa6f0a013e343353cc43c
7
+ data.tar.gz: 97d23ae5780d127d1a00a91337d5a1ddeb816d2b61b859d8c747e3080b1eedb9acda1b43e48c6c1fe4ff3fcb8ca541b441fc7f3a515191b1f826042da4af0d0f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- guard-rails (0.7.1)
4
+ guard-rails (0.7.2)
5
5
  guard (~> 2.11)
6
6
  guard-compat (~> 1.0)
7
7
 
data/LICENSE CHANGED
@@ -1,22 +1,21 @@
1
- FOLLOW YOUR HEART PUBLIC LICENSE
2
- Version 1, July 2013
1
+ The MIT License (MIT)
3
2
 
4
- Copyright (C) 2013, Ranmocy Sheng <ranmocy@gmail.com>
3
+ Copyright (c) 2013, Ranmocy Sheng <ranmocy@gmail.com>
5
4
 
6
- Permission to use, copy, modify, and/or distribute this license for any purpose
7
- with or without fee is hereby granted, provided that the above copyright notice
8
- and this permission notice appear in all copies, under this license itself.
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
- THE WORK IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS WORK INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
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
- 1. You MUST follow your heart to do what you REALLY want to do with this WORK.
19
- 2. If you are working on something you don't truely like, you are NOT permitted
20
- to use this WORK in what you are working on.
21
- 3. Any work based on this work MUST under this license or the combination of this
22
- license and other compatible license.
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
- * Johnny Robeson
92
+ * Sho Kusano
91
93
 
92
94
  ## Copyright
93
95
 
94
- Guard-rails is under **[FOLLOW YOUR HEART PUBLIC LICENSE][FYHPL]** version 1.
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
- [FYHPL]: http://ranmocy.info/piece/FYHPL.txt
102
+ [MIT]: http://opensource.org/licenses/MIT
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
@@ -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
- wait_for_pid_loop { has_pid? }
152
+ wait_for_loop { has_pid? }
145
153
  end
146
154
 
147
155
  def wait_for_no_pid
148
- wait_for_pid_loop { !has_pid? }
156
+ wait_for_loop { !has_pid? }
149
157
  end
150
158
 
151
159
  def remove_pid_file_and_wait_for_no_pid
152
- wait_for_pid_loop do
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 wait_for_pid_loop
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
- before do
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
- pid_stub.returns(true)
301
- kill_expectation.never
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
- it "starts as normal" do
306
- expect(runner.start).to be true
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
- context 'with options[:force_run]' do
311
- let(:options) { default_options.merge(force_run: true) }
312
+ context 'with options[:force_run]' do
313
+ let(:options) { default_options.merge(force_run: true) }
312
314
 
313
- before do
314
- pid_stub.returns(true)
315
- kill_expectation.once
316
- mock(runner).wait_for_pid_action.never
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
- it "starts as normal" do
320
- expect(runner.start).to be true
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 "doesn't write the pid" do
325
- before do
326
- pid_stub.returns(false)
327
- kill_expectation.never
328
- mock(runner).wait_for_pid_action.times(Guard::Rails::Runner::MAX_WAIT_COUNT)
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
- it "doesn't start" do
332
- expect(runner.start).to be false
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.1
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-02-08 00:00:00.000000000 Z
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.5
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: []