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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6438ed8e32a0a10561779433f83cea7758ed2ef0
4
- data.tar.gz: 1ea38925e9e93dc623635aaaad26b49b56b27cf1
3
+ metadata.gz: f18f1b3a3f33bac0a055ad2a6e14885f885cda56
4
+ data.tar.gz: 7b283d577b638ecc9d5e7bce5323087b9debd7ec
5
5
  SHA512:
6
- metadata.gz: 28cc6523b28af8b55e7dfe0c35abd22ac54319e8e7716fd80395a15f67ae5e992bb8769d8b025802aab63858dc3b8a94e652e08eb581f2a96f86bba5ecaddb49
7
- data.tar.gz: 8db556e9c7a62182be2d1e042bd4311a1a554aa7db1f80ba7e123b61a78b09512b153ed5ed8c657e25161d1e82001b0315b7fb8c9efb10490137b995dd9b43ec
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
- See [LiveReload configuration doc](https://github.com/mockko/livereload/blob/master/README-old.md) from version 1.x for more info about those options.
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
- UI.info "Reloading browser: #{paths.join(' ')}"
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)
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module LiveReloadVersion
3
- VERSION = '2.2.0'
3
+ VERSION = '2.3.0'
4
4
  end
5
5
  end
@@ -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.stub(:info) }
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).with("Reloading browser: stylesheets/layout.css stylesheets/style.css")
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 be_true
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 be_false
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 be_false
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 be_true
53
+ expect(plugin.options[:override_url]).to be_truthy
54
54
  end
55
55
  end
56
56
 
@@ -6,7 +6,7 @@ require 'guard/livereload'
6
6
  ENV["GUARD_ENV"] = 'test'
7
7
 
8
8
  RSpec.configure do |config|
9
- config.color_enabled = true
9
+ config.color = true
10
10
  config.filter_run focus: true
11
11
  config.run_all_when_everything_filtered = true
12
12
  end
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.2.0
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-05-22 00:00:00.000000000 Z
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.2.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: