nanoc-live 1.0.0a1 → 1.0.0a2
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 +4 -4
- data/NEWS.md +7 -0
- data/lib/nanoc/live.rb +9 -0
- data/lib/nanoc/live/commands/live.rb +31 -0
- data/lib/nanoc/live/live_recompiler.rb +6 -4
- data/lib/nanoc/live/version.rb +1 -1
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 412c66134e3f76c210f21c2b074f56d828843ac36f6bde4608226e65a8fa700b
|
4
|
+
data.tar.gz: 04e281da49f03ae98a92429a2a528b972573a195facb38431d2f60721585e6cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fbcefbcb984f6b526ae00b07356332c8f9bcc5c1b44980a6a43c58b22a9c5cdb1d4d7a5c8c79f4ce85f94ca5cfa1aa69812f15de6f7574945b5b89095e5bd49
|
7
|
+
data.tar.gz: c5051c3f36441a9b84ce7e56a02219852690d3132bb8415a3282e5db2ac4b250b15ac9b9f1d2a575e36de0615ab54405acd5a93c197c0937021c069950a6c8ba
|
data/NEWS.md
CHANGED
data/lib/nanoc/live.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'adsf/live'
|
4
|
+
require 'listen'
|
5
|
+
require 'nanoc'
|
6
|
+
require 'nanoc/cli'
|
4
7
|
|
5
8
|
module Nanoc
|
6
9
|
module Live
|
@@ -9,3 +12,9 @@ end
|
|
9
12
|
|
10
13
|
require_relative 'live/version'
|
11
14
|
require_relative 'live/live_recompiler'
|
15
|
+
|
16
|
+
Nanoc::CLI.after_setup do
|
17
|
+
root = File.dirname(__FILE__)
|
18
|
+
live_command_path = File.join(root, 'live', 'commands', 'live.rb')
|
19
|
+
Nanoc::CLI.add_command(Nanoc::CLI.load_command_at(live_command_path))
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
usage 'live'
|
4
|
+
summary 'auto-recompile and serve'
|
5
|
+
description <<~EOS
|
6
|
+
Starts the live recompiler along with the static web server. Unless specified,
|
7
|
+
the web server will run on port 3000 and listen on all IP addresses. Running
|
8
|
+
this static web server requires `adsf` (not `asdf`!).
|
9
|
+
EOS
|
10
|
+
|
11
|
+
required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
|
12
|
+
required :o, :host, 'specify the host to listen on (default: 127.0.0.1)'
|
13
|
+
required :p, :port, 'specify the port to listen on (default: 3000)'
|
14
|
+
flag :L, :'live-reload', 'reload on changes'
|
15
|
+
|
16
|
+
module Nanoc::Live::Commands
|
17
|
+
class Live < ::Nanoc::CLI::CommandRunner
|
18
|
+
def run
|
19
|
+
self.class.enter_site_dir
|
20
|
+
|
21
|
+
Thread.new do
|
22
|
+
Thread.current.abort_on_exception = true
|
23
|
+
Nanoc::CLI::Commands::View.new(options, [], self).run
|
24
|
+
end
|
25
|
+
|
26
|
+
Nanoc::Live::LiveRecompiler.new(command_runner: self).run
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
runner Nanoc::Live::Commands::Live
|
@@ -79,6 +79,12 @@ module Nanoc::Live
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def handle_changes(site, command_runner)
|
82
|
+
Nanoc::CLI::ErrorHandler.handle_while(exit_on_error: false) do
|
83
|
+
unsafe_handle_changes(site, command_runner)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def unsafe_handle_changes(site, command_runner)
|
82
88
|
time_before = Time.now
|
83
89
|
|
84
90
|
puts 'Compiling site…'
|
@@ -98,8 +104,6 @@ module Nanoc::Live
|
|
98
104
|
end
|
99
105
|
|
100
106
|
def gen_lib_changes
|
101
|
-
require 'listen'
|
102
|
-
|
103
107
|
Nanoc::ChangesStream.new do |cl|
|
104
108
|
opts = {
|
105
109
|
latency: 0.0,
|
@@ -113,8 +117,6 @@ module Nanoc::Live
|
|
113
117
|
end
|
114
118
|
|
115
119
|
def gen_config_and_rules_changes
|
116
|
-
require 'listen'
|
117
|
-
|
118
120
|
Nanoc::ChangesStream.new do |cl|
|
119
121
|
opts = {
|
120
122
|
only: /(\/|\A)(nanoc\.yaml|config\.yaml|rules|Rules|rules\.rb|Rules\.rb)\z/,
|
data/lib/nanoc/live/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-live
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.0a2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: adsf-live
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: listen
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,6 +45,9 @@ dependencies:
|
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '4.8'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 4.8.16
|
34
51
|
type: :runtime
|
35
52
|
prerelease: false
|
36
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,6 +55,9 @@ dependencies:
|
|
38
55
|
- - "~>"
|
39
56
|
- !ruby/object:Gem::Version
|
40
57
|
version: '4.8'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 4.8.16
|
41
61
|
description: Provides support for auto-recompiling Nanoc sites.
|
42
62
|
email: denis+rubygems@denis.ws
|
43
63
|
executables: []
|
@@ -47,6 +67,7 @@ files:
|
|
47
67
|
- NEWS.md
|
48
68
|
- README.md
|
49
69
|
- lib/nanoc/live.rb
|
70
|
+
- lib/nanoc/live/commands/live.rb
|
50
71
|
- lib/nanoc/live/live_recompiler.rb
|
51
72
|
- lib/nanoc/live/version.rb
|
52
73
|
homepage: http://nanoc.ws/
|