middleman-livereload 3.2.1 → 3.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: d2d7f2b2d80a0bd438ad35d13181634ca78a1c3c
4
- data.tar.gz: 5288c9a6786e10676266cdaf5b200531faa6b805
3
+ metadata.gz: cbd5aa0303f27dae24aae66a4265112a9966f7d9
4
+ data.tar.gz: 48e425f51c4689cbd8c261ed71374196fec5d16d
5
5
  SHA512:
6
- metadata.gz: 58b1015a0b4f213d216aa4cbc4b3eb9cd4891d37e73df780de3bfbfbc2ffa722d5c1de84bf43ef275f63a1102afd35ac5df04243f0d2429b397e98c0e6ba5230
7
- data.tar.gz: cc60944983102e433c1068996e82db87bbc47107603d326a3b86ef7054c43ecb7124d1be37229172d92a20be94a22ea4bb6c5be3f7c95b8cf1d0d84a7eab40a6
6
+ metadata.gz: 1c4d9d0aec8d00cc9e8a1ae45449cfd234dabab32872bdefd416d96c3678542d2b6c2e407fd5403ecc3d6b6a7658720405568993cb14c663efcf98f4285854a4
7
+ data.tar.gz: 55c2201e8ae54496d9daa663d5fe74f1255d59e371fd47b48920bbbfb794c2a0618c1ddc8bb897212a8b649e33828003c7b8e8d6e4023a291bc411a71ad620ec
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ 3.3.0
2
+ ===
3
+
4
+ * Explicitly use the vendored livereload.js - otherwise it will attempt to load it from a location that doesn't exist.
5
+ * Remove `:grace_period` setting, which was unnecessary.
6
+ * Properly ignore changes to files that should not cause a reload, and pay attention to some files that used to be ignored but shouldn't have been.
7
+ * Send logging to the logger rather than STDOUT.
8
+ * No longer rely on MultiJson.
9
+ * Require Ruby 1.9.3 or greater.
10
+
11
+ 3.2.1
12
+ ===
13
+
14
+ * Loosen dependency on `middleman-core`.
15
+
16
+ 3.2.0
17
+ ===
18
+
19
+ * Only run in `:development` environment.
20
+ * No longer compatible with Middleman < 3.2
21
+
22
+ 3.1.1
23
+ ===
24
+
25
+ * Added `:no_swf` option to disable Flash websockets polyfill.
26
+
27
+ 3.1.0
28
+ ===
29
+
30
+ * Compatibility with Middleman 3.1+ style extension API.
31
+ * Ignore ignored sitemap files.
32
+ * Preserve the reactor thread across preview server reloads.
33
+ * Implement a `:grace_period` setting.
data/README.md CHANGED
@@ -13,7 +13,7 @@ middleman init MY_PROJECT
13
13
 
14
14
  If you already have a Middleman project: Add `gem "middleman-livereload", "~> 3.1.0"` to your `Gemfile` and run `bundle install`
15
15
 
16
- ####Windows users:
16
+ #### Windows users:
17
17
  You currently need to add `gem "em-websocket", github: "igrigorik/em-websocket"` to your `Gemfile` and run `bundle install`
18
18
  Also be sure to specify the correct hostname `activate :livereload, :host => 'localhost'`
19
19
 
@@ -26,13 +26,9 @@ activate :livereload
26
26
  The extension supports a number of options that can be given to the `activate` statement. Eg:
27
27
 
28
28
  ```
29
- activate :livereload, :apply_js_live => false, :grace_period => 0.5
29
+ activate :livereload, :apply_js_live => false
30
30
  ```
31
31
 
32
- #### `:api_version`
33
-
34
- Livereload API version, default `'1.6'`.
35
-
36
32
  #### `:host` and `:port`
37
33
 
38
34
  Livereload's listener host/port, these options get passed to ::Rack::LiveReload middleware. Defaults:`'0.0.0.0'` and `'35729'`.
@@ -41,10 +37,6 @@ Livereload's listener host/port, these options get passed to ::Rack::LiveReload
41
37
 
42
38
  Whether live reload should attempt to reload javascript / css 'in-place', without complete reload of the page. Both default to `true`.
43
39
 
44
- #### `:grace_period`
45
-
46
- A delay middleman-livereload should wait before reacting on file change / deletion notification (sec). Default is 0.
47
-
48
40
  #### `:no_swf`
49
41
 
50
42
  Disable Flash polyfil for browsers that support native WebSockets.
@@ -7,17 +7,15 @@ module Middleman
7
7
  option :port, '35729', 'Port to bind the LiveReload API server to'
8
8
  option :apply_js_live, true, 'Apply JS changes live, without reloading'
9
9
  option :apply_css_live, true, 'Apply CSS changes live, without reloading'
10
- option :grace_period, 0, 'Time (in seconds) to wait before reloading'
11
10
  option :no_swf, false, 'Disable Flash WebSocket polyfill for browsers that support native WebSockets'
12
11
 
13
12
  def initialize(app, options_hash={}, &block)
14
13
  super
15
14
 
16
- return if app.environment != :development
15
+ return unless app.environment == :development
17
16
 
18
17
  @reactor = nil
19
18
 
20
- grace_period = options.grace_period
21
19
  port = options.port.to_i
22
20
  host = options.host
23
21
  no_swf = options.no_swf
@@ -31,33 +29,34 @@ module Middleman
31
29
  end
32
30
 
33
31
  files.changed do |file|
34
- next if ignore_manager.ignored?(file)
32
+ next if files.send(:ignored?, file)
35
33
 
36
- sleep(grace_period) if grace_period > 0
37
- sitemap.ensure_resource_list_updated!
38
- puts "Changed! #{file}"
34
+ logger.debug "LiveReload: File changed - #{file}"
39
35
 
40
- begin
41
- file_url = sitemap.file_to_path(file)
36
+ reload_path = "#{Dir.pwd}/#{file}"
37
+
38
+ file_url = sitemap.file_to_path(file)
39
+ if file_url
42
40
  file_resource = sitemap.find_resource_by_path(file_url)
43
- reload_path = file_resource.destination_path
44
- rescue
45
- reload_path = "#{Dir.pwd}/#{file}"
41
+ if file_resource
42
+ reload_path = file_resource.url
43
+ end
46
44
  end
45
+
47
46
  @reactor.reload_browser(reload_path)
48
47
  end
49
48
 
50
49
  files.deleted do |file|
51
- next if ignore_manager.ignored?(file)
50
+ next if files.send(:ignored?, file)
52
51
 
53
- sleep(grace_period) if grace_period > 0
54
- sitemap.ensure_resource_list_updated!
55
- puts "Deleted! #{file}"
52
+ logger.debug "LiveReload: File deleted - #{file}"
56
53
 
57
54
  @reactor.reload_browser("#{Dir.pwd}/#{file}")
58
55
  end
59
56
 
60
- use ::Rack::LiveReload, :port => port, :host => host, :no_swf => no_swf
57
+ # Use the vendored livereload.js source rather than trying to get it from Middleman
58
+ # https://github.com/johnbintz/rack-livereload#which-livereload-script-does-it-use
59
+ use ::Rack::LiveReload, :port => port, :host => host, :no_swf => no_swf, :source => :vendored
61
60
  end
62
61
  end
63
62
  end
@@ -1,5 +1,5 @@
1
1
  require 'em-websocket'
2
- require 'multi_json'
2
+ require 'json'
3
3
 
4
4
  module Middleman
5
5
  module LiveReload
@@ -29,7 +29,7 @@ module Middleman
29
29
  paths = Array(paths)
30
30
  logger.info "== LiveReloading path: #{paths.join(' ')}"
31
31
  paths.each do |path|
32
- data = MultiJson.encode(['refresh', {
32
+ data = JSON.dump(['refresh', {
33
33
  :path => path,
34
34
  :apply_js_live => @options[:apply_js_live],
35
35
  :apply_css_live => @options[:apply_css_live]
@@ -50,8 +50,8 @@ module Middleman
50
50
  @web_sockets << ws
51
51
  logger.debug "== LiveReload browser connected"
52
52
  rescue
53
- $stderr.puts $!
54
- $stderr.puts $!.backtrace
53
+ logger.error $!
54
+ logger.error $!.backtrace
55
55
  end
56
56
  end
57
57
 
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module LiveReload
3
- VERSION = "3.2.1"
3
+ VERSION = "3.3.0"
4
4
  end
5
5
  end
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
15
15
  s.files = `git ls-files -z`.split("\0")
16
16
  s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
17
17
  s.require_paths = ["lib"]
18
+ s.required_ruby_version = '>= 1.9.3'
18
19
  s.add_dependency("middleman-core", ["~> 3.2"])
19
20
  s.add_runtime_dependency('rack-livereload', ['~> 0.3.15'])
20
21
  s.add_runtime_dependency('em-websocket', ['~> 0.5.0'])
21
- s.add_runtime_dependency('multi_json', ['~> 1.8.4'])
22
- end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-livereload
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-19 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.5.0
55
- - !ruby/object:Gem::Dependency
56
- name: multi_json
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 1.8.4
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: 1.8.4
69
55
  description: LiveReload support for Middleman
70
56
  email:
71
57
  - me@tdreyno.com
@@ -75,6 +61,7 @@ extra_rdoc_files: []
75
61
  files:
76
62
  - .gitignore
77
63
  - .travis.yml
64
+ - CHANGELOG.md
78
65
  - CONTRIBUTING.md
79
66
  - Gemfile
80
67
  - LICENSE.md
@@ -100,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
87
  requirements:
101
88
  - - '>='
102
89
  - !ruby/object:Gem::Version
103
- version: '0'
90
+ version: 1.9.3
104
91
  required_rubygems_version: !ruby/object:Gem::Requirement
105
92
  requirements:
106
93
  - - '>='