kdwatch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +21 -0
- data/bin/kdwatch +27 -0
- data/kdwatch.gemspec +37 -0
- data/lib/kdwatch-app.rb +56 -0
- data/lib/kdwatch/version.rb +5 -0
- metadata +163 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc8f8c23c6efa56df70b322eb61dc16b913fdf1a93640d3de4da1feeadfba752
|
4
|
+
data.tar.gz: ab67e9ebabd65974a86d65f89a0ffc20af380a1806a13501fa6ecefb07076663
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c072cf5ae36599a794e6af8520f2fb0d4cb31d87441cec63c9e9137198bea04f4169b553a173787b1073759f04e27603f162b20ca8b0df745f24b2be4b1aa033
|
7
|
+
data.tar.gz: '012684f1584c8f9ddb902a52369510b137840d9a29bac34732cc1939821d6ae96f6598bd57eb925515f9715936935351aa123fd4c9f619c63976b99274e174fc'
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in kdwatch.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
|
11
|
+
gem "thin"
|
12
|
+
gem "guard-livereload", require: false
|
13
|
+
gem "rack-livereload"
|
14
|
+
gem "guard"
|
15
|
+
gem "sinatra"
|
16
|
+
gem "kramdown-rfc2629"
|
17
|
+
gem "net-http-persistent"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Carsten Bormann
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/bin/kdwatch
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
ENV["LANG"]="en_US.utf-8"
|
3
|
+
ENV["LC_CTYPE"]="en_US.utf-8"
|
4
|
+
ENV["KRAMDOWN_PERSISTENT"]="yes"
|
5
|
+
|
6
|
+
if ARGV == []
|
7
|
+
ARGV.replace Dir["draft-*.md"]
|
8
|
+
warn_replace = 1
|
9
|
+
end
|
10
|
+
|
11
|
+
if ARGV.size != 1
|
12
|
+
warn "** Usage: #$0 [draft-foo.md]"
|
13
|
+
warn "** More than one draft file found #{ARGV.inspect}" if warn_replace
|
14
|
+
warn "** Please select one for watching." if warn_replace
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
ENV["KD_WATCH_SRC"] = ARGV[0]
|
19
|
+
|
20
|
+
File.write(".config.ru", <<HERE)
|
21
|
+
require 'rack-livereload'
|
22
|
+
use Rack::LiveReload, min_delay: 500, source: :vendored, no_swf: true
|
23
|
+
require 'kdwatch-app.rb'
|
24
|
+
run Sinatra::Application
|
25
|
+
HERE
|
26
|
+
|
27
|
+
exec("rackup -E production -s thin -p 7991 .config.ru")
|
data/kdwatch.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/kdwatch/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "kdwatch"
|
7
|
+
spec.version = Kdwatch::VERSION
|
8
|
+
spec.authors = ["Carsten Bormann"]
|
9
|
+
spec.email = ["cabo@tzi.org"]
|
10
|
+
|
11
|
+
spec.summary = "kdwatch: open auto-reloaded HTML for kramdown-rfc in a browser."
|
12
|
+
spec.description = "kdwatch: open auto-reloaded HTML for kramdown-rfc in a browser."
|
13
|
+
spec.homepage = "https://github.com/cabo/kdwatch"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
16
|
+
|
17
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
18
|
+
|
19
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
21
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.executables = ['kdwatch']
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "bundler", '~> 2.2'
|
30
|
+
spec.add_dependency "thin", '~> 1.8'
|
31
|
+
spec.add_dependency "guard-livereload", '~> 2.5' #, require: false
|
32
|
+
spec.add_dependency "rack-livereload", '~> 0.3'
|
33
|
+
spec.add_dependency "guard", '~> 2.17'
|
34
|
+
spec.add_dependency "sinatra", '~> 2.1'
|
35
|
+
spec.add_dependency "kramdown-rfc2629", '~> 1.4'
|
36
|
+
spec.add_dependency "net-http-persistent", '~> 4.0'
|
37
|
+
end
|
data/lib/kdwatch-app.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative "kdwatch/version"
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
# Bundler.require
|
5
|
+
require "bundler"
|
6
|
+
require "thin"
|
7
|
+
# require "guard-livereload"
|
8
|
+
require "rack-livereload"
|
9
|
+
require "guard"
|
10
|
+
require "sinatra"
|
11
|
+
require "kramdown-rfc2629"
|
12
|
+
require "net/http/persistent"
|
13
|
+
|
14
|
+
|
15
|
+
sfn = ENV["KD_WATCH_SRC"]
|
16
|
+
fail "No source given" unless sfn
|
17
|
+
|
18
|
+
dfn = File.join(File.dirname(sfn), "#{File.basename(sfn, ".*")}.html")
|
19
|
+
|
20
|
+
puts dfn
|
21
|
+
|
22
|
+
get "/" do
|
23
|
+
sfc = File.stat(sfn).ctime
|
24
|
+
dfc = File.stat(dfn).ctime rescue Time.at(0)
|
25
|
+
if sfc > dfc
|
26
|
+
warn "Rebuilding..."
|
27
|
+
system("time kdrfc -3h --no-txt #{sfn}")
|
28
|
+
warn "...done"
|
29
|
+
end
|
30
|
+
File.read(dfn)
|
31
|
+
end
|
32
|
+
|
33
|
+
get "/metadata.min.js" do
|
34
|
+
# insert reload script here!
|
35
|
+
end
|
36
|
+
|
37
|
+
get "/rfc-local.css" do
|
38
|
+
# insert local css here
|
39
|
+
end
|
40
|
+
|
41
|
+
File.write(".Guardfile", <<GF)
|
42
|
+
guard 'livereload' do
|
43
|
+
watch("#{sfn}")
|
44
|
+
end
|
45
|
+
GF
|
46
|
+
|
47
|
+
rd, _wr = IO.pipe
|
48
|
+
spawn("guard -G .Guardfile", in: rd)
|
49
|
+
|
50
|
+
# wrong: puts settings.port
|
51
|
+
|
52
|
+
url = "http://127.0.0.1:7991"
|
53
|
+
|
54
|
+
spawn("sleep 5; open #{url} || xdg-open #{url} || echo @@@ Please open #{url}")
|
55
|
+
|
56
|
+
|
metadata
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kdwatch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carsten Bormann
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thin
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-livereload
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.5'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-livereload
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.17'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.17'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sinatra
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: kramdown-rfc2629
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.4'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.4'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: net-http-persistent
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '4.0'
|
125
|
+
description: 'kdwatch: open auto-reloaded HTML for kramdown-rfc in a browser.'
|
126
|
+
email:
|
127
|
+
- cabo@tzi.org
|
128
|
+
executables:
|
129
|
+
- kdwatch
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- Gemfile
|
135
|
+
- LICENSE.txt
|
136
|
+
- bin/kdwatch
|
137
|
+
- kdwatch.gemspec
|
138
|
+
- lib/kdwatch-app.rb
|
139
|
+
- lib/kdwatch/version.rb
|
140
|
+
homepage: https://github.com/cabo/kdwatch
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.4.0
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubygems_version: 3.2.15
|
160
|
+
signing_key:
|
161
|
+
specification_version: 4
|
162
|
+
summary: 'kdwatch: open auto-reloaded HTML for kramdown-rfc in a browser.'
|
163
|
+
test_files: []
|