rakit 0.1.10 → 0.1.11
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/lib/rakit/docfx.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 673ff3ffd5ae281ae18e1eb3675c36790a1223af18a289147368cda18b36e951
|
|
4
|
+
data.tar.gz: 57f3ce6802fa881c7394854cb6f5a74a6abb7127d16f6e33b543ae17dcbac24b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 459d835233b5cacd0ed901c6d0bc260be06615e8cc590e33b56f7b126728ce17495231fa6884d6f0c3c6ad4a9ae0bdabf781e1ff494af20eca34ce5b8566fcb6
|
|
7
|
+
data.tar.gz: '06004494e61093017a0c621fac688b173c8bbff2c5fd964671c1d12c702df16cab081bcacc2f5cf55d26b4c0b0861445f2bb841fdf9129b9403a81213e75477f'
|
data/lib/rakit/docfx.rb
CHANGED
|
@@ -47,6 +47,24 @@ module Rakit
|
|
|
47
47
|
true
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
# Serve a built Docfx site with the Docfx CLI (blocks until server is stopped).
|
|
51
|
+
# @param output_dir [String] path to built site (e.g. artifacts/docfx)
|
|
52
|
+
# @param open_browser [Boolean] pass --open-browser to docfx serve (default true)
|
|
53
|
+
# @param port [Integer, nil] port for docfx serve (optional; docfx default if nil)
|
|
54
|
+
# @return [true] if docfx serve was invoked (process may still be running)
|
|
55
|
+
# @return [false] if Docfx not on PATH or output_dir missing
|
|
56
|
+
def serve(output_dir:, open_browser: true, port: nil)
|
|
57
|
+
output_dir = ::File.expand_path(output_dir)
|
|
58
|
+
return false unless ::File.directory?(output_dir)
|
|
59
|
+
bin = docfx_path
|
|
60
|
+
resolved = ::File.absolute_path?(bin) && ::File.executable?(bin) ? bin : which(bin)
|
|
61
|
+
return false unless resolved
|
|
62
|
+
args = [resolved, "serve", output_dir]
|
|
63
|
+
args << "--open-browser" if open_browser
|
|
64
|
+
args.concat(["-p", port.to_s]) if port && port.to_i.positive?
|
|
65
|
+
system(*args)
|
|
66
|
+
end
|
|
67
|
+
|
|
50
68
|
# @param source_dir [String] path to check
|
|
51
69
|
# @return [Boolean] true if docfx.json exists under source_dir
|
|
52
70
|
def valid_source?(source_dir)
|