guard-livereload 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/guard/livereload/reactor.rb +6 -1
- data/lib/guard/livereload/version.rb +1 -1
- data/spec/lib/guard/livereload/reactor_spec.rb +14 -2
- data/spec/lib/guard/livereload_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f18f1b3a3f33bac0a055ad2a6e14885f885cda56
|
4
|
+
data.tar.gz: 7b283d577b638ecc9d5e7bce5323087b9debd7ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfd1b0f747c5fb7dab78d1edbc1758af5636f7631b033cb55714b6a5f72eba218b6069026ef05d7d727cfba6799fed42343da97516a1ade580f6050e81007c39
|
7
|
+
data.tar.gz: 13ec1be5c9c976de0ded980c62fc723fac3ad3a93b74944237e05ea1fb9184ea497ab9395f9704d26eea6a0a33bffed5b8a77a96ca91d4f4c48b364efe779d73
|
data/README.md
CHANGED
@@ -67,6 +67,7 @@ end
|
|
67
67
|
Available options:
|
68
68
|
|
69
69
|
``` ruby
|
70
|
+
notify: true # default false
|
70
71
|
host: '127.3.3.1' # default '0.0.0.0'
|
71
72
|
port: '12345' # default '35729'
|
72
73
|
apply_css_live: false # default true
|
@@ -74,7 +75,8 @@ override_url: false # default false
|
|
74
75
|
grace_period: 0.5 # default 0 (seconds)
|
75
76
|
```
|
76
77
|
|
77
|
-
|
78
|
+
`notify` uses Guard's [system notifications](https://github.com/guard/guard/wiki/System-notifications).
|
79
|
+
See [LiveReload configuration doc](https://github.com/mockko/livereload/blob/master/README-old.md) from version 1.x for more info about other options.
|
78
80
|
|
79
81
|
## Development
|
80
82
|
|
@@ -17,7 +17,12 @@ module Guard
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def reload_browser(paths = [])
|
20
|
-
|
20
|
+
msg = "Reloading browser: #{paths.join(' ')}"
|
21
|
+
UI.info msg
|
22
|
+
if options[:notify]
|
23
|
+
Notifier.notify(msg, title: 'Reloading browser', image: :success)
|
24
|
+
end
|
25
|
+
|
21
26
|
paths.each do |path|
|
22
27
|
data = _data(path)
|
23
28
|
UI.debug(data)
|
@@ -2,14 +2,26 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Guard::LiveReload::Reactor do
|
4
4
|
let(:paths) { %w[stylesheets/layout.css stylesheets/style.css] }
|
5
|
-
before { Guard::UI.
|
5
|
+
before { allow(Guard::UI).to receive(:info) }
|
6
6
|
|
7
7
|
describe "#reload_browser(paths = [])" do
|
8
8
|
it "displays a message" do
|
9
|
-
expect(Guard::UI).to receive(:info).
|
9
|
+
expect(Guard::UI).to receive(:info).
|
10
|
+
with('Reloading browser: stylesheets/layout.css stylesheets/style.css')
|
10
11
|
new_live_reactor.reload_browser(paths)
|
11
12
|
end
|
12
13
|
|
14
|
+
it 'by default does not send notification' do
|
15
|
+
expect(::Guard::Notifier).to_not receive(:notify)
|
16
|
+
new_live_reactor.reload_browser(paths)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'optionally pushes notification' do
|
20
|
+
expect(::Guard::Notifier).to receive(:notify).
|
21
|
+
with(kind_of(String), have_key(:title))
|
22
|
+
new_live_reactor(notify: true).reload_browser(paths)
|
23
|
+
end
|
24
|
+
|
13
25
|
it "each web socket receives send with data containing default options for each path modified" do
|
14
26
|
reactor = new_live_reactor
|
15
27
|
paths.each do |path|
|
@@ -33,24 +33,24 @@ describe Guard::LiveReload do
|
|
33
33
|
describe ":apply_css_live option" do
|
34
34
|
it "is true by default" do
|
35
35
|
plugin = Guard::LiveReload.new
|
36
|
-
expect(plugin.options[:apply_css_live]).to
|
36
|
+
expect(plugin.options[:apply_css_live]).to be_truthy
|
37
37
|
end
|
38
38
|
|
39
39
|
it "can be set to false" do
|
40
40
|
plugin = Guard::LiveReload.new(apply_css_live: false)
|
41
|
-
expect(plugin.options[:apply_css_live]).to
|
41
|
+
expect(plugin.options[:apply_css_live]).to be_falsey
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe ":override_url option" do
|
46
46
|
it "is false by default" do
|
47
47
|
plugin = Guard::LiveReload.new
|
48
|
-
expect(plugin.options[:override_url]).to
|
48
|
+
expect(plugin.options[:override_url]).to be_falsey
|
49
49
|
end
|
50
50
|
|
51
51
|
it "can be set to false" do
|
52
52
|
plugin = Guard::LiveReload.new(override_url: true)
|
53
|
-
expect(plugin.options[:override_url]).to
|
53
|
+
expect(plugin.options[:override_url]).to be_truthy
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-livereload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaud Guillaume-Gentil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
140
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.3.0
|
142
142
|
signing_key:
|
143
143
|
specification_version: 4
|
144
144
|
summary: Guard plugin for livereload
|
@@ -146,3 +146,4 @@ test_files:
|
|
146
146
|
- spec/lib/guard/livereload/reactor_spec.rb
|
147
147
|
- spec/lib/guard/livereload_spec.rb
|
148
148
|
- spec/spec_helper.rb
|
149
|
+
has_rdoc:
|