jekyll-reload 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d1ece306b70d9a5cb176d28b52b28fea40c5476c
4
+ data.tar.gz: 669013b1cd22be3ad54222f96628fc9cde28156d
5
+ SHA512:
6
+ metadata.gz: c9d465a1861a0f42cd43d73eeb3a16378c62fa33ee004af67a1e8328b2548ba04554ba9429fb13217309f0b852b874ecb1aad884e0e11e439a05ea044aa9a146
7
+ data.tar.gz: 674f22f17d89e28eb5c12429ee72312d96390f0534a339a07f38e7dc09f24b73d38f383306cd75f62fd849baeb417e0884210a9c27e771b51040c19387d90bee
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ source "https://rubygems.org"
6
+ gemspec
7
+
8
+ group :development do
9
+ gem "travis"
10
+ gem "pry"
11
+
12
+ group :test do
13
+ gem "rubocop", require: false
14
+ end
15
+ end
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,44 @@
1
+ [![Code Climate](https://img.shields.io/codeclimate/maintainability/anomaly/jekyll-reload.svg?style=for-the-badge)](https://codeclimate.com/github/anomaly/jekyll-reload/maintainability)
2
+ ![Gem Version](https://img.shields.io/gem/v/jekyll-reload.svg?style=for-the-badge)
3
+ ![Gem DL](https://img.shields.io/gem/dt/jekyll-reload.svg?style=for-the-badge)
4
+
5
+ # Jekyll Reload
6
+
7
+ Jekyll Reload is a modern, simple, and to the point take on LiveReload for Jekyll. There is no adding of scripts to your source, there is just using LiveReload, and booting your site with the server in development, and then having your browser connect to the LiveReload after your site becomes available to browser (most of the time this will be automatic if you've already enabled LiveReload for the port before).
8
+
9
+ ## Usage
10
+
11
+ ```ruby
12
+ gem "jekyll-reload", {
13
+ group: "jekyll-plugins"
14
+ }
15
+ ```
16
+
17
+ ### In your Layout `<head>`
18
+ #### W/ Jekyll-Assets
19
+
20
+ ```html
21
+ {% asset livereload.js %}
22
+ ```
23
+
24
+ #### Vendor
25
+
26
+ ```html
27
+ {% livereload %}
28
+ ```
29
+
30
+ #### Addon
31
+
32
+ 1. Download the [Browser Plugin](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei)
33
+ 2. Click to enable.
34
+
35
+ ## Config
36
+
37
+ ```yaml
38
+ reloader:
39
+ error_file: nil
40
+ host: Jekyll::Site#config["host"]
41
+ port: 35729
42
+ ```
43
+
44
+ ***The Reloader can return an error page, if you designate one, this is will allow you to customize the error message you see in development, or to serve up your standard error page for consistency, if you want. It should be the relative path from your source, and part of Jekyll.***
@@ -0,0 +1,32 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2012 - 2017 - MIT License
3
+ # Encoding: utf-8
4
+
5
+ # --
6
+ task :spec do
7
+ exec "script/test"
8
+ end
9
+
10
+ # --
11
+ task :test do
12
+ exec "script/test"
13
+ end
14
+
15
+ # --
16
+ task :rubocop do
17
+ exec "script/lint"
18
+ end
19
+
20
+ # --
21
+ task :lint do
22
+ exec "script/lint"
23
+ end
24
+
25
+ # --
26
+ # If you wish to have extra rake tasks
27
+ # You can load them from within the script
28
+ # directory by creating task.rake.
29
+ # --
30
+ Dir.glob("script/rake/*.rake").each do |v|
31
+ load v
32
+ end
@@ -0,0 +1,6 @@
1
+ # rubocop:disable Naming/FileName
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2017 - Apache 2.0 License
4
+ # Encoding: utf-8
5
+
6
+ require_relative "jekyll/reload"
@@ -0,0 +1,14 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ module Jekyll
6
+ class Site
7
+ attr_accessor :reloader
8
+ require_relative "reload/hooks/server"
9
+ require_relative "reload/hooks/reaction"
10
+ require_relative "reload/plugins/jekyll/assets/hook"
11
+ require_relative "reload/hooks/config"
12
+ require_relative "reload/tag"
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ require_relative "../reactor"
6
+ require "jekyll"
7
+
8
+ Jekyll::Hooks.register :site, :after_init, priority: :low do |s|
9
+ s.config["reloader"] ||= {}
10
+ s.config["reloader"]["host"] ||= s.config["host"]
11
+ s.config["reloader"]["error_file"] ||= nil
12
+ s.config["reloader"]["port"] ||= 35_729
13
+ end
@@ -0,0 +1,27 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ require "jekyll"
6
+ def hook
7
+ Jekyll::Hooks.register :site, :post_write, priority: :high do |s|
8
+ if Jekyll.env == "development" && s.reloader
9
+ s.reloader.reload
10
+ end
11
+ end
12
+ end
13
+
14
+ begin
15
+ require "jekyll/assets"; require "jekyll/assets/version"
16
+ if Gem::Version.new(Jekyll::Assets::VERSION) >= Gem::Version.new("3.0")
17
+ Jekyll::Assets::Hook.register :env, :after_write do
18
+ if Jekyll.env == "development" && jekyll.reloader
19
+ then jekyll.reloader.reload
20
+ end
21
+ end
22
+ else
23
+ hook
24
+ end
25
+ rescue LoadError
26
+ hook
27
+ end
@@ -0,0 +1,14 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # rubocop:disable Style/SymbolProc
4
+ # Encoding: utf-8
5
+
6
+ require_relative "../reactor"
7
+ require "jekyll"
8
+
9
+ Jekyll::Hooks.register :site, :post_write, priority: :high do |s|
10
+ next if s.reloader; s.reloader = Jekyll::Reload::Reactor.new(s)
11
+ .tap do |o|
12
+ o.start
13
+ end
14
+ end
@@ -0,0 +1,39 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ begin
6
+ require "jekyll-assets"
7
+
8
+ module Jekyll
9
+ module Reload
10
+ class Default < Jekyll::Assets::Default
11
+ content_types "application/javascript"
12
+
13
+ def set_src
14
+ config = jekyll.config["reloader"]
15
+
16
+ uri.scheme = "http"
17
+ uri.port = config["port"]
18
+ uri.query = "sha=#{asset.hexdigest}"
19
+ uri.hostname = config["host"]
20
+ uri.path = "/livereload.js"
21
+ args[:src] = uri.to_s
22
+ end
23
+
24
+ # --
25
+ def self.for?(type:, args:)
26
+ super && args[:argv1] == "livereload.js"
27
+ end
28
+
29
+ # --
30
+ private
31
+ def uri
32
+ @uri ||= URI.parse(args[:src])
33
+ end
34
+ end
35
+ end
36
+ end
37
+ rescue LoadError
38
+ nil
39
+ end
@@ -0,0 +1,16 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ begin
6
+ require "jekyll/assets"; require "jekyll/assets/version"
7
+ if Gem::Version.new(Jekyll::Assets::VERSION) >= Gem::Version.new("3.0")
8
+ require_relative "default"
9
+
10
+ Jekyll::Assets::Hook.register :env, :after_init do
11
+ append_path Pathutil.new(__dir__).join("../../../vendor").expand_path.to_s
12
+ end
13
+ end
14
+ rescue LoadError
15
+ nil
16
+ end
@@ -0,0 +1,92 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ require_relative "server"
6
+ require "eventmachine"
7
+
8
+ module Jekyll
9
+ module Reload
10
+ class Reactor
11
+ attr_reader :jekyll, :wsc
12
+ extend Forwardable::Extended
13
+ rb_delegate :disconnect, {
14
+ to: :@wsc, alias_of: :delete
15
+ }
16
+
17
+ # --
18
+ def initialize(jekyll)
19
+ @jekyll, @wsc = jekyll, []
20
+ end
21
+
22
+ # --
23
+ def stop
24
+ @thread&.kill
25
+ Jekyll.logger.debug("Reloader:",
26
+ "stopped")
27
+ end
28
+
29
+ # --
30
+ def running?
31
+ @thread&.alive?
32
+ end
33
+
34
+ # --
35
+ def start
36
+ Thread.abort_on_exception = true
37
+ @thread = Thread.new do
38
+ EventMachine.run do
39
+ o = {
40
+ jekyll: jekyll,
41
+ }
42
+
43
+ a = jekyll.config["reloader"].values_at("host", "port")
44
+ Jekyll.logger.info("Reloader at: ", "http://#{a[0]}:#{a[1]}")
45
+ EventMachine.start_server(a[0], a[1], Server, o) do |w|
46
+ w.onclose { |_| disconnect(w) }
47
+ w.onopen { |v| connect(w, v) }
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ # --
54
+ def reload
55
+ Jekyll.logger.debug("Reloader: ", "reloaded at #{Time.now}")
56
+ paths.map do |v|
57
+ @wsc.each do |sv|
58
+ sv.send(JSON.dump({
59
+ liveCSS: true,
60
+ command: "reload",
61
+ path: v,
62
+ }))
63
+ end
64
+ end
65
+ end
66
+
67
+ # --
68
+ def paths
69
+ (jekyll.pages + jekyll.posts.docs + jekyll.documents)
70
+ .uniq.map(&:path)
71
+ end
72
+
73
+ # --
74
+ private
75
+ def connect(ws, v)
76
+ msg = +"Browser Connected".green
77
+ msg << " from origin #{v.headers['Origin'].yellow}"
78
+ Jekyll.logger.debug("Reloader: ", msg)
79
+
80
+ ws.send(JSON.dump({
81
+ serverName: "Jekyll Reload v#{VERSION}",
82
+ command: "hello",
83
+ protocols: [
84
+ "http://livereload.com/protocols/official-7",
85
+ ],
86
+ }))
87
+
88
+ @wsc << ws
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,126 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ require "forwardable/extended"
6
+ require "em-websocket"
7
+
8
+ module Jekyll
9
+ module Reload
10
+ class Server < EventMachine::WebSocket::Connection
11
+ extend Forwardable::Extended
12
+
13
+ rb_delegate :jekyll_config, to: :jekyll, alias_of: :config
14
+ rb_delegate :config, to: :jekyll_config, type: :hash, key: "reloader"
15
+ rb_delegate :jekyll, to: :@options, type: :hash
16
+ PATH = "/livereload.js"
17
+
18
+ # --
19
+ def dispatch(data)
20
+ parser = Http::Parser.new.tap { |o| o << data }
21
+ return super if parser.http_method != "GET" \
22
+ || parser.upgrade?
23
+
24
+ path = URI.parse(parser.request_url)
25
+ return do_jekyll_asset_200(path) if asset?(path)
26
+ path.path == PATH ? do_200 : do_404
27
+ end
28
+
29
+ # --
30
+ # Serve from Jekyll-Assets.
31
+ # @example {% asset livereload.js %}
32
+ # @note You can override our vendor'd LiveReload.js
33
+ # with your own, if you put it in your `_assets/js` folder.
34
+ # --
35
+ def do_jekyll_asset_200(path)
36
+ sha = CGI.parse(path.query).fetch("sha").first
37
+ content = Pathutil.new(jekyll.in_dest_dir(jekyll.sprockets.prefix_url))
38
+ content = content.join(path.path).expand_path
39
+ content = content.sub_ext("-#{sha}.js")
40
+
41
+ if content.in_path?(jekyll.in_dest_dir)
42
+ complete_with(content, {
43
+ status: 200,
44
+ })
45
+ else
46
+ do_404
47
+ end
48
+ end
49
+
50
+ # --
51
+ def do_404
52
+ complete_with(err_content, {
53
+ status: 404,
54
+ })
55
+ end
56
+
57
+ # --
58
+ def do_200
59
+ content = Pathutil.new(__dir__).join("vendor", "livereload.js")
60
+ complete_with(content, {
61
+ status: 200,
62
+ })
63
+ end
64
+
65
+ # --
66
+ def asset?(path)
67
+ return false unless path.query
68
+ CGI.parse(path.query).key?("sha") &&
69
+ path.path == PATH
70
+ end
71
+
72
+ # --
73
+ # Tries to grab the error page content.
74
+ # If there is not error_page, or error_page is not found,
75
+ # it will return "", a blank page.
76
+ # --
77
+ private
78
+ def err_content
79
+ @content ||= begin
80
+ path = config["error_page"]; return "" unless path
81
+ site.pages.find { |v| v.path == path }.tap do |v|
82
+ v ? v.output : ""
83
+ end
84
+ end
85
+ end
86
+
87
+ # --
88
+ def complete_with(content, status: 200)
89
+ send_data(request_headers(content, status: status))
90
+ stream_file_data(content).callback do
91
+ close_connection true
92
+ end
93
+ end
94
+
95
+ # --
96
+ private
97
+ def request_headers(content, status: 200)
98
+ size = content.respond_to?(:bytesize) ?
99
+ content.bytesize : content.size
100
+
101
+ out = [
102
+ status_for(status),
103
+ "Content-Length: #{size}",
104
+ "Content-Type: text/html",
105
+ "", ""
106
+ ]
107
+
108
+ out.join("\r\n")
109
+ end
110
+
111
+ # --
112
+ private
113
+ def status_for(status = 200)
114
+ case status
115
+ when 200 then "HTTP/1.1 200 OK"
116
+ when 401 then "HTTP/1.1 401 UNAUTHORIZED"
117
+ when 403 then "HTTP/1.1 403 FORBIDDEN"
118
+ when 404 then "HTTP/1.1 404 NOT FOUND"
119
+ when 500 then "HTTP/1.1 500 ERROR"
120
+ else
121
+ "HTTP/1.1 400 BAD REQUEST"
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,24 @@
1
+ # Frozen-string-literal: true
2
+ # rubocop:disable Layout/IndentationConsistency
3
+ # Copyright: 2017 - Apache 2.0 License
4
+ # Encoding: utf-8
5
+
6
+ require "liquid"
7
+
8
+ module Jekyll
9
+ module Reload
10
+ class Tag < Liquid::Tag
11
+ def render(ctx)
12
+ config = ctx.registers[:site].config["reloader"]
13
+ path = "http://#{config['host']}:#{config['port']}/livereload.js"
14
+ a = +"<script type='text/javascript' src='#{path}'>"
15
+ a << "<!-- EMPTY -->"
16
+ a << "</script>"
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ # --
23
+ Liquid::Template.register_tag("livereload",
24
+ Jekyll::Reload::Tag)
@@ -0,0 +1 @@
1
+ !function e(t,n,o){function i(s,l){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!l&&c)return c(s,!0);if(r)return r(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=n[s]={exports:{}};t[s][0].call(h.exports,function(e){var n=t[s][1][e];return i(n||e)},h,h.exports,e,t,n,o)}return n[s].exports}for(var r="function"==typeof require&&require,s=0;s<o.length;s++)i(o[s]);return i}({1:[function(e,t,n){(function(){var t,o,i,r;r=e("./protocol"),i=r.Parser,t=r.PROTOCOL_6,o=r.PROTOCOL_7,n.Connector=function(){function e(e,t,n,o){this.options=e,this.WebSocket=t,this.Timer=n,this.handlers=o,this._uri="ws"+(this.options.https?"s":"")+"://"+this.options.host+":"+this.options.port+"/livereload",this._nextDelay=this.options.mindelay,this._connectionDesired=!1,this.protocol=0,this.protocolParser=new i({connected:function(e){return function(t){return e.protocol=t,e._handshakeTimeout.stop(),e._nextDelay=e.options.mindelay,e._disconnectionReason="broken",e.handlers.connected(t)}}(this),error:function(e){return function(t){return e.handlers.error(t),e._closeOnError()}}(this),message:function(e){return function(t){return e.handlers.message(t)}}(this)}),this._handshakeTimeout=new n(function(e){return function(){if(e._isSocketConnected())return e._disconnectionReason="handshake-timeout",e.socket.close()}}(this)),this._reconnectTimer=new n(function(e){return function(){if(e._connectionDesired)return e.connect()}}(this)),this.connect()}return e.prototype._isSocketConnected=function(){return this.socket&&this.socket.readyState===this.WebSocket.OPEN},e.prototype.connect=function(){if(this._connectionDesired=!0,!this._isSocketConnected())return this._reconnectTimer.stop(),this._disconnectionReason="cannot-connect",this.protocolParser.reset(),this.handlers.connecting(),this.socket=new this.WebSocket(this._uri),this.socket.onopen=function(e){return function(t){return e._onopen(t)}}(this),this.socket.onclose=function(e){return function(t){return e._onclose(t)}}(this),this.socket.onmessage=function(e){return function(t){return e._onmessage(t)}}(this),this.socket.onerror=function(e){return function(t){return e._onerror(t)}}(this)},e.prototype.disconnect=function(){if(this._connectionDesired=!1,this._reconnectTimer.stop(),this._isSocketConnected())return this._disconnectionReason="manual",this.socket.close()},e.prototype._scheduleReconnection=function(){if(this._connectionDesired)return this._reconnectTimer.running?void 0:(this._reconnectTimer.start(this._nextDelay),this._nextDelay=Math.min(this.options.maxdelay,2*this._nextDelay))},e.prototype.sendCommand=function(e){if(null!=this.protocol)return this._sendCommand(e)},e.prototype._sendCommand=function(e){return this.socket.send(JSON.stringify(e))},e.prototype._closeOnError=function(){return this._handshakeTimeout.stop(),this._disconnectionReason="error",this.socket.close()},e.prototype._onopen=function(e){var n;return this.handlers.socketConnected(),this._disconnectionReason="handshake-failed",n={command:"hello",protocols:[t,o]},n.ver="2.2.2",this.options.ext&&(n.ext=this.options.ext),this.options.extver&&(n.extver=this.options.extver),this.options.snipver&&(n.snipver=this.options.snipver),this._sendCommand(n),this._handshakeTimeout.start(this.options.handshake_timeout)},e.prototype._onclose=function(e){return this.protocol=0,this.handlers.disconnected(this._disconnectionReason,this._nextDelay),this._scheduleReconnection()},e.prototype._onerror=function(e){},e.prototype._onmessage=function(e){return this.protocolParser.process(e.data)},e}()}).call(this)},{"./protocol":6}],2:[function(e,t,n){(function(){var e;e={bind:function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent)return e[t]=1,e.attachEvent("onpropertychange",function(e){if(e.propertyName===t)return n()});throw new Error("Attempt to attach custom event "+t+" to something which isn't a DOMElement")},fire:function(e,t){var n;if(e.addEventListener)return(n=document.createEvent("HTMLEvents")).initEvent(t,!0,!0),document.dispatchEvent(n);if(!e.attachEvent)throw new Error("Attempt to fire custom event "+t+" on something which isn't a DOMElement");return e[t]?e[t]++:void 0}},n.bind=e.bind,n.fire=e.fire}).call(this)},{}],3:[function(e,t,n){(function(){t.exports=function(){function e(e,t){this.window=e,this.host=t}return e.identifier="less",e.version="1.0",e.prototype.reload=function(e,t){if(this.window.less&&this.window.less.refresh){if(e.match(/\.less$/i))return this.reloadLess(e);if(t.originalPath.match(/\.less$/i))return this.reloadLess(t.originalPath)}return!1},e.prototype.reloadLess=function(e){var t,n,o,i;if(0===(n=function(){var e,n,o,i;for(i=[],e=0,n=(o=document.getElementsByTagName("link")).length;e<n;e++)((t=o[e]).href&&t.rel.match(/^stylesheet\/less$/i)||t.rel.match(/stylesheet/i)&&t.type.match(/^text\/(x-)?less$/i))&&i.push(t);return i}()).length)return!1;for(o=0,i=n.length;o<i;o++)(t=n[o]).href=this.host.generateCacheBustUrl(t.href);return this.host.console.log("LiveReload is asking LESS to recompile all stylesheets"),this.window.less.refresh(!0),!0},e.prototype.analyze=function(){return{disable:!(!this.window.less||!this.window.less.refresh)}},e}()}).call(this)},{}],4:[function(e,t,n){(function(){var t,o,i,r,s={}.hasOwnProperty;t=e("./connector").Connector,r=e("./timer").Timer,o=e("./options").Options,i=e("./reloader").Reloader,n.LiveReload=function(){function e(e){var n,l,c;if(this.window=e,this.listeners={},this.plugins=[],this.pluginIdentifiers={},this.console=this.window.console&&this.window.console.log&&this.window.console.error?this.window.location.href.match(/LR-verbose/)?this.window.console:{log:function(){},error:this.window.console.error.bind(this.window.console)}:{log:function(){},error:function(){}},this.WebSocket=this.window.WebSocket||this.window.MozWebSocket){if("LiveReloadOptions"in e){this.options=new o,c=e.LiveReloadOptions;for(n in c)s.call(c,n)&&(l=c[n],this.options.set(n,l))}else if(this.options=o.extract(this.window.document),!this.options)return void this.console.error("LiveReload disabled because it could not find its own <SCRIPT> tag");this.reloader=new i(this.window,this.console,r),this.connector=new t(this.options,this.WebSocket,r,{connecting:function(){},socketConnected:function(){},connected:function(e){return function(t){var n;return"function"==typeof(n=e.listeners).connect&&n.connect(),e.log("LiveReload is connected to "+e.options.host+":"+e.options.port+" (protocol v"+t+")."),e.analyze()}}(this),error:function(e){if(e instanceof ProtocolError){if("undefined"!=typeof console&&null!==console)return console.log(e.message+".")}else if("undefined"!=typeof console&&null!==console)return console.log("LiveReload internal error: "+e.message)},disconnected:function(e){return function(t,n){var o;switch("function"==typeof(o=e.listeners).disconnect&&o.disconnect(),t){case"cannot-connect":return e.log("LiveReload cannot connect to "+e.options.host+":"+e.options.port+", will retry in "+n+" sec.");case"broken":return e.log("LiveReload disconnected from "+e.options.host+":"+e.options.port+", reconnecting in "+n+" sec.");case"handshake-timeout":return e.log("LiveReload cannot connect to "+e.options.host+":"+e.options.port+" (handshake timeout), will retry in "+n+" sec.");case"handshake-failed":return e.log("LiveReload cannot connect to "+e.options.host+":"+e.options.port+" (handshake failed), will retry in "+n+" sec.");case"manual":case"error":break;default:return e.log("LiveReload disconnected from "+e.options.host+":"+e.options.port+" ("+t+"), reconnecting in "+n+" sec.")}}}(this),message:function(e){return function(t){switch(t.command){case"reload":return e.performReload(t);case"alert":return e.performAlert(t)}}}(this)}),this.initialized=!0}else this.console.error("LiveReload disabled because the browser does not seem to support web sockets")}return e.prototype.on=function(e,t){return this.listeners[e]=t},e.prototype.log=function(e){return this.console.log(""+e)},e.prototype.performReload=function(e){var t,n;return this.log("LiveReload received reload request: "+JSON.stringify(e,null,2)),this.reloader.reload(e.path,{liveCSS:null==(t=e.liveCSS)||t,liveImg:null==(n=e.liveImg)||n,originalPath:e.originalPath||"",overrideURL:e.overrideURL||"",serverURL:"http://"+this.options.host+":"+this.options.port})},e.prototype.performAlert=function(e){return alert(e.message)},e.prototype.shutDown=function(){var e;if(this.initialized)return this.connector.disconnect(),this.log("LiveReload disconnected."),"function"==typeof(e=this.listeners).shutdown?e.shutdown():void 0},e.prototype.hasPlugin=function(e){return!!this.pluginIdentifiers[e]},e.prototype.addPlugin=function(e){var t;this.initialized&&(this.hasPlugin(e.identifier)||(this.pluginIdentifiers[e.identifier]=!0,t=new e(this.window,{_livereload:this,_reloader:this.reloader,_connector:this.connector,console:this.console,Timer:r,generateCacheBustUrl:function(e){return function(t){return e.reloader.generateCacheBustUrl(t)}}(this)}),this.plugins.push(t),this.reloader.addPlugin(t)))},e.prototype.analyze=function(){var e,t,n,o,i,r;if(this.initialized&&this.connector.protocol>=7){for(n={},o=0,i=(r=this.plugins).length;o<i;o++)n[(e=r[o]).constructor.identifier]=t=("function"==typeof e.analyze?e.analyze():void 0)||{},t.version=e.constructor.version;this.connector.sendCommand({command:"info",plugins:n,url:this.window.location.href})}},e}()}).call(this)},{"./connector":1,"./options":5,"./reloader":7,"./timer":9}],5:[function(e,t,n){(function(){var e;n.Options=e=function(){function e(){this.https=!1,this.host=null,this.port=35729,this.snipver=null,this.ext=null,this.extver=null,this.mindelay=1e3,this.maxdelay=6e4,this.handshake_timeout=5e3}return e.prototype.set=function(e,t){if(void 0!==t)return isNaN(+t)||(t=+t),this[e]=t},e}(),e.extract=function(t){var n,o,i,r,s,l,c,a,h,u,d,f;for(c=0,h=(d=t.getElementsByTagName("script")).length;c<h;c++)if(n=d[c],(l=n.src)&&(i=l.match(/^[^:]+:\/\/(.*)\/z?livereload\.js(?:\?(.*))?$/))){if(s=new e,s.https=0===l.indexOf("https"),(r=i[1].match(/^([^\/:]+)(?::(\d+))?$/))&&(s.host=r[1],r[2]&&(s.port=parseInt(r[2],10))),i[2])for(a=0,u=(f=i[2].split("&")).length;a<u;a++)(o=f[a].split("=")).length>1&&s.set(o[0].replace(/-/g,"_"),o.slice(1).join("="));return s}return null}}).call(this)},{}],6:[function(e,t,n){(function(){var e,t,o,i=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};n.PROTOCOL_6=e="http://livereload.com/protocols/official-6",n.PROTOCOL_7=t="http://livereload.com/protocols/official-7",n.ProtocolError=o=function(){return function(e,t){this.message="LiveReload protocol error ("+e+') after receiving data: "'+t+'".'}}(),n.Parser=function(){function n(e){this.handlers=e,this.reset()}return n.prototype.reset=function(){return this.protocol=null},n.prototype.process=function(n){var r,s,l,c,a;try{if(null==this.protocol){if(n.match(/^!!ver:([\d.]+)$/))this.protocol=6;else if(l=this._parseMessage(n,["hello"])){if(!l.protocols.length)throw new o("no protocols specified in handshake message");if(i.call(l.protocols,t)>=0)this.protocol=7;else{if(!(i.call(l.protocols,e)>=0))throw new o("no supported protocols found");this.protocol=6}}return this.handlers.connected(this.protocol)}if(6===this.protocol){if(!(l=JSON.parse(n)).length)throw new o("protocol 6 messages must be arrays");if(r=l[0],c=l[1],"refresh"!==r)throw new o("unknown protocol 6 command");return this.handlers.message({command:"reload",path:c.path,liveCSS:null==(a=c.apply_css_live)||a})}return l=this._parseMessage(n,["reload","alert"]),this.handlers.message(l)}catch(e){if((s=e)instanceof o)return this.handlers.error(s);throw s}},n.prototype._parseMessage=function(e,t){var n,r;try{n=JSON.parse(e)}catch(t){throw t,new o("unparsable JSON",e)}if(!n.command)throw new o('missing "command" key',e);if(r=n.command,i.call(t,r)<0)throw new o("invalid command '"+n.command+"', only valid commands are: "+t.join(", ")+")",e);return n},n}()}).call(this)},{}],7:[function(e,t,n){(function(){var e,t,o,i,r,s;s=function(e){var t,n,o;return(n=e.indexOf("#"))>=0?(t=e.slice(n),e=e.slice(0,n)):t="",(n=e.indexOf("?"))>=0?(o=e.slice(n),e=e.slice(0,n)):o="",{url:e,params:o,hash:t}},o=function(e){var t;return e=s(e).url,t=0===e.indexOf("file://")?e.replace(/^file:\/\/(localhost)?/,""):e.replace(/^([^:]+:)?\/\/([^:\/]+)(:\d*)?\//,"/"),decodeURIComponent(t)},r=function(e,n,o){var i,r,s,l,c;for(i={score:0},l=0,c=n.length;l<c;l++)r=n[l],(s=t(e,o(r)))>i.score&&(i={object:r,score:s});return i.score>0?i:null},t=function(e,t){var n,o,i,r;if(e=e.replace(/^\/+/,"").toLowerCase(),t=t.replace(/^\/+/,"").toLowerCase(),e===t)return 1e4;for(n=e.split("/").reverse(),o=t.split("/").reverse(),r=Math.min(n.length,o.length),i=0;i<r&&n[i]===o[i];)++i;return i},i=function(e,n){return t(e,n)>0},e=[{selector:"background",styleNames:["backgroundImage"]},{selector:"border",styleNames:["borderImage","webkitBorderImage","MozBorderImage"]}],n.Reloader=function(){function t(e,t,n){this.window=e,this.console=t,this.Timer=n,this.document=this.window.document,this.importCacheWaitPeriod=200,this.plugins=[]}return t.prototype.addPlugin=function(e){return this.plugins.push(e)},t.prototype.analyze=function(e){return results},t.prototype.reload=function(e,t){var n,o,i,r,s;for(this.options=t,null==(o=this.options).stylesheetReloadTimeout&&(o.stylesheetReloadTimeout=15e3),i=0,r=(s=this.plugins).length;i<r;i++)if((n=s[i]).reload&&n.reload(e,t))return;if(!(t.liveCSS&&e.match(/\.css$/i)&&this.reloadStylesheet(e))){if(!t.liveImg||!e.match(/\.(jpe?g|png|gif)$/i))return this.reloadPage();this.reloadImages(e)}},t.prototype.reloadPage=function(){return this.window.document.location.reload()},t.prototype.reloadImages=function(t){var n,r,s,l,c,a,h,u,d,f,p,m,g,v,y,w,R,_;for(n=this.generateUniqueString(),a=0,f=(v=this.document.images).length;a<f;a++)r=v[a],i(t,o(r.src))&&(r.src=this.generateCacheBustUrl(r.src,n));if(this.document.querySelectorAll)for(h=0,p=e.length;h<p;h++)for(s=(y=e[h]).selector,l=y.styleNames,u=0,m=(w=this.document.querySelectorAll("[style*="+s+"]")).length;u<m;u++)r=w[u],this.reloadStyleImages(r.style,l,t,n);if(this.document.styleSheets){for(_=[],d=0,g=(R=this.document.styleSheets).length;d<g;d++)c=R[d],_.push(this.reloadStylesheetImages(c,t,n));return _}},t.prototype.reloadStylesheetImages=function(t,n,o){var i,r,s,l,c,a,h;try{r=null!=t?t.cssRules:void 0}catch(e){e}if(r)for(l=0,a=r.length;l<a;l++)switch((i=r[l]).type){case CSSRule.IMPORT_RULE:this.reloadStylesheetImages(i.styleSheet,n,o);break;case CSSRule.STYLE_RULE:for(c=0,h=e.length;c<h;c++)s=e[c].styleNames,this.reloadStyleImages(i.style,s,n,o);break;case CSSRule.MEDIA_RULE:this.reloadStylesheetImages(i,n,o)}},t.prototype.reloadStyleImages=function(e,t,n,r){var s,l,c,a,h;for(a=0,h=t.length;a<h;a++)"string"==typeof(c=e[l=t[a]])&&(s=c.replace(/\burl\s*\(([^)]*)\)/,function(e){return function(t,s){return i(n,o(s))?"url("+e.generateCacheBustUrl(s,r)+")":t}}(this)))!==c&&(e[l]=s)},t.prototype.reloadStylesheet=function(e){var t,n,i,s,l,c,a,h,u,d,f,p,m,g,v;for(i=function(){var e,t,o,i;for(i=[],e=0,t=(o=this.document.getElementsByTagName("link")).length;e<t;e++)(n=o[e]).rel.match(/^stylesheet$/i)&&!n.__LiveReload_pendingRemoval&&i.push(n);return i}.call(this),t=[],c=0,d=(g=this.document.getElementsByTagName("style")).length;c<d;c++)(l=g[c]).sheet&&this.collectImportedStylesheets(l,l.sheet,t);for(a=0,f=i.length;a<f;a++)n=i[a],this.collectImportedStylesheets(n,n.sheet,t);if(this.window.StyleFix&&this.document.querySelectorAll)for(h=0,p=(v=this.document.querySelectorAll("style[data-href]")).length;h<p;h++)l=v[h],i.push(l);if(this.console.log("LiveReload found "+i.length+" LINKed stylesheets, "+t.length+" @imported stylesheets"),s=r(e,i.concat(t),function(e){return function(t){return o(e.linkHref(t))}}(this)))s.object.rule?(this.console.log("LiveReload is reloading imported stylesheet: "+s.object.href),this.reattachImportedRule(s.object)):(this.console.log("LiveReload is reloading stylesheet: "+this.linkHref(s.object)),this.reattachStylesheetLink(s.object));else for(this.console.log("LiveReload will reload all stylesheets because path '"+e+"' did not match any specific one"),u=0,m=i.length;u<m;u++)n=i[u],this.reattachStylesheetLink(n);return!0},t.prototype.collectImportedStylesheets=function(e,t,n){var o,i,r,s,l;try{r=null!=t?t.cssRules:void 0}catch(e){e}if(r&&r.length)for(o=s=0,l=r.length;s<l;o=++s)switch((i=r[o]).type){case CSSRule.CHARSET_RULE:continue;case CSSRule.IMPORT_RULE:n.push({link:e,rule:i,index:o,href:i.href}),this.collectImportedStylesheets(e,i.styleSheet,n)}},t.prototype.waitUntilCssLoads=function(e,t){var n,o,i;return n=!1,o=function(){if(!n)return n=!0,t()},e.onload=function(e){return function(){return e.console.log("LiveReload: the new stylesheet has finished loading"),e.knownToSupportCssOnLoad=!0,o()}}(this),this.knownToSupportCssOnLoad||(i=function(t){return function(){return e.sheet?(t.console.log("LiveReload is polling until the new CSS finishes loading..."),o()):t.Timer.start(50,i)}}(this))(),this.Timer.start(this.options.stylesheetReloadTimeout,o)},t.prototype.linkHref=function(e){return e.href||e.getAttribute("data-href")},t.prototype.reattachStylesheetLink=function(e){var t,n;if(!e.__LiveReload_pendingRemoval)return e.__LiveReload_pendingRemoval=!0,"STYLE"===e.tagName?((t=this.document.createElement("link")).rel="stylesheet",t.media=e.media,t.disabled=e.disabled):t=e.cloneNode(!1),t.href=this.generateCacheBustUrl(this.linkHref(e)),(n=e.parentNode).lastChild===e?n.appendChild(t):n.insertBefore(t,e.nextSibling),this.waitUntilCssLoads(t,function(n){return function(){var o;return o=/AppleWebKit/.test(navigator.userAgent)?5:200,n.Timer.start(o,function(){var o;if(e.parentNode)return e.parentNode.removeChild(e),t.onreadystatechange=null,null!=(o=n.window.StyleFix)?o.link(t):void 0})}}(this))},t.prototype.reattachImportedRule=function(e){var t,n,o,i,r,s,l,c;return l=e.rule,n=e.index,o=e.link,s=l.parentStyleSheet,t=this.generateCacheBustUrl(l.href),i=l.media.length?[].join.call(l.media,", "):"",r='@import url("'+t+'") '+i+";",l.__LiveReload_newHref=t,c=this.document.createElement("link"),c.rel="stylesheet",c.href=t,c.__LiveReload_pendingRemoval=!0,o.parentNode&&o.parentNode.insertBefore(c,o),this.Timer.start(this.importCacheWaitPeriod,function(e){return function(){if(c.parentNode&&c.parentNode.removeChild(c),l.__LiveReload_newHref===t)return s.insertRule(r,n),s.deleteRule(n+1),l=s.cssRules[n],l.__LiveReload_newHref=t,e.Timer.start(e.importCacheWaitPeriod,function(){if(l.__LiveReload_newHref===t)return s.insertRule(r,n),s.deleteRule(n+1)})}}(this))},t.prototype.generateUniqueString=function(){return"livereload="+Date.now()},t.prototype.generateCacheBustUrl=function(e,t){var n,o,i,r,l;return null==t&&(t=this.generateUniqueString()),l=s(e),e=l.url,n=l.hash,o=l.params,this.options.overrideURL&&e.indexOf(this.options.serverURL)<0&&(i=e,e=this.options.serverURL+this.options.overrideURL+"?url="+encodeURIComponent(e),this.console.log("LiveReload is overriding source URL "+i+" with "+e)),(r=o.replace(/(\?|&)livereload=(\d+)/,function(e,n){return""+n+t}))===o&&(r=0===o.length?"?"+t:o+"&"+t),e+r+n},t}()}).call(this)},{}],8:[function(e,t,n){(function(){var t,n,o;t=e("./customevents"),n=window.LiveReload=new(e("./livereload").LiveReload)(window);for(o in window)o.match(/^LiveReloadPlugin/)&&n.addPlugin(window[o]);n.addPlugin(e("./less")),n.on("shutdown",function(){return delete window.LiveReload}),n.on("connect",function(){return t.fire(document,"LiveReloadConnect")}),n.on("disconnect",function(){return t.fire(document,"LiveReloadDisconnect")}),t.bind(document,"LiveReloadShutDown",function(){return n.shutDown()})}).call(this)},{"./customevents":2,"./less":3,"./livereload":4}],9:[function(e,t,n){(function(){var e;n.Timer=e=function(){function e(e){this.func=e,this.running=!1,this.id=null,this._handler=function(e){return function(){return e.running=!1,e.id=null,e.func()}}(this)}return e.prototype.start=function(e){return this.running&&clearTimeout(this.id),this.id=setTimeout(this._handler,e),this.running=!0},e.prototype.stop=function(){if(this.running)return clearTimeout(this.id),this.running=!1,this.id=null},e}(),e.start=function(e,t){return setTimeout(t,e)}}).call(this)},{}]},{},[8]);
@@ -0,0 +1,9 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2017 - Apache 2.0 License
3
+ # Encoding: utf-8
4
+
5
+ module Jekyll
6
+ module Reload
7
+ VERSION = "1.0.0"
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-reload
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jordon Bedwell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: em-websocket
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.5'
41
+ description:
42
+ email:
43
+ - jordon@envygeeks.io
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - Gemfile
49
+ - LICENSE
50
+ - README.md
51
+ - Rakefile
52
+ - lib/jekyll-reload.rb
53
+ - lib/jekyll/reload.rb
54
+ - lib/jekyll/reload/hooks/config.rb
55
+ - lib/jekyll/reload/hooks/reaction.rb
56
+ - lib/jekyll/reload/hooks/server.rb
57
+ - lib/jekyll/reload/plugins/jekyll/assets/default.rb
58
+ - lib/jekyll/reload/plugins/jekyll/assets/hook.rb
59
+ - lib/jekyll/reload/reactor.rb
60
+ - lib/jekyll/reload/server.rb
61
+ - lib/jekyll/reload/tag.rb
62
+ - lib/jekyll/reload/vendor/livereload.js
63
+ - lib/jekyll/reload/version.rb
64
+ homepage: http://github.com/anomaly/jekyll-reload/
65
+ licenses:
66
+ - Apache-2.0
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 2.3.0
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 2.6.13
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Reload your content when Jekyll finishes building.
88
+ test_files: []