jekyll-livereload 0.1.0 → 0.1.1.1

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: 5172bc1a4a4cf20c6e844b26236788dffc7eec36
4
- data.tar.gz: 09f9dafb3464b68a2528e20990d499a01a0ee5c0
3
+ metadata.gz: b06478eab8b2303bef86d2bc601aa05f125954ed
4
+ data.tar.gz: ef7ac2618c98f6186fd8dedfc3375dba5e76b749
5
5
  SHA512:
6
- metadata.gz: e50f9a2cda0661b32fa23afcc3720f0add3494ac3ac6a71ea97dba83eca6f5c20eb7284823ba3d1ce2f68ee89f644617a23d46e715b2a8962c6732029108f9c4
7
- data.tar.gz: f90aada21a001a7e5bce28a0d6fdf795917301bb39c6223a53eb7f32515ac4610f66eb17cb826b2e4ddb3bbfa75e1af5383510161688de37cf46da9f0e9670e5
6
+ metadata.gz: e2a5173d48a1fe632514f97c02e8da504b6fefcf08305b84bf360dc8b21ae4ebb9f9c06781211277945dff2599b80d00f96f9581894074e47e0d1c5bbc49dec3
7
+ data.tar.gz: 3263e143ce532d299d25a030bba1c894817be06fc906030370b76b78a36d59cbc9be29c89d4c315b74f6bc28ebaa7d8115d9665793a18317bd5a2ca953a19fbf
@@ -0,0 +1,12 @@
1
+ ## 0.1.1 / 2016-05-09
2
+
3
+ ### Minor fixes and improvements
4
+
5
+ * Don't start Websocket unless --livereload is included
6
+ * Support configuration through `_config.yml` file
7
+
8
+ ## 0.1.0 / 2016-05-09
9
+
10
+ ### Initial Release
11
+
12
+ * First release of Jekyll-Livereload
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Jekyll::Livereload
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll-livereload.svg)](https://badge.fury.io/rb/jekyll-livereload)
4
+
3
5
  Adds Livereloading support to Jekyll
4
6
 
5
7
  ## Installation
@@ -8,7 +10,7 @@ Add this line to your site's Gemfile in the Jekyll Plugin Group:
8
10
 
9
11
  ```ruby
10
12
  group :jekyll_plugins do
11
- gem 'jekyll-paginate'
13
+ gem 'jekyll-livereload'
12
14
  end
13
15
  ```
14
16
 
@@ -35,6 +37,18 @@ that two new options have been added.
35
37
 
36
38
  These options have been added by this plugin.
37
39
 
40
+ ## Making Livereload the default
41
+
42
+ Jekyll::Livereload supports readings configuration values from your local `_config.yml`
43
+ file. If you always what to use Livereload, and why wouldn't you, you can add it to
44
+ your config like so:
45
+
46
+ ```yaml
47
+ # Server Config optiosn
48
+ livereload: true # You no longer need to include --livereload
49
+ reload_port: 5678 # If you don't want to use the default port
50
+ ```
51
+
38
52
  ## Caveats
39
53
 
40
54
  This plugin is dependent on the way Jekyll loads plugins.
@@ -43,7 +57,7 @@ includes `jekyll` and `mercenary`, both of which need to be modified before
43
57
  Jekyll initializes it's command line options.
44
58
 
45
59
  If you attempt to use this plugin by installing it in the `_plugin` directory
46
- or by adding it to your `_config.yaml` file, it will not work.
60
+ or by adding it to your `_config.yml` file, it will not work.
47
61
 
48
62
  This plugin will break if Jekyll upstream every changes the placement of the call
49
63
  `Jekyll::PluginManager.require_from_bundler` in it's `binary` command `jekyll` to
@@ -5,7 +5,7 @@ require 'jekyll-livereload/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "jekyll-livereload"
8
- spec.version = Jekyll::Livereload::VERSION
8
+ spec.version = "#{Jekyll::Livereload::VERSION}.1"
9
9
  spec.authors = ["Robert DeRose"]
10
10
  spec.email = ["RobertDeRose@gmail.com"]
11
11
  spec.summary = "Adds LiveReload support to Jekyll's included Server"
@@ -1,22 +1,27 @@
1
1
  require 'json'
2
+ require_relative 'configuration'
2
3
 
3
4
  # Register Hooks, if livereload is enabled
4
5
  module Jekyll
5
6
  module Livereload
6
7
  module Build
8
+ include Livereload::Configuration
9
+
7
10
  def process(opts)
8
- opts['host'] = 'localhost' unless opts.key?('host')
9
- opts['reload_port'] = Livereload::LIVERELOAD_PORT unless opts.key?('reload_port')
11
+ opts = load_config_options(opts)
10
12
  if opts['livereload']
13
+
11
14
  Jekyll::Hooks.register(:site, :post_render) do |site|
12
15
  regenerator = Jekyll::Regenerator.new(site)
13
16
  Livereload.pages = site.pages.select do |p|
14
17
  regenerator.regenerate?(p)
15
18
  end
16
19
  end
20
+
17
21
  Jekyll::Hooks.register([:pages, :documents], :post_render) do |doc|
18
22
  doc.output.sub!(/<head>(.*)<\/head>/m, "<head>\\1#{reload_script(opts)}</head>")
19
23
  end
24
+
20
25
  Jekyll::Hooks.register :site, :post_write do
21
26
  Livereload.reactor.reload() unless Livereload.reactor.nil?
22
27
  end
@@ -0,0 +1,13 @@
1
+ module Jekyll
2
+ module Livereload
3
+ module Configuration
4
+ private
5
+ def load_config_options(opts)
6
+ opts = configuration_from_options(opts)
7
+ opts['host'] = 'localhost' unless opts.key?('host')
8
+ opts['reload_port'] = Livereload::LIVERELOAD_PORT unless opts.key?('reload_port')
9
+ return opts
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,5 @@
1
+ require_relative 'configuration'
2
+
1
3
  # Allows us to add more option parameter to the serve command
2
4
  module Mercenary
3
5
  class Command
@@ -15,6 +17,8 @@ end
15
17
  module Jekyll
16
18
  module Livereload
17
19
  module Serve
20
+ include Livereload::Configuration
21
+
18
22
  def init_with_program(prog)
19
23
  prog.command(:serve) do |c|
20
24
  c.option 'livereload', '-L', '--livereload', 'Inject Livereload.js and run a WebSocket Server'
@@ -25,8 +29,12 @@ module Jekyll
25
29
  end
26
30
 
27
31
  def process(opts)
28
- Livereload.reactor = Livereload::Reactor.new(opts)
29
- Livereload.reactor.start
32
+ opts = load_config_options(opts)
33
+ if opts['livereload']
34
+ Livereload.reactor = Livereload::Reactor.new(opts)
35
+ Livereload.reactor.start
36
+ end
37
+
30
38
  super opts
31
39
  end
32
40
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Livereload
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-livereload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert DeRose
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -62,7 +62,7 @@ files:
62
62
  - ".gitignore"
63
63
  - ".rspec"
64
64
  - Gemfile
65
- - History.markdown
65
+ - History.md
66
66
  - LICENSE.txt
67
67
  - README.md
68
68
  - Rakefile
@@ -70,6 +70,7 @@ files:
70
70
  - js/livereload.js
71
71
  - lib/jekyll-livereload.rb
72
72
  - lib/jekyll-livereload/build.rb
73
+ - lib/jekyll-livereload/configuration.rb
73
74
  - lib/jekyll-livereload/serve.rb
74
75
  - lib/jekyll-livereload/version.rb
75
76
  - lib/jekyll-livereload/websocket.rb
@@ -1,5 +0,0 @@
1
- ## 1.0.0 / 2016-05-07
2
-
3
- ### Initial Release
4
-
5
- * First release of Jekyll-Livereload