kdwatch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/kdwatch +45 -5
- data/lib/kdwatch-app.rb +1 -1
- data/lib/kdwatch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaba18036cbe879e4f88d5b74513ad4a5d36abb843234c83c35e688aaaf36e03
|
4
|
+
data.tar.gz: ea272b95fef2f02ec9513539dee9f4f5126b4e65c3c6a97b0603d94fa7cd37e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 603817fcb75e8b474a4f6bc7d58408c4d8fcc55f7cbd50d1cd6a48f8d21a8b2672f2b221697b9948412e2bf4825dd9925ae10f9a4be6a6360e7c5e54c94c9471
|
7
|
+
data.tar.gz: 4237a7b045723de06320999301e0c388d879d6f5016b12c7170702b7b24981e302848eb76aad46513cde1a0d37792811165710c865a9cb597064dca17a54eed5
|
data/bin/kdwatch
CHANGED
@@ -3,15 +3,55 @@ ENV["LANG"]="en_US.utf-8"
|
|
3
3
|
ENV["LC_CTYPE"]="en_US.utf-8"
|
4
4
|
ENV["KRAMDOWN_PERSISTENT"]="yes"
|
5
5
|
|
6
|
+
KDWATCH_PORT = 7991 # currently unregistered...
|
7
|
+
|
8
|
+
## -r: Kill any previous kdwatch and continue ("restart")
|
9
|
+
## -e: Kill any previous kdwatch and exit
|
10
|
+
if ARGV[0] == "-e" || ARGV[0] == "-r"
|
11
|
+
require 'open3'
|
12
|
+
|
13
|
+
status = 1
|
14
|
+
flag = ARGV.shift
|
15
|
+
|
16
|
+
stdout_str, stderr_str, s = Open3.capture3("lsof -ti :#{KDWATCH_PORT} -s TCP:LISTEN")
|
17
|
+
pids = if s.success? && stdout_str =~ /\A[0-9\s]*\z/ && stderr_str
|
18
|
+
stdout_str.split
|
19
|
+
else
|
20
|
+
text = stdout_str + stderr_str
|
21
|
+
warn "** lsof, status #{s}, says: #{text}" if text != "" || s.exitstatus != 1
|
22
|
+
[]
|
23
|
+
end
|
24
|
+
if pids == []
|
25
|
+
warn "** Nothing listening on kdwatch port" unless flag == "-r"
|
26
|
+
elsif pids.size != 1
|
27
|
+
warn "** More than one process listening on kdwatch port, nothing done"
|
28
|
+
else
|
29
|
+
begin
|
30
|
+
status = Process.kill(2, Integer(pids[0])) - 1 # should be 1 for 1 kill, exit 0 then
|
31
|
+
rescue Errno => e
|
32
|
+
warn "** #{pids[0]}: #{e.inspect}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
exit(status) if flag == "-e"
|
36
|
+
end
|
37
|
+
|
38
|
+
## Find an .mkd or a draft-*.md (excluding README.md and such)
|
6
39
|
if ARGV == []
|
7
|
-
ARGV.replace Dir["draft-*.md"]
|
40
|
+
ARGV.replace Dir.glob(["draft-*.md", "*.mkd"])
|
8
41
|
warn_replace = 1
|
9
42
|
end
|
10
43
|
|
11
44
|
if ARGV.size != 1
|
12
|
-
warn "** Usage: #$0 [draft-foo.md]"
|
13
|
-
warn "**
|
14
|
-
|
45
|
+
warn "** Usage: #$0 [-r] [draft-foo.md]"
|
46
|
+
warn "** #$0 -e"
|
47
|
+
if warn_replace
|
48
|
+
if ARGV.size > 1
|
49
|
+
warn "** More than one draft file found #{ARGV.inspect}"
|
50
|
+
warn "** Please select one for watching."
|
51
|
+
else
|
52
|
+
warn "** No draft file draft-*.md or *.mkd found."
|
53
|
+
end
|
54
|
+
end
|
15
55
|
exit 1
|
16
56
|
end
|
17
57
|
|
@@ -24,4 +64,4 @@ require 'kdwatch-app.rb'
|
|
24
64
|
run Sinatra::Application
|
25
65
|
HERE
|
26
66
|
|
27
|
-
exec("rackup -E production -s thin -p
|
67
|
+
exec("rackup -E production -s thin -p #{KDWATCH_PORT} .config.ru")
|
data/lib/kdwatch-app.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.1
|
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-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|