guard-konacha 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/konacha/runner.rb +13 -18
- data/lib/guard/konacha/version.rb +1 -1
- metadata +2 -2
data/lib/guard/konacha/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'childprocess'
|
2
|
+
|
1
3
|
module Guard
|
2
4
|
class Konacha
|
3
5
|
class Runner
|
@@ -18,27 +20,19 @@ module Guard
|
|
18
20
|
|
19
21
|
def launch_konacha(action)
|
20
22
|
UI.info "#{action}ing Konacha", :reset => true
|
21
|
-
spawn_konacha
|
23
|
+
spawn_konacha
|
22
24
|
end
|
23
25
|
|
24
26
|
def kill_konacha
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
begin
|
30
|
-
unless Process.waitpid(@konacha_pid, Process::WNOHANG)
|
31
|
-
Process.kill(:KILL, @konacha_pid)
|
32
|
-
end
|
33
|
-
rescue Errno::ECHILD
|
27
|
+
if @process
|
28
|
+
@process.stop(5)
|
29
|
+
UI.info "Konacha Stopped", :reset => true
|
34
30
|
end
|
35
|
-
UI.info "Konacha Stopped", :reset => true
|
36
31
|
end
|
37
32
|
|
38
33
|
def run(paths=[])
|
39
34
|
UI.info "Konacha Running: #{paths.join(' ')}"
|
40
35
|
result = run_command(konacha_command(paths))
|
41
|
-
UI.info "Konacha Results: #{result}"
|
42
36
|
|
43
37
|
if @options[:notification]
|
44
38
|
last_line = result.split("\n").last
|
@@ -55,8 +49,9 @@ module Guard
|
|
55
49
|
|
56
50
|
private
|
57
51
|
|
58
|
-
def run_command(
|
59
|
-
`#{
|
52
|
+
def run_command(cmd)
|
53
|
+
puts result = `#{cmd}`
|
54
|
+
result
|
60
55
|
end
|
61
56
|
|
62
57
|
def spawn_konacha_command
|
@@ -78,10 +73,10 @@ module Guard
|
|
78
73
|
cmd_parts.join(' ').strip
|
79
74
|
end
|
80
75
|
|
81
|
-
def spawn_konacha
|
82
|
-
@
|
83
|
-
|
84
|
-
|
76
|
+
def spawn_konacha
|
77
|
+
@process = ChildProcess.build(spawn_konacha_command)
|
78
|
+
@process.io.inherit! if ::Guard.respond_to?(:options) && ::Guard.options && ::Guard.options[:verbose]
|
79
|
+
@process.start
|
85
80
|
end
|
86
81
|
|
87
82
|
def bundler?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-konacha
|
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,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|