guard-webpacker 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -17
- data/lib/guard/webpacker.rb +25 -14
- data/lib/guard/webpacker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f1fa502f7c6061c76d0a4791545deaddcdadcd748400eac1693dbc37da87d3
|
4
|
+
data.tar.gz: 49bc7dc0f1f42ee958acdbcdc1a26bca12aac3890ace54d08c446c0d4e9ad68f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91f8fdb5097c9e07d2b1fea4ada613b3c92f4a7720191832a5c226048d15eb90524ccfd6ff366e8457478b9841f55eeebc8a51fd822cf7c081c3f2d808787ec4
|
7
|
+
data.tar.gz: cfc176e693d82dd8acba7ea243cd746dc8f57311cfe04eda611293364f0daabce0dcbee738000623b652e6a932acf09c25688d864dab079b23b4298d8e5df57f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
guard-webpacker (0.
|
4
|
+
guard-webpacker (0.2.1)
|
5
5
|
guard (>= 2)
|
6
6
|
guard-compat (~> 1.0)
|
7
7
|
|
@@ -10,9 +10,9 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
coderay (1.1.2)
|
12
12
|
diff-lcs (1.3)
|
13
|
-
ffi (1.11.
|
13
|
+
ffi (1.11.3)
|
14
14
|
formatador (0.2.5)
|
15
|
-
guard (2.
|
15
|
+
guard (2.16.1)
|
16
16
|
formatador (>= 0.2.4)
|
17
17
|
listen (>= 2.7, < 4.0)
|
18
18
|
lumberjack (>= 1.0.12, < 2.0)
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
shellany (~> 0.0)
|
23
23
|
thor (>= 0.18.1)
|
24
24
|
guard-compat (1.2.1)
|
25
|
-
listen (3.2.
|
25
|
+
listen (3.2.1)
|
26
26
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
27
27
|
rb-inotify (~> 0.9, >= 0.9.10)
|
28
28
|
lumberjack (1.0.13)
|
@@ -38,21 +38,21 @@ GEM
|
|
38
38
|
rb-fsevent (0.10.3)
|
39
39
|
rb-inotify (0.10.0)
|
40
40
|
ffi (~> 1.0)
|
41
|
-
rspec (3.
|
42
|
-
rspec-core (~> 3.
|
43
|
-
rspec-expectations (~> 3.
|
44
|
-
rspec-mocks (~> 3.
|
45
|
-
rspec-core (3.
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-expectations (3.
|
41
|
+
rspec (3.9.0)
|
42
|
+
rspec-core (~> 3.9.0)
|
43
|
+
rspec-expectations (~> 3.9.0)
|
44
|
+
rspec-mocks (~> 3.9.0)
|
45
|
+
rspec-core (3.9.0)
|
46
|
+
rspec-support (~> 3.9.0)
|
47
|
+
rspec-expectations (3.9.0)
|
48
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.9.0)
|
50
|
+
rspec-mocks (3.9.0)
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-support (3.
|
52
|
+
rspec-support (~> 3.9.0)
|
53
|
+
rspec-support (3.9.0)
|
54
54
|
shellany (0.0.1)
|
55
|
-
thor (0.
|
55
|
+
thor (1.0.1)
|
56
56
|
|
57
57
|
PLATFORMS
|
58
58
|
ruby
|
@@ -64,4 +64,4 @@ DEPENDENCIES
|
|
64
64
|
rspec (~> 3.0)
|
65
65
|
|
66
66
|
BUNDLED WITH
|
67
|
-
2.
|
67
|
+
2.1.1
|
data/lib/guard/webpacker.rb
CHANGED
@@ -5,19 +5,27 @@ require 'timeout'
|
|
5
5
|
|
6
6
|
module Guard
|
7
7
|
class WebPacker < Plugin
|
8
|
-
|
8
|
+
DEFAULT_PATH = 'bin'
|
9
|
+
WEBPACK_DEV_SERVER = 'webpack-dev-server'
|
10
|
+
WEBPACK = 'webpack'
|
9
11
|
DEFAULT_SIGNAL = :TERM
|
10
12
|
|
11
13
|
def initialize(options = {})
|
14
|
+
super
|
15
|
+
|
12
16
|
@pid = nil
|
13
|
-
@
|
17
|
+
@path = options[:path] || DEFAULT_PATH
|
18
|
+
@bin = options[:bin] || WEBPACK_DEV_SERVER
|
14
19
|
@stop_signal = options[:stop_signal] || DEFAULT_SIGNAL
|
15
|
-
super
|
16
20
|
end
|
17
21
|
|
18
22
|
def start
|
19
|
-
|
20
|
-
|
23
|
+
unless File.exist?(File.join(@path, @bin))
|
24
|
+
Guard::Compat::UI.info "[Guard::WebPacker::Error] Could not find #{@bin} at #{@path}."
|
25
|
+
return false
|
26
|
+
end
|
27
|
+
|
28
|
+
Guard::Compat::UI.info "[Guard::WebPacker] Starting up #{@bin} ..."
|
21
29
|
Guard::Compat::UI.info cmd
|
22
30
|
|
23
31
|
# launch webpack-dev-server or webpack
|
@@ -27,23 +35,24 @@ module Guard
|
|
27
35
|
def stop
|
28
36
|
return unless @pid
|
29
37
|
|
30
|
-
Guard::Compat::UI.info "Stopping #{@bin} ..."
|
38
|
+
Guard::Compat::UI.info "[Guard::WebPacker] Stopping #{@bin} ..."
|
31
39
|
::Process.kill @stop_signal, @pid
|
32
40
|
begin
|
33
41
|
Timeout.timeout(15) do
|
34
42
|
::Process.wait @pid
|
35
43
|
end
|
36
44
|
rescue Timeout::Error
|
37
|
-
Guard::Compat::UI.info "Sending SIGKILL to #{@bin}, as it\'s taking too long to shutdown."
|
45
|
+
Guard::Compat::UI.info "[Guard::WebPacker] Sending SIGKILL to #{@bin}, as it\'s taking too long to shutdown."
|
38
46
|
::Process.kill :KILL, @pid
|
39
47
|
::Process.wait @pid
|
40
48
|
end
|
41
|
-
|
49
|
+
@pid = nil
|
50
|
+
Guard::Compat::UI.info "[Guard::WebPacker] Stopped process #{@bin} ..."
|
42
51
|
end
|
43
52
|
|
44
53
|
# Called on Ctrl-Z signal
|
45
54
|
def reload
|
46
|
-
Guard::Compat::UI.info "Restarting #{@bin} ..."
|
55
|
+
Guard::Compat::UI.info "[Guard::WebPacker] Restarting #{@bin} ..."
|
47
56
|
restart
|
48
57
|
end
|
49
58
|
|
@@ -65,12 +74,14 @@ module Guard
|
|
65
74
|
private
|
66
75
|
|
67
76
|
def cmd
|
68
|
-
command = ["bundle exec
|
77
|
+
command = ["bundle exec #{@path}/#{@bin}"]
|
69
78
|
|
70
|
-
if @bin
|
71
|
-
command << '--watch'
|
72
|
-
command << '--colors'
|
73
|
-
command << '--progress'
|
79
|
+
if @bin == WEBPACK
|
80
|
+
command << '--watch' if @options[:watch]
|
81
|
+
command << '--colors' if @options[:colors]
|
82
|
+
command << '--progress' if @options[:progress]
|
83
|
+
command << '--progress' if @options[:progress]
|
84
|
+
command << "--mode #{@options[:mode]}" if @options[:mode]
|
74
85
|
end
|
75
86
|
|
76
87
|
command.join(' ')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-webpacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icyleaf
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|