docwatch-bin 2.4.1 → 2.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 +4 -4
- data/bin/docwatch +12 -2
- data/lib/docwatch/parser/frontmatter.rb +1 -1
- data/lib/docwatch/renderer.rb +2 -6
- data/lib/docwatch/version.rb +1 -1
- data/lib/docwatch.rb +11 -2
- metadata +3 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a594b9cebe2ecef012c75f8212c7259ad7d9aa274ae2c6322a6ced4299568e75
|
|
4
|
+
data.tar.gz: bae4db60bef675d53dc8984386a0b3cc93ea8d07174a30b105c03369a06ceb8d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 035745675f3da094dac22de02d027f6e83e01fe2bd73155a919532cd8bfde423c5eee4fcb2ba4ba5a2066c3d2289851db41e2028a100cb89a6eaab50a2f9aba0
|
|
7
|
+
data.tar.gz: c2e1a169500cd6034373e6f37931388fbe76fc5aef5a5ccd14ff84b73d20f11a4d655e9a0eba1218124a14b7cc8f118a4228d8602a3a165f26858b6d623bc7c2
|
data/bin/docwatch
CHANGED
|
@@ -7,6 +7,7 @@ Params = Struct.new(
|
|
|
7
7
|
:version,
|
|
8
8
|
:file_path,
|
|
9
9
|
:default_styles,
|
|
10
|
+
:output,
|
|
10
11
|
keyword_init: true,
|
|
11
12
|
)
|
|
12
13
|
|
|
@@ -25,6 +26,7 @@ class Main
|
|
|
25
26
|
version: @opts['--version'],
|
|
26
27
|
file_path: @opts['<file-path>'],
|
|
27
28
|
default_styles: @opts['--default-styles'],
|
|
29
|
+
output: @opts['--output'],
|
|
28
30
|
)
|
|
29
31
|
end
|
|
30
32
|
|
|
@@ -41,7 +43,7 @@ class Main
|
|
|
41
43
|
'http://localhost:%s' % port
|
|
42
44
|
end
|
|
43
45
|
|
|
44
|
-
def port_valid
|
|
46
|
+
def port_valid?
|
|
45
47
|
true
|
|
46
48
|
end
|
|
47
49
|
|
|
@@ -67,11 +69,18 @@ class Main
|
|
|
67
69
|
def run
|
|
68
70
|
exit_version if params.version
|
|
69
71
|
exit_invalid_file unless File.exist?(params.file_path)
|
|
70
|
-
exit_invalid_port unless port_valid
|
|
71
72
|
|
|
72
73
|
renderer = Renderer.by_filetype(params.file_path, params.default_styles)
|
|
73
74
|
exit_unknown_renderer if renderer.nil?
|
|
74
75
|
|
|
76
|
+
if params.output
|
|
77
|
+
File.write(params.output, renderer.to_html(static: true))
|
|
78
|
+
puts 'Wrote %s'.green % params.output
|
|
79
|
+
exit 0
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
exit_invalid_port unless port_valid?
|
|
83
|
+
|
|
75
84
|
server = TCPServer.new(port)
|
|
76
85
|
logger = Logger.new(params.verbose)
|
|
77
86
|
watcher = Watcher.new(params.file_path)
|
|
@@ -110,6 +119,7 @@ usage = <<~EOF
|
|
|
110
119
|
#{PROGRAM_NAME} --version
|
|
111
120
|
|
|
112
121
|
Options:
|
|
122
|
+
-o, --output FILE Render once to file and exit
|
|
113
123
|
-p, --port VALUE Listen port [default: 8888]
|
|
114
124
|
Set to 'random' for a random port
|
|
115
125
|
-d, --default-styles Use default styling
|
data/lib/docwatch/renderer.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Docwatch
|
|
|
23
23
|
File.read(Docwatch.root_dir + '/res/inject.js')
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
def to_html
|
|
26
|
+
def to_html(static: false)
|
|
27
27
|
return <<~EOF
|
|
28
28
|
<!doctype html>
|
|
29
29
|
<html>
|
|
@@ -32,11 +32,7 @@ module Docwatch
|
|
|
32
32
|
</head>
|
|
33
33
|
<body>
|
|
34
34
|
#{body}
|
|
35
|
-
<script>
|
|
36
|
-
(function() {
|
|
37
|
-
#{js}
|
|
38
|
-
})()
|
|
39
|
-
</script>
|
|
35
|
+
#{static ? '' : "<script>\n(function() {\n#{js}\n})()\n</script>"}
|
|
40
36
|
</body>
|
|
41
37
|
</html>
|
|
42
38
|
EOF
|
data/lib/docwatch/version.rb
CHANGED
data/lib/docwatch.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'require_all'
|
|
2
1
|
require 'rouge'
|
|
3
2
|
require 'rouge/plugins/redcarpet'
|
|
4
3
|
require 'redcarpet'
|
|
@@ -18,4 +17,14 @@ module Docwatch
|
|
|
18
17
|
end
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
require_relative 'docwatch/connection'
|
|
21
|
+
require_relative 'docwatch/logger'
|
|
22
|
+
require_relative 'docwatch/parser'
|
|
23
|
+
require_relative 'docwatch/parser/frontmatter'
|
|
24
|
+
require_relative 'docwatch/renderer'
|
|
25
|
+
require_relative 'docwatch/renderer/html'
|
|
26
|
+
require_relative 'docwatch/renderer/markdown'
|
|
27
|
+
require_relative 'docwatch/session'
|
|
28
|
+
require_relative 'docwatch/util/html'
|
|
29
|
+
require_relative 'docwatch/version'
|
|
30
|
+
require_relative 'docwatch/watcher'
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docwatch-bin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- crdx
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: colorize
|
|
@@ -80,20 +79,6 @@ dependencies:
|
|
|
80
79
|
- - "~>"
|
|
81
80
|
- !ruby/object:Gem::Version
|
|
82
81
|
version: '3.5'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: require_all
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - "~>"
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '3.0'
|
|
90
|
-
type: :runtime
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - "~>"
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '3.0'
|
|
97
82
|
- !ruby/object:Gem::Dependency
|
|
98
83
|
name: rouge
|
|
99
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -122,8 +107,6 @@ dependencies:
|
|
|
122
107
|
- - "~>"
|
|
123
108
|
- !ruby/object:Gem::Version
|
|
124
109
|
version: '13.0'
|
|
125
|
-
description:
|
|
126
|
-
email:
|
|
127
110
|
executables:
|
|
128
111
|
- docwatch
|
|
129
112
|
extensions: []
|
|
@@ -149,7 +132,6 @@ licenses:
|
|
|
149
132
|
- GPLv3
|
|
150
133
|
metadata:
|
|
151
134
|
rubygems_mfa_required: 'true'
|
|
152
|
-
post_install_message:
|
|
153
135
|
rdoc_options: []
|
|
154
136
|
require_paths:
|
|
155
137
|
- lib
|
|
@@ -164,8 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
164
146
|
- !ruby/object:Gem::Version
|
|
165
147
|
version: '0'
|
|
166
148
|
requirements: []
|
|
167
|
-
rubygems_version: 3.
|
|
168
|
-
signing_key:
|
|
149
|
+
rubygems_version: 3.6.9
|
|
169
150
|
specification_version: 4
|
|
170
151
|
summary: Preview markdown documents in the browser with reload on change
|
|
171
152
|
test_files: []
|