guard-livereload 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e1d2815739a1f3bbcd31bcaa273893e6c32c9ba
4
- data.tar.gz: b64014a6028313c3850228fa8cef84181828f760
3
+ metadata.gz: fabaf75aeae2ecb4184d5251770fcee69d4e27ee
4
+ data.tar.gz: 08ba0d686bd0bdbbd0713451b880da7dcd62810f
5
5
  SHA512:
6
- metadata.gz: 1eb3bef68fe9ba23dce70e05d8899e3a127407cd1836719f947fb257cba9bc819a7895331d926200bb1a471edce6ceb12b2268dee2e541a6ced52fbdc2b54492
7
- data.tar.gz: 198e67d389876a59fe9c41514cdbfdfae2938c03cf760dc4739345e07016c23ef08b5d927ae8e2e84af8002492f9b0cc9f9f99ffbe03327d0e15d3fcc8ec784f
6
+ metadata.gz: 1b552f47f4cfa00dab1a52406b96245eb4e8823bb8cacbeda25b7b4721b3f1ace6b6cebac6e14892a6e4d5b4d732e6e409396925b332677436dfb5d5eadc1fe7
7
+ data.tar.gz: e2ad5529164eb782a3084211a85e00c590cadc7bfa9b14a97040cf2ad7f3e34854e329817a8e9c217c27a1c009ef9ca786df09fbef02235e34609021c0365b3f
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module LiveReloadVersion
3
- VERSION = "2.1.2"
3
+ VERSION = '2.1.3'
4
4
  end
5
5
  end
@@ -10,13 +10,14 @@ module Guard
10
10
  def dispatch(data)
11
11
  parser = Http::Parser.new
12
12
  parser << data
13
- request_path = URI.parse(parser.request_url).path
13
+ # prepend with '.' to make request url usable as a file path
14
+ request_path = '.' + URI.parse(parser.request_url).path
14
15
  if parser.http_method != 'GET' || parser.upgrade?
15
16
  super #pass the request to websocket
16
- elsif request_path == '/livereload.js'
17
+ elsif request_path == './livereload.js'
17
18
  _serve_file(_livereload_js_file)
18
- elsif File.exist?(request_path[1..-1])
19
- _serve_file(request_path[1..-1]) # Strip leading slash
19
+ elsif File.readable?(request_path) && !File.directory?(request_path)
20
+ _serve_file(request_path)
20
21
  else
21
22
  send_data("HTTP/1.1 404 Not Found\r\nContent-Type: text/plain\r\nContent-Length: 13\r\n\r\n404 Not Found")
22
23
  close_connection_after_writing
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.1.2
4
+ version: 2.1.3
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-03-20 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard