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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rakit/docfx.rb +18 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1df32ab5eaf41ff5b000ebeb8893a137b25b9d99d2620e528f67c973486eb412
4
- data.tar.gz: aac1f2243e54107dbb1686fba35d2e7e3a53064272a91ed07c4fbc1ca9818da1
3
+ metadata.gz: 673ff3ffd5ae281ae18e1eb3675c36790a1223af18a289147368cda18b36e951
4
+ data.tar.gz: 57f3ce6802fa881c7394854cb6f5a74a6abb7127d16f6e33b543ae17dcbac24b
5
5
  SHA512:
6
- metadata.gz: ef24f803a1e7361483201238adedf0d6bcd425b3f355774ba1e560c940b8bb531fa0170cf3fc7be6b71204b1f281b5a3812e39dd4c4cc6fd6313b688bb456705
7
- data.tar.gz: 0af3ed799d213fe132a9e7b516374b9ac64f4ea7695140ebb21c091d6e14b04062664e5ae96f2618ba2837ce15351e2e3ba86a4f07bf710daf7469370cc321ea
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - rakit