kdwatch 0.2.0 → 0.3.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/.gitignore +1 -0
- data/README.md +42 -26
- data/kdwatch.gemspec +1 -1
- data/lib/kdwatch-app.rb +13 -2
- data/lib/kdwatch/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a061720f05736d7be0f68e3e18887c799f94bdc5d83be4ac0b0553f7f65b822
|
4
|
+
data.tar.gz: 66ba9346da80aa7a1587baa978163290c59f3f3f6255964fae1a2a89913c3047
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a42cd6df0ec3c6c8562ab41809d7676162d08dd1b34993f4e3aa8010d1edbe4930bb94507489176996f15c55b7e43d4b29642913a8305e157d009bf5dc0567cb
|
7
|
+
data.tar.gz: 50856210e599e8aa2e37af01da0e6173a349cd3d94858c3ff90f4b9b1ad5510a403fb11248f0f0fbe0f4a5c132a088c891a5412a5bdf0a90f6148a0490789302
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -14,8 +14,9 @@ $ gem install kdwatch
|
|
14
14
|
|
15
15
|
* For some reason, the initial `gem install` takes a couple of minutes,
|
16
16
|
during the first few of which it may seem nothing happens.
|
17
|
-
* If the above `pip3` doesn't work: in a pinch, kdrfc will
|
18
|
-
web service for xml2rfc processing (but that may be a
|
17
|
+
* If the above `pip3` doesn't work, no problem: in a pinch, kdrfc will
|
18
|
+
use the IETF web service for xml2rfc processing (but that may be a
|
19
|
+
bit slower).
|
19
20
|
* Depending on system configuration, add `sudo` (but don't if it isn't
|
20
21
|
actually needed).
|
21
22
|
|
@@ -29,7 +30,7 @@ $ gem install kdwatch
|
|
29
30
|
$ kdwatch
|
30
31
|
```
|
31
32
|
|
32
|
-
After about 10 seconds, a browser will open (or an error message will
|
33
|
+
* After about 10 seconds, a browser will open (or an error message will
|
33
34
|
pop up with the URL to use, which depends on the options given, but
|
34
35
|
defaults to <http://127.0.0.1:7991/>).
|
35
36
|
|
@@ -43,20 +44,18 @@ potential error messages, e.g., if you break the markdown in some way.
|
|
43
44
|
### There can only be one (per host/port)
|
44
45
|
|
45
46
|
There can only be one kdwatch active on each host and port. You will
|
46
|
-
need to specify a different port (or host!) to
|
47
|
-
|
47
|
+
need to specify a different port (or host!) to run more than one
|
48
|
+
kdwatch at the same time.
|
48
49
|
|
49
|
-
* `-o host` to select an address on the serving host (default: 127.0.0.1)
|
50
|
-
* `-i` as a shortcut for `-o ::`
|
51
50
|
* `-p port` to select a port number (default: 7991)
|
52
|
-
* `-1` to `6` as a shortcut for `-p 7991` to `-p 7996` (must be last
|
51
|
+
* `-1` to `6` as a shortcut for `-p 7991` (default) to `-p 7996` (must be last
|
53
52
|
option because of an idiosyncrasy of the optionparser library)
|
54
53
|
|
55
54
|
kdwatch has two flags to simplify handling servers that might be
|
56
55
|
accumulating on one host/port:
|
57
56
|
|
58
57
|
* `-e` to kill (SIGINT) any current holder of the port given and exit
|
59
|
-
* `-r` to do this, and to start a new instance
|
58
|
+
* `-r` to do this, and to start a new instance as well
|
60
59
|
|
61
60
|
So the most likely use is going to be:
|
62
61
|
|
@@ -64,40 +63,57 @@ So the most likely use is going to be:
|
|
64
63
|
kdwatch -r
|
65
64
|
```
|
66
65
|
|
67
|
-
or
|
68
|
-
many
|
66
|
+
or maybe
|
69
67
|
|
70
68
|
```
|
71
|
-
kdwatch -
|
69
|
+
kdwatch -r2
|
72
70
|
```
|
73
71
|
|
74
|
-
|
75
|
-
|
76
|
-
The fun thing with the `-i` option is that you can replace the local
|
77
|
-
URL by filling in the hostname of the laptop and use the resulting URL
|
78
|
-
on a different browser (e.g., `http://mylaptop.local:7991` on your iPad or
|
79
|
-
another laptop), and save some screen real-estate on your laptop.
|
72
|
+
for the second draft you are editing at the same time,
|
80
73
|
|
81
|
-
|
82
|
-
|
74
|
+
or, if your drafts are weirdly named or you need to select one out of
|
75
|
+
many
|
83
76
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
If you did, maybe `kdwatch -e` before going there!
|
77
|
+
```
|
78
|
+
kdwatch -r5 weird-draft.md
|
79
|
+
```
|
88
80
|
|
89
|
-
|
81
|
+
(Glitches are to be expected if you *start* more than one server out of
|
82
|
+
the same directory at the same instant; TODO; for now, wait 10 seconds
|
83
|
+
before starting another from the same directory.)
|
90
84
|
|
91
85
|
### 7991, haven't I heard that number before?
|
92
86
|
|
93
87
|
The default port number was chosen after [RFC 7991], the initial (no
|
94
88
|
longer really authoritative) version of the v3 RFCXML specification,
|
95
|
-
and the port shortcuts 1 to 6 point to further RFCs from this
|
89
|
+
and the port shortcuts 1 to 6 point to this and further RFCs from this
|
90
|
+
series.
|
96
91
|
(7997 is a particularly lame RFC, so it cannot be chosen by a
|
97
92
|
shortcut [actually: this port is already registered for something else].)
|
98
93
|
|
99
94
|
[RFC 7991]: https://rfc-editor.org/rfc/rfc7991.html
|
100
95
|
|
96
|
+
### kdwatch is a web server
|
97
|
+
|
98
|
+
kdwatch essentially is a web server and can listen on any host
|
99
|
+
interface you might have:
|
100
|
+
|
101
|
+
* `-o host` to select an interface address on the serving host (default: 127.0.0.1)
|
102
|
+
* `-i` as a shortcut for `-o :: ` (`i` stands for "on the Internet")
|
103
|
+
|
104
|
+
Unless used on 127.0.0.1 (or ::1), kdwatch is accessible to anyone who
|
105
|
+
can access your laptop over IP. That may be a security problem -- do
|
106
|
+
not specify a non-local interface unless you know you are not “on the
|
107
|
+
Internet” (or trust the way I cobble together software). If you are,
|
108
|
+
maybe `kdwatch -e` before going there!
|
109
|
+
|
110
|
+
The fun thing with the `-i` option is that you can replace the local
|
111
|
+
URL by filling in the hostname of the laptop and use the resulting URL
|
112
|
+
on a different browser (e.g., `http://mylaptop.local:7991` on your iPad or
|
113
|
+
another laptop), and save some screen real-estate on your laptop.
|
114
|
+
With a globally routable address, kdwatch even can be used for joint
|
115
|
+
viewing in a team.
|
116
|
+
|
101
117
|
## Feedback, please
|
102
118
|
|
103
119
|
This has only been tested on macOS and briefly on Linux. No idea about WSL.
|
data/kdwatch.gemspec
CHANGED
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency "rack-livereload", '~> 0.3'
|
34
34
|
spec.add_dependency "guard", '~> 2.17'
|
35
35
|
spec.add_dependency "sinatra", '~> 2.1'
|
36
|
-
spec.add_dependency "kramdown-rfc2629", '~> 1.
|
36
|
+
spec.add_dependency "kramdown-rfc2629", '~> 1.5'
|
37
37
|
spec.add_dependency "net-http-persistent", '~> 4.0'
|
38
38
|
end
|
data/lib/kdwatch-app.rb
CHANGED
@@ -9,6 +9,8 @@ require "rack-livereload"
|
|
9
9
|
require "guard"
|
10
10
|
require "sinatra"
|
11
11
|
require "kramdown-rfc2629"
|
12
|
+
ENV["KDRFC_PREPEND"] = "time"
|
13
|
+
require "kramdown-rfc/kdrfc-processor"
|
12
14
|
require "net/http/persistent"
|
13
15
|
|
14
16
|
host = ENV["KDWATCH_HOST"]
|
@@ -21,13 +23,22 @@ dfn = File.join(File.dirname(sfn), "#{File.basename(sfn, ".*")}.html")
|
|
21
23
|
|
22
24
|
puts dfn
|
23
25
|
|
26
|
+
kdrfc = KramdownRFC::KDRFC.new
|
27
|
+
kdrfc.options.v3 = true
|
28
|
+
kdrfc.options.html = true
|
29
|
+
|
24
30
|
get "/" do
|
25
31
|
sfc = File.stat(sfn).ctime
|
26
32
|
dfc = File.stat(dfn).ctime rescue Time.at(0)
|
27
33
|
if sfc > dfc
|
28
34
|
warn "Rebuilding..."
|
29
|
-
|
30
|
-
|
35
|
+
begin
|
36
|
+
kdrfc.process sfn
|
37
|
+
rescue StandardError => e
|
38
|
+
warn e.to_s
|
39
|
+
else
|
40
|
+
warn "...done"
|
41
|
+
end
|
31
42
|
end
|
32
43
|
File.read(dfn)
|
33
44
|
end
|
data/lib/kdwatch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kdwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.5'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.5'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: net-http-persistent
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
rubygems_version: 3.2.
|
160
|
+
rubygems_version: 3.2.22
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: 'kdwatch: open auto-reloaded HTML for kramdown-rfc in a browser.'
|