middleman-livereload 3.4.6 → 3.5.0
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 +5 -5
- data/.github/workflows/ci.yml +25 -0
- data/CHANGELOG.md +79 -23
- data/Gemfile +6 -8
- data/README.md +27 -30
- data/Rakefile +5 -16
- data/lib/middleman-livereload/{extension_3_1.rb → extension.rb} +18 -15
- data/lib/middleman-livereload/reactor.rb +14 -2
- data/lib/middleman-livereload/version.rb +1 -1
- data/lib/middleman-livereload/wss.rb +42 -0
- data/lib/middleman-livereload.rb +1 -1
- data/middleman-livereload.gemspec +6 -9
- data/spec/middleman-livereload/wss_spec.rb +77 -0
- data/spec/spec_helper.rb +6 -0
- metadata +15 -18
- data/.travis.yml +0 -15
- data/features/.gitkeep +0 -0
- data/fixtures/.gitkeep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 93fd6db7ae7294c5d3fbd3c07810d27bcf23702409f87c0faadb685c0a30ce74
|
4
|
+
data.tar.gz: ed0a3654767bf3a960c6e35a8ba527e2bc720ab0073f79badda023337dbd87a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc24dcaeb59264ec9912520015ed612a1af8b1b1a4be851b5adad4714920485256914822e287d8ce3745f4e9bea112cc9247026823e027664f1d1f44f5f96198
|
7
|
+
data.tar.gz: 9e469b3f0a16cc99a26f464c4cf460b5ec39c136b07d7364daaa61aef4c7e433062576093541506b6fc9e2d63c9e9fea0d7683563baaa9e8493aa94927617042
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: ubuntu-ruby-${{ matrix.ruby-version }}
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby-version: ["3.3", "3.2", "3.1", "3.0", "2.7"]
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Runs tests
|
25
|
+
run: bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,33 +1,89 @@
|
|
1
|
-
|
2
|
-
===
|
1
|
+
# Changelog
|
3
2
|
|
4
|
-
|
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.
|
3
|
+
All notable changes to this project will be documented in this file.
|
10
4
|
|
11
|
-
3.
|
12
|
-
===
|
5
|
+
## 3.5.0
|
13
6
|
|
14
|
-
*
|
7
|
+
* Upgade `rack-livereload` gem
|
8
|
+
* Migrate to GitHub Actions
|
9
|
+
* Match supported Ruby versions with MM ecosystem
|
15
10
|
|
16
|
-
3.
|
17
|
-
===
|
11
|
+
## 3.4.7
|
18
12
|
|
19
|
-
*
|
13
|
+
* Support secure sockets (WSS) with options for TLS certificate & private key
|
14
|
+
* Fix crash when reloading `config.rb`
|
15
|
+
* Fix ignore files specificed in `:ignore` config
|
16
|
+
|
17
|
+
## 3.4.6
|
18
|
+
|
19
|
+
* Fix `Thread.exclusive` deprecation in older Rubies
|
20
|
+
|
21
|
+
## 3.4.5
|
22
|
+
|
23
|
+
* Fix pathname bug
|
24
|
+
|
25
|
+
## 3.4.4
|
26
|
+
|
27
|
+
* Add `:js_host` and `:js_port` options
|
28
|
+
* Fix CSS live reloading when @imported partials change
|
29
|
+
|
30
|
+
## 3.4.3
|
31
|
+
|
32
|
+
* Add `:ignore` option
|
33
|
+
|
34
|
+
## 3.4.2
|
35
|
+
|
36
|
+
* Safety check
|
37
|
+
|
38
|
+
## 3.4.1
|
39
|
+
|
40
|
+
* Tweak extension initialization
|
41
|
+
|
42
|
+
## 3.4.0
|
43
|
+
|
44
|
+
* Require new `middleman-core` gem
|
45
|
+
|
46
|
+
## 3.3.4
|
47
|
+
|
48
|
+
* Fall back to localhost if there's no private IP
|
49
|
+
|
50
|
+
## 3.3.3
|
51
|
+
|
52
|
+
* Upgrade `em-websocket` gem
|
53
|
+
|
54
|
+
## 3.3.2
|
55
|
+
|
56
|
+
* Add other authors in gemspec
|
57
|
+
|
58
|
+
## 3.3.1
|
59
|
+
|
60
|
+
* Default host is now autodetected
|
61
|
+
|
62
|
+
## 3.3.0
|
63
|
+
|
64
|
+
* Explicitly use the vendored livereload.js - otherwise it will attempt to load it from a location that doesn't exist
|
65
|
+
* Remove `:grace_period` setting, which was unnecessary
|
66
|
+
* 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
|
67
|
+
* Send logging to the logger rather than STDOUT
|
68
|
+
* No longer rely on MultiJson
|
69
|
+
* Require Ruby 1.9.3 or greater
|
70
|
+
|
71
|
+
## 3.2.1
|
72
|
+
|
73
|
+
* Loosen dependency on `middleman-core`
|
74
|
+
|
75
|
+
## 3.2.0
|
76
|
+
|
77
|
+
* Only run in `:development` environment
|
20
78
|
* No longer compatible with Middleman < 3.2
|
21
79
|
|
22
|
-
3.1.1
|
23
|
-
===
|
80
|
+
## 3.1.1
|
24
81
|
|
25
|
-
* Added `:no_swf` option to disable Flash websockets polyfill
|
82
|
+
* Added `:no_swf` option to disable Flash websockets polyfill
|
26
83
|
|
27
|
-
3.1.0
|
28
|
-
===
|
84
|
+
## 3.1.0
|
29
85
|
|
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
|
86
|
+
* Compatibility with Middleman 3.1+ style extension API
|
87
|
+
* Ignore ignored sitemap files
|
88
|
+
* Preserve the reactor thread across preview server reloads
|
89
|
+
* Implement a `:grace_period` setting
|
data/Gemfile
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gem "middleman", github: "middleman/middleman"
|
3
|
+
gem "middleman", github: "middleman/middleman"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in middleman-blog.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
9
|
-
gem
|
10
|
-
gem
|
8
|
+
# Build and doc tools
|
9
|
+
gem 'rake', '~> 13.1', require: false
|
10
|
+
gem 'yard', '~> 0.9', require: false
|
11
11
|
|
12
|
-
|
13
|
-
gem '
|
14
|
-
gem 'aruba', '~> 0.5.1'
|
15
|
-
gem 'rspec', '~> 2.12'
|
12
|
+
# Test tools
|
13
|
+
gem 'rspec', '~> 3'
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Middleman-Livereload
|
2
2
|
|
3
|
-
middleman-livereload
|
3
|
+
[](https://rubygems.org/gems/middleman-livereload)
|
4
|
+
[](https://github.com/middleman/middleman-livereload/actions/workflows/ci.yml)
|
5
|
+
[](https://qlty.sh/gh/middleman/projects/middleman-livereload)
|
6
|
+
|
7
|
+
`middleman-livereload` is an extension for the [Middleman](https://middlemanapp.com) static site generator that adds livereloading functionality.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -11,7 +15,7 @@ gem install middleman
|
|
11
15
|
middleman init MY_PROJECT
|
12
16
|
```
|
13
17
|
|
14
|
-
If you already have a Middleman project
|
18
|
+
If you already have a Middleman project, add the `gem "middleman-blog"` line to your `Gemfile` and then run `bundle install`.
|
15
19
|
|
16
20
|
## Configuration
|
17
21
|
|
@@ -25,48 +29,47 @@ The extension supports a number of options that can be given to the `activate` s
|
|
25
29
|
activate :livereload, apply_js_live: false
|
26
30
|
```
|
27
31
|
|
28
|
-
|
32
|
+
- `:host` and `:port`
|
29
33
|
|
30
34
|
Livereload's listener host/port, these options get passed to ::Rack::LiveReload middleware. Defaults:`'0.0.0.0'` and `'35729'`.
|
31
35
|
|
32
|
-
|
36
|
+
- `:js_host` and `:js_port`
|
33
37
|
|
34
38
|
Similar to the `:host` and `:port` options, but allow you to specify a different host and port at the frontend Javascript level than at the backend EventMachine level. Useful when running behind a proxy or on a Docker VM. Defaults to `:host` and `:port`.
|
35
39
|
|
36
|
-
|
40
|
+
- `:apply_js_live` and `:apply_css_live`
|
37
41
|
|
38
42
|
Whether live reload should attempt to reload javascript / css 'in-place', without complete reload of the page. Both default to `true`.
|
39
43
|
|
40
44
|
:warning: It does *not* work with `@import`'ed CSS files or `require`'d JS files (because of LiveReload not providing enough information regarding dependencies). On those kind of files, a full page reload will be triggered.
|
41
45
|
|
42
|
-
|
46
|
+
- `:no_swf`
|
43
47
|
|
44
48
|
Disable Flash polyfil for browsers that support native WebSockets.
|
45
49
|
|
46
|
-
|
50
|
+
- `:ignore`
|
47
51
|
|
48
52
|
Array of patterns for paths that must be ignored. These files will not be injected with the LiveReload script.
|
49
53
|
|
50
|
-
|
54
|
+
`String#match` is used for ignoring, so you can use any valid Ruby regular expression in this array.
|
55
|
+
|
56
|
+
- `:livereload_css_target`
|
51
57
|
|
52
58
|
CSS file to reload when detecting @imported partial was modified. Default `stylesheets/all.css`).
|
53
59
|
To opt out set `livereload_css_target: nil`.
|
54
60
|
|
55
|
-
|
61
|
+
- `:livereload_css_pattern`
|
56
62
|
|
57
63
|
Regexp matching filenames that should trigger reload of :livereload_css_target when changed. Default: `Regexp.new('_.*\.css')`.
|
58
64
|
|
65
|
+
- `:wss_certificate` and `:wss_private_key`
|
59
66
|
|
60
|
-
|
61
|
-
|
62
|
-
[][gem]
|
63
|
-
[][travis]
|
64
|
-
[][gemnasium]
|
65
|
-
[][codeclimate]
|
67
|
+
Support secure sockets (WSS) by passing TLS certificate & private key, for
|
68
|
+
example if you're using `middleman server --https` in development.
|
66
69
|
|
67
70
|
## Community
|
68
71
|
|
69
|
-
The official community forum is available at:
|
72
|
+
The official community forum is available at: https://forum.middlemanapp.com
|
70
73
|
|
71
74
|
## Bug Reports
|
72
75
|
|
@@ -74,24 +77,18 @@ Github Issues are used for managing bug reports and feature requests. If you run
|
|
74
77
|
|
75
78
|
The best way to get quick responses to your issues and swift fixes to your bugs is to submit detailed bug reports, include test cases and respond to developer questions in a timely manner. Even better, if you know Ruby, you can submit [Pull Requests](https://help.github.com/articles/using-pull-requests) containing Cucumber Features which describe how your feature should work or exploit the bug you are submitting.
|
76
79
|
|
77
|
-
##
|
80
|
+
## Testing
|
78
81
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
82
|
+
`bundle exec rake test`
|
83
|
+
|
84
|
+
## Creating documentation
|
85
|
+
|
86
|
+
`bundle exec rake doc`
|
83
87
|
|
84
88
|
## Donate
|
85
89
|
|
86
|
-
[Click here to lend your support to Middleman](https://
|
90
|
+
[Click here to lend your support to Middleman](https://github.com/sponsors/tdreyno)
|
87
91
|
|
88
92
|
## License
|
89
93
|
|
90
|
-
Copyright (c) 2010-
|
91
|
-
|
92
|
-
[middleman]: http://middlemanapp.com
|
93
|
-
[gem]: https://rubygems.org/gems/middleman-livereload
|
94
|
-
[travis]: http://travis-ci.org/middleman/middleman-livereload
|
95
|
-
[gemnasium]: https://gemnasium.com/middleman/middleman-livereload
|
96
|
-
[codeclimate]: https://codeclimate.com/github/middleman/middleman-livereload
|
97
|
-
[LICENSE]: https://github.com/middleman/middleman-livereload/blob/master/LICENSE.md
|
94
|
+
Copyright (c) 2010-2017 Thomas Reynolds. MIT Licensed, see [LICENSE](LICENSE.md) for details.
|
data/Rakefile
CHANGED
@@ -1,22 +1,11 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
1
|
+
require 'bundler/gem_tasks'
|
3
2
|
|
4
|
-
require '
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
-
|
7
|
-
ENV["TEST"] = "true"
|
8
|
-
|
9
|
-
exempt_tags = ""
|
10
|
-
exempt_tags << "--tags ~@nojava" if RUBY_PLATFORM == "java"
|
11
|
-
|
12
|
-
t.cucumber_opts = "--color --tags ~@wip #{exempt_tags} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'rake/clean'
|
16
|
-
|
17
|
-
task :test => ["cucumber"]
|
6
|
+
task :test => ["spec"]
|
18
7
|
|
19
8
|
desc "Build HTML documentation"
|
20
9
|
task :doc do
|
21
10
|
sh 'bundle exec yard'
|
22
|
-
end
|
11
|
+
end
|
@@ -13,6 +13,8 @@ module Middleman
|
|
13
13
|
option :js_host, nil, 'Host to connect LiveReload Javascript to (if different than :host)'
|
14
14
|
option :livereload_css_target, 'stylesheets/all.css', 'CSS file to load when a @imported CSS partials are modified'
|
15
15
|
option :livereload_css_pattern, Regexp.new('_.*\.css'), 'Regexp matching filenames that trigger live reloading target'
|
16
|
+
option :wss_certificate, nil, 'Path to an X.509 certificate to use for the websocket server'
|
17
|
+
option :wss_private_key, nil, 'Path to an RSA private key for the websocket certificate'
|
16
18
|
|
17
19
|
def initialize(app, options_hash={}, &block)
|
18
20
|
super
|
@@ -23,8 +25,6 @@ module Middleman
|
|
23
25
|
return unless app.environment == :development
|
24
26
|
end
|
25
27
|
|
26
|
-
@reactor = nil
|
27
|
-
|
28
28
|
port = options.port.to_i
|
29
29
|
host = options.host
|
30
30
|
js_port = options.js_port || port
|
@@ -35,23 +35,26 @@ module Middleman
|
|
35
35
|
livereload_css_target = options.livereload_css_target
|
36
36
|
livereload_css_pattern = options.livereload_css_pattern
|
37
37
|
|
38
|
+
extension = self
|
39
|
+
|
38
40
|
app.ready do
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
reactor = ::Middleman::LiveReload::Reactor.create(options_hash, self)
|
42
|
+
|
43
|
+
ignored = lambda do |file|
|
44
|
+
return true if app.files.respond_to?(:ignored?) && app.files.send(:ignored?, file)
|
45
|
+
ignore.any? { |i| file.to_s.match(i) }
|
43
46
|
end
|
44
47
|
|
45
|
-
files.changed do |file|
|
46
|
-
next if
|
48
|
+
app.files.changed do |file|
|
49
|
+
next if ignored.call(file)
|
47
50
|
|
48
51
|
logger.debug "LiveReload: File changed - #{file}"
|
49
52
|
|
50
53
|
reload_path = "#{Dir.pwd}/#{file}"
|
51
54
|
|
52
|
-
file_url = sitemap.file_to_path(file)
|
55
|
+
file_url = app.sitemap.file_to_path(file)
|
53
56
|
if file_url
|
54
|
-
file_resource = sitemap.find_resource_by_path(file_url)
|
57
|
+
file_resource = app.sitemap.find_resource_by_path(file_url)
|
55
58
|
if file_resource
|
56
59
|
reload_path = file_resource.url
|
57
60
|
end
|
@@ -64,20 +67,20 @@ module Middleman
|
|
64
67
|
reload_path = livereload_css_target
|
65
68
|
end
|
66
69
|
|
67
|
-
|
70
|
+
reactor.reload_browser(reload_path)
|
68
71
|
end
|
69
72
|
|
70
|
-
files.deleted do |file|
|
71
|
-
next if
|
73
|
+
app.files.deleted do |file|
|
74
|
+
next if ignored.call(file)
|
72
75
|
|
73
76
|
logger.debug "LiveReload: File deleted - #{file}"
|
74
77
|
|
75
|
-
|
78
|
+
reactor.reload_browser("#{Dir.pwd}/#{file}")
|
76
79
|
end
|
77
80
|
|
78
81
|
# Use the vendored livereload.js source rather than trying to get it from Middleman
|
79
82
|
# https://github.com/johnbintz/rack-livereload#which-livereload-script-does-it-use
|
80
|
-
use ::Rack::LiveReload, port: js_port, host: js_host, no_swf: no_swf, source: :vendored, ignore: ignore
|
83
|
+
app.use ::Rack::LiveReload, port: js_port, host: js_host, no_swf: no_swf, source: :vendored, ignore: ignore
|
81
84
|
end
|
82
85
|
end
|
83
86
|
end
|
@@ -1,11 +1,22 @@
|
|
1
1
|
require 'em-websocket'
|
2
2
|
require 'json'
|
3
|
+
require 'middleman-livereload/wss'
|
3
4
|
|
4
5
|
module Middleman
|
5
6
|
module LiveReload
|
6
7
|
class Reactor
|
7
8
|
attr_reader :thread, :web_sockets, :app
|
8
9
|
|
10
|
+
def self.create(options, app)
|
11
|
+
if @reactor
|
12
|
+
@reactor.app = app
|
13
|
+
else
|
14
|
+
@reactor = new(options, app)
|
15
|
+
end
|
16
|
+
|
17
|
+
@reactor
|
18
|
+
end
|
19
|
+
|
9
20
|
def initialize(options, app)
|
10
21
|
@app = app
|
11
22
|
@web_sockets = []
|
@@ -41,10 +52,11 @@ module Middleman
|
|
41
52
|
end
|
42
53
|
|
43
54
|
def start_threaded_reactor(options)
|
55
|
+
wss = Wss.new(@options[:wss_certificate], @options[:wss_private_key])
|
44
56
|
Thread.new do
|
45
57
|
EventMachine.run do
|
46
|
-
logger.info "== LiveReload accepting connections from
|
47
|
-
EventMachine.start_server(options[:host], options[:port], EventMachine::WebSocket::Connection,
|
58
|
+
logger.info "== LiveReload accepting connections from #{wss.scheme}://#{options[:host]}:#{options[:port]}"
|
59
|
+
EventMachine.start_server(options[:host], options[:port], EventMachine::WebSocket::Connection, wss.to_options) do |ws|
|
48
60
|
ws.onopen do
|
49
61
|
begin
|
50
62
|
ws.send "!!ver:1.6"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Middleman
|
2
|
+
module LiveReload
|
3
|
+
class Wss
|
4
|
+
def initialize(certificate, private_key)
|
5
|
+
@certificate = certificate
|
6
|
+
@private_key = private_key
|
7
|
+
validate!
|
8
|
+
end
|
9
|
+
|
10
|
+
def valid?
|
11
|
+
@certificate && @private_key
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_options
|
15
|
+
return {} unless valid?
|
16
|
+
{
|
17
|
+
secure: true,
|
18
|
+
tls_options: {
|
19
|
+
private_key_file: @private_key,
|
20
|
+
cert_chain_file: @certificate
|
21
|
+
}
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def scheme
|
26
|
+
valid? ? "wss" : "ws"
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def present?
|
32
|
+
@certificate || @private_key
|
33
|
+
end
|
34
|
+
|
35
|
+
def validate!
|
36
|
+
if present? && !valid?
|
37
|
+
raise ArgumentError.new, "You must provide both :wss_certificate and :wss_private_key"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/middleman-livereload.rb
CHANGED
@@ -1,22 +1,19 @@
|
|
1
|
-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "middleman-livereload/version"
|
1
|
+
require "./lib/middleman-livereload/version"
|
4
2
|
|
5
3
|
Gem::Specification.new do |s|
|
6
4
|
s.name = "middleman-livereload"
|
7
5
|
s.version = Middleman::LiveReload::VERSION
|
8
6
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors
|
10
|
-
s.email
|
7
|
+
s.authors = ["Thomas Reynolds", "Ben Hollis", "Karl Freeman"]
|
8
|
+
s.email = ["me@tdreyno.com", "ben@benhollis.net", "karlfreeman@gmail.com"]
|
11
9
|
s.homepage = "https://github.com/middleman/middleman-livereload"
|
12
10
|
s.summary = %q{LiveReload support for Middleman}
|
13
11
|
s.description = %q{LiveReload support for Middleman}
|
14
12
|
s.license = "MIT"
|
15
13
|
s.files = `git ls-files -z`.split("\0")
|
16
14
|
s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.
|
20
|
-
s.add_runtime_dependency('rack-livereload', ['~> 0.3.15'])
|
15
|
+
s.required_ruby_version = '>= 2.7.0'
|
16
|
+
s.add_runtime_dependency("middleman-core", [">= 3.3"])
|
17
|
+
s.add_runtime_dependency('rack-livereload', ['~> 0.6.1'])
|
21
18
|
s.add_runtime_dependency('em-websocket', ['~> 0.5.1'])
|
22
19
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "middleman-livereload/wss"
|
3
|
+
|
4
|
+
module Middleman
|
5
|
+
module LiveReload
|
6
|
+
RSpec.describe Wss do
|
7
|
+
let(:wss) { Wss.new certificate, private_key }
|
8
|
+
|
9
|
+
it "prevents missing certificate or private_key" do
|
10
|
+
expect { Wss.new nil, "y" }.to raise_error(ArgumentError, /both :wss_certificate and :wss_private_key/)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#scheme" do
|
14
|
+
subject { wss.scheme }
|
15
|
+
|
16
|
+
context "no certificate and no private key" do
|
17
|
+
let(:certificate) { nil }
|
18
|
+
let(:private_key) { nil }
|
19
|
+
|
20
|
+
it { is_expected.to eq "ws" }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "certificate and private key" do
|
24
|
+
let(:certificate) { "x" }
|
25
|
+
let(:private_key) { "y" }
|
26
|
+
|
27
|
+
it { is_expected.to eq "wss" }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#to_options" do
|
32
|
+
subject { wss.to_options }
|
33
|
+
|
34
|
+
context "no certificate and no private key" do
|
35
|
+
let(:certificate) { nil }
|
36
|
+
let(:private_key) { nil }
|
37
|
+
|
38
|
+
it { is_expected.to eq Hash.new }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "certificate and private key" do
|
42
|
+
let(:certificate) { "x" }
|
43
|
+
let(:private_key) { "y" }
|
44
|
+
let(:options) do
|
45
|
+
{
|
46
|
+
secure: true,
|
47
|
+
tls_options: {
|
48
|
+
private_key_file: private_key,
|
49
|
+
cert_chain_file: certificate
|
50
|
+
}
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
it { is_expected.to eq options }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "#valid?" do
|
59
|
+
subject { wss.valid? }
|
60
|
+
|
61
|
+
context "no certificate and no private key" do
|
62
|
+
let(:certificate) { nil }
|
63
|
+
let(:private_key) { nil }
|
64
|
+
|
65
|
+
it { is_expected.to be_falsey }
|
66
|
+
end
|
67
|
+
|
68
|
+
context "certificate and private key" do
|
69
|
+
let(:certificate) { "x" }
|
70
|
+
let(:private_key) { "y" }
|
71
|
+
|
72
|
+
it { is_expected.to be_truthy }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-livereload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
8
8
|
- Ben Hollis
|
9
9
|
- Karl Freeman
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.6.1
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.6.1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: em-websocket
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,27 +63,28 @@ executables: []
|
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
|
+
- ".github/workflows/ci.yml"
|
66
67
|
- ".gitignore"
|
67
|
-
- ".travis.yml"
|
68
68
|
- CHANGELOG.md
|
69
69
|
- CONTRIBUTING.md
|
70
70
|
- Gemfile
|
71
71
|
- LICENSE.md
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
74
|
-
- features/.gitkeep
|
75
|
-
- fixtures/.gitkeep
|
76
74
|
- lib/middleman-livereload.rb
|
77
|
-
- lib/middleman-livereload/
|
75
|
+
- lib/middleman-livereload/extension.rb
|
78
76
|
- lib/middleman-livereload/reactor.rb
|
79
77
|
- lib/middleman-livereload/version.rb
|
78
|
+
- lib/middleman-livereload/wss.rb
|
80
79
|
- lib/middleman_extension.rb
|
81
80
|
- middleman-livereload.gemspec
|
81
|
+
- spec/middleman-livereload/wss_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
82
83
|
homepage: https://github.com/middleman/middleman-livereload
|
83
84
|
licenses:
|
84
85
|
- MIT
|
85
86
|
metadata: {}
|
86
|
-
post_install_message:
|
87
|
+
post_install_message:
|
87
88
|
rdoc_options: []
|
88
89
|
require_paths:
|
89
90
|
- lib
|
@@ -91,19 +92,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
92
|
requirements:
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
95
|
+
version: 2.7.0
|
95
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
97
|
requirements:
|
97
98
|
- - ">="
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
|
-
|
102
|
-
|
103
|
-
signing_key:
|
102
|
+
rubygems_version: 3.5.16
|
103
|
+
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: LiveReload support for Middleman
|
106
|
-
test_files:
|
107
|
-
- features/.gitkeep
|
108
|
-
- fixtures/.gitkeep
|
109
|
-
has_rdoc:
|
106
|
+
test_files: []
|
data/.travis.yml
DELETED
data/features/.gitkeep
DELETED
File without changes
|
data/fixtures/.gitkeep
DELETED
File without changes
|