guard-livereload 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +7 -8
- data/lib/guard/livereload.rb +10 -10
- data/lib/guard/livereload/reactor.rb +10 -10
- data/lib/guard/livereload/templates/Guardfile +4 -4
- data/lib/guard/livereload/version.rb +1 -1
- metadata +10 -10
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -22,8 +22,7 @@ Install {LiveReload Safari/Chrome extension}[http://github.com/mockko/livereload
|
|
22
22
|
|
23
23
|
== Usage
|
24
24
|
|
25
|
-
Please read {Guard usage doc}[http://github.com/guard/guard#readme]
|
26
|
-
and {LiveReload extension usage doc}[http://github.com/mockko/livereload#readme]
|
25
|
+
Please read {Guard usage doc}[http://github.com/guard/guard#readme] and {LiveReload extension usage doc}[http://github.com/mockko/livereload#readme]
|
27
26
|
|
28
27
|
== Guardfile
|
29
28
|
|
@@ -31,23 +30,23 @@ You can adapt your 'view' files like you want.
|
|
31
30
|
Please read {Guard doc}[http://github.com/guard/guard#readme] for more info about Guardfile DSL.
|
32
31
|
|
33
32
|
guard 'livereload' do
|
34
|
-
watch(
|
35
|
-
watch(
|
36
|
-
watch(
|
37
|
-
watch(
|
33
|
+
watch(%r{app/.+\.(erb|haml)})
|
34
|
+
watch(%r{app/helpers/.+\.rb})
|
35
|
+
watch(%r{public/.+\.(css|js|html)})
|
36
|
+
watch(%r{config/locales/.+\.yml})
|
38
37
|
end
|
39
38
|
|
40
39
|
== Options
|
41
40
|
|
42
41
|
LiveReload guard have 5 options that you can set like this:
|
43
42
|
|
44
|
-
guard 'livereload', :api_version => '1.
|
43
|
+
guard 'livereload', :api_version => '1.4', :port => '35728' do
|
45
44
|
...
|
46
45
|
end
|
47
46
|
|
48
47
|
Available options:
|
49
48
|
|
50
|
-
:api_version => '1.
|
49
|
+
:api_version => '1.4' # default '1.5'
|
51
50
|
:host => '127.3.3.1' # default '0.0.0.0'
|
52
51
|
:port => '12345' # default '35729'
|
53
52
|
:apply_js_live => false # default true
|
data/lib/guard/livereload.rb
CHANGED
@@ -3,37 +3,37 @@ require 'guard/guard'
|
|
3
3
|
|
4
4
|
module Guard
|
5
5
|
class LiveReload < Guard
|
6
|
-
|
6
|
+
|
7
7
|
autoload :Reactor, 'guard/livereload/reactor'
|
8
|
-
|
8
|
+
|
9
9
|
attr_accessor :reactor
|
10
|
-
|
10
|
+
|
11
11
|
# =================
|
12
12
|
# = Guard methods =
|
13
13
|
# =================
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(watchers = [], options = {})
|
16
16
|
super
|
17
17
|
@options = {
|
18
|
-
:api_version => '1.
|
18
|
+
:api_version => '1.5',
|
19
19
|
:host => '0.0.0.0',
|
20
20
|
:port => '35729',
|
21
21
|
:apply_js_live => true,
|
22
22
|
:apply_css_live => true
|
23
23
|
}.update(options)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def start
|
27
27
|
@reactor = Reactor.new(@options)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
def stop
|
31
31
|
reactor.stop
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def run_on_change(paths)
|
35
35
|
reactor.reload_browser(paths)
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
@@ -4,19 +4,19 @@ require 'json'
|
|
4
4
|
module Guard
|
5
5
|
class LiveReload
|
6
6
|
class Reactor
|
7
|
-
|
7
|
+
|
8
8
|
attr_reader :thread, :web_sockets
|
9
|
-
|
9
|
+
|
10
10
|
def initialize(options)
|
11
11
|
@web_sockets = []
|
12
12
|
@options = options
|
13
13
|
@thread = start_threaded_reactor(options)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def stop
|
17
17
|
thread.kill
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def reload_browser(paths = [])
|
21
21
|
UI.info "Reloading browser: #{paths.join(' ')}"
|
22
22
|
paths.each do |path|
|
@@ -29,9 +29,9 @@ module Guard
|
|
29
29
|
@web_sockets.each { |ws| ws.send(data) }
|
30
30
|
end
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
private
|
34
|
-
|
34
|
+
|
35
35
|
def start_threaded_reactor(options)
|
36
36
|
Thread.new do
|
37
37
|
EventMachine.run do
|
@@ -47,11 +47,11 @@ module Guard
|
|
47
47
|
UI.errror $!.backtrace
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
ws.onmessage do |msg|
|
52
52
|
UI.info "Browser URL: #{msg}"
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
ws.onclose do
|
56
56
|
@web_sockets.delete ws
|
57
57
|
UI.info "Browser disconnected."
|
@@ -60,7 +60,7 @@ module Guard
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
end
|
65
65
|
end
|
66
|
-
end
|
66
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
guard 'livereload' do
|
2
|
-
watch(%r{app/.+\.(erb|haml)
|
3
|
-
watch(%r{app/helpers/.+\.rb
|
4
|
-
watch(%r{public/.+\.(css|js|html)
|
5
|
-
watch(%r{config/locales/.+\.yml
|
2
|
+
watch(%r{app/.+\.(erb|haml)})
|
3
|
+
watch(%r{app/helpers/.+\.rb})
|
4
|
+
watch(%r{public/.+\.(css|js|html)})
|
5
|
+
watch(%r{config/locales/.+\.yml})
|
6
6
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-livereload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Thibaud Guillaume-Gentil
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-02-10 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -74,12 +74,12 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
hash:
|
77
|
+
hash: 3
|
78
78
|
segments:
|
79
79
|
- 1
|
80
80
|
- 0
|
81
|
-
-
|
82
|
-
version: 1.0.
|
81
|
+
- 10
|
82
|
+
version: 1.0.10
|
83
83
|
type: :development
|
84
84
|
version_requirements: *id004
|
85
85
|
- !ruby/object:Gem::Dependency
|
@@ -106,12 +106,12 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
109
|
+
hash: 27
|
110
110
|
segments:
|
111
111
|
- 2
|
112
|
-
-
|
112
|
+
- 5
|
113
113
|
- 0
|
114
|
-
version: 2.
|
114
|
+
version: 2.5.0
|
115
115
|
type: :development
|
116
116
|
version_requirements: *id006
|
117
117
|
description: Guard::LiveReload automatically reload your browser when 'view' files are modified.
|