docwatch-bin 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/docwatch +24 -31
- data/lib/docwatch.rb +6 -6
- data/lib/docwatch/connection.rb +1 -2
- data/lib/docwatch/renderer.rb +1 -1
- data/lib/docwatch/version.rb +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 536d516bf8d5d6bce8771014f6b67aeb01d0762635334e6aaa4ea043aa7e6721
|
4
|
+
data.tar.gz: 0a7816f53dee0354d6d233779bae96a979421465caa9a191f84870bf8e9f0b9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cce30488feeb53ea54e66ef4abe39e44f2a9dd163c78a97660b127d9ab436c27ffef559b4d0b48ad70c0a02f07367520ad297ff0055c106dffaab615d9807703
|
7
|
+
data.tar.gz: 9140ec6b8f178b8c096953970c082a8a5331c881c0a4b6ee035a6cd6b51fa14d03783b236ed6655835d82b241baeccdba2461ff7ad176d2be3d35275f4624f6c
|
data/bin/docwatch
CHANGED
@@ -2,28 +2,7 @@
|
|
2
2
|
require_relative '../lib/docwatch'
|
3
3
|
include Docwatch
|
4
4
|
|
5
|
-
|
6
|
-
#{'Usage:'.bold}
|
7
|
-
#{File.basename($0)} [options] [<file-path>]
|
8
|
-
|
9
|
-
#{'Options:'.bold}
|
10
|
-
-p, --port=VALUE Listen port [default: 8888]
|
11
|
-
-v, --verbose Verbose
|
12
|
-
-h, --help Help
|
13
|
-
-V, --version Version
|
14
|
-
|
15
|
-
#{'Renderers:'.bold}
|
16
|
-
markdown (.md)
|
17
|
-
html (.html)
|
18
|
-
|
19
|
-
If #{'--port'.bold} is #{'random'.bold} a random port will be chosen, otherwise
|
20
|
-
the specified one will be used. The default is 8888.
|
21
|
-
|
22
|
-
In #{'--verbose'.bold} mode, incoming HTTP requests and file change event
|
23
|
-
notifications will be printed to standard output.
|
24
|
-
EOF
|
25
|
-
|
26
|
-
class App
|
5
|
+
class Main
|
27
6
|
def initialize(opts)
|
28
7
|
@opts = opts
|
29
8
|
end
|
@@ -68,11 +47,6 @@ class App
|
|
68
47
|
exit 0
|
69
48
|
end
|
70
49
|
|
71
|
-
def exit_invalid_arguments
|
72
|
-
puts 'Invalid arguments'.red
|
73
|
-
exit 1
|
74
|
-
end
|
75
|
-
|
76
50
|
def exit_invalid_file
|
77
51
|
puts 'File does not exist: %s'.red % params.file_path
|
78
52
|
exit 2
|
@@ -90,7 +64,6 @@ class App
|
|
90
64
|
def run
|
91
65
|
exit_version if params.version
|
92
66
|
exit_usage if params.help
|
93
|
-
exit_invalid_arguments unless params.file_path
|
94
67
|
exit_invalid_file unless File.exist?(params.file_path)
|
95
68
|
exit_invalid_port unless port_valid
|
96
69
|
|
@@ -107,7 +80,6 @@ class App
|
|
107
80
|
Connection.handle(
|
108
81
|
renderer,
|
109
82
|
watcher,
|
110
|
-
logger,
|
111
83
|
Session.new(socket, logger)
|
112
84
|
)
|
113
85
|
end
|
@@ -128,9 +100,30 @@ class App
|
|
128
100
|
end
|
129
101
|
end
|
130
102
|
|
103
|
+
docs = <<~EOF
|
104
|
+
#{'Usage:'.bold}
|
105
|
+
#{File.basename($0)} [options] <file-path>
|
106
|
+
|
107
|
+
#{'Options:'.bold}
|
108
|
+
-p, --port=VALUE Listen port [default: 8888]
|
109
|
+
-v, --verbose Be verbose
|
110
|
+
-V, --version Show version
|
111
|
+
-h, --help Show this help
|
112
|
+
|
113
|
+
#{'Renderers:'.bold}
|
114
|
+
markdown (.md)
|
115
|
+
html (.html)
|
116
|
+
|
117
|
+
If #{'--port'.bold} is #{'random'.bold} a random port will be chosen, otherwise
|
118
|
+
the specified one will be used. The default is 8888.
|
119
|
+
|
120
|
+
In #{'--verbose'.bold} mode, incoming HTTP requests and file change event
|
121
|
+
notifications will be printed to standard output.
|
122
|
+
EOF
|
123
|
+
|
131
124
|
begin
|
132
|
-
|
125
|
+
Main.run(Docopt::docopt(docs, version: VERSION))
|
133
126
|
rescue Docopt::Exit => e
|
134
|
-
puts
|
127
|
+
puts e.message
|
135
128
|
exit 1
|
136
129
|
end
|
data/lib/docwatch.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'require_all'
|
2
|
-
require 'colorize'
|
3
|
-
require 'docopt'
|
4
2
|
require 'redcarpet'
|
3
|
+
require 'colorize'
|
5
4
|
require 'nokogiri'
|
5
|
+
require 'docopt'
|
6
6
|
|
7
|
-
require 'socket'
|
8
7
|
require 'ostruct'
|
9
|
-
|
10
|
-
require_rel 'docwatch'
|
8
|
+
require 'socket'
|
11
9
|
|
12
10
|
module Docwatch
|
13
|
-
def self.
|
11
|
+
def self.root_dir
|
14
12
|
File.expand_path('../..', __FILE__)
|
15
13
|
end
|
16
14
|
end
|
15
|
+
|
16
|
+
require_rel 'docwatch'
|
data/lib/docwatch/connection.rb
CHANGED
data/lib/docwatch/renderer.rb
CHANGED
data/lib/docwatch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docwatch-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crdx
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require_all
|
@@ -25,61 +25,61 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: redcarpet
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '3.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '3.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.8.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.8.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.10'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: docopt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.6.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.6.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,5 +162,5 @@ requirements: []
|
|
162
162
|
rubygems_version: 3.0.6
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
|
-
summary:
|
165
|
+
summary: Preview markdown documents in the browser with reload on change
|
166
166
|
test_files: []
|