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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e525886a59746464f8ba5986e89bdcb343acbd1a96378bb56521f8e20bcf0288
4
- data.tar.gz: a6829868d17db749392a11db8418519298e80bbfa386add54e2258bf72e59079
3
+ metadata.gz: 536d516bf8d5d6bce8771014f6b67aeb01d0762635334e6aaa4ea043aa7e6721
4
+ data.tar.gz: 0a7816f53dee0354d6d233779bae96a979421465caa9a191f84870bf8e9f0b9f
5
5
  SHA512:
6
- metadata.gz: e7e12d6b4188d3d29964d9c842bad38454c383aec54b2a55d38fe8ace8de68a21065abb7f1ade4cabe5ec88263d4790d1d3a8e63bccb40bd3bc4ee22f7095172
7
- data.tar.gz: 270e381c2bbf7f2b28ecfbfccc407050a6aab5ed2c44342ba0f60a2c16d0227f00d33d8ba14be11e4820e27b60c085af83e039be2cd777fd7c54e9fb3bed641f
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
- DOCS = <<~EOF
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
- App.run(Docopt::docopt(DOCS, help: false))
125
+ Main.run(Docopt::docopt(docs, version: VERSION))
133
126
  rescue Docopt::Exit => e
134
- puts 'Invalid arguments.'.red
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.root
11
+ def self.root_dir
14
12
  File.expand_path('../..', __FILE__)
15
13
  end
16
14
  end
15
+
16
+ require_rel 'docwatch'
@@ -1,9 +1,8 @@
1
1
  module Docwatch
2
2
  class Connection
3
- def initialize(renderer, watcher, logger, session)
3
+ def initialize(renderer, watcher, session)
4
4
  @renderer = renderer
5
5
  @watcher = watcher
6
- @logger = logger
7
6
  @session = session
8
7
  end
9
8
 
@@ -18,7 +18,7 @@ module Docwatch
18
18
  end
19
19
 
20
20
  def js
21
- File.read(Docwatch.root + '/res/inject.js')
21
+ File.read(Docwatch.root_dir + '/res/inject.js')
22
22
  end
23
23
 
24
24
  def to_html
@@ -1,3 +1,3 @@
1
1
  module Docwatch
2
- VERSION = "1.0.8"
2
+ VERSION = "1.0.9"
3
3
  end
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.8
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-19 00:00:00.000000000 Z
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: colorize
28
+ name: redcarpet
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.1
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: 0.8.1
40
+ version: '3.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: docopt
42
+ name: colorize
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.1
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.6.1
54
+ version: 0.8.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: redcarpet
56
+ name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.5'
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: '3.5'
68
+ version: '1.10'
69
69
  - !ruby/object:Gem::Dependency
70
- name: nokogiri
70
+ name: docopt
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.10'
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: '1.10'
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: preview markdown documents in the browser with reload on change
165
+ summary: Preview markdown documents in the browser with reload on change
166
166
  test_files: []