sdoc_live 0.1.6 → 0.1.8
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/README.md +5 -5
- data/lib/sdoc_live/engine.rb +27 -1
- data/lib/sdoc_live/generator.rb +1 -1
- data/lib/sdoc_live/version.rb +1 -1
- 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: 2c58eaf82f18b4feb7c431156e8ba8be018e22eb57b8b62d69e0e0c503e2085c
|
|
4
|
+
data.tar.gz: 372965feda50bdc4bc08b196d3acbbc43af6fe2b7fb4461b622bbb4f80c0befa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 224cc2e187603628bb1e76664ef87ff8f6c33640d34512d38e7f262b1e96490a3e05dc07ed2cc08f78e372adf8a016bae6c55199f2a9de3c57ebbcc1ea2e5bfb
|
|
7
|
+
data.tar.gz: dc1222d122c5992e1e9505e752305a28b164b0d55dff3bbdc3f3b19aae4d630c76d6940be15fd45201426e1c548172bea7722b61cf6f3f95eb4ffec2ef02c2f2
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SDoc Live
|
|
2
2
|
|
|
3
|
-
Live SDoc generation for Rails — watches your source files and auto-regenerates API documentation on changes. Serves docs
|
|
3
|
+
Live SDoc generation for Rails — watches your source files and auto-regenerates API documentation on changes. Serves docs via a mountable engine at a path you choose (e.g. `/doc`).
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
@@ -72,8 +72,8 @@ SdocLive.configure do |config|
|
|
|
72
72
|
# Regex for file types that trigger regeneration (default: /\.rb$/)
|
|
73
73
|
# config.watch_file_type_regex = /\.(rb|md)$/
|
|
74
74
|
|
|
75
|
-
# Override the output directory (default: Rails.root.join("
|
|
76
|
-
# config.output_dir = Rails.root.join("
|
|
75
|
+
# Override the output directory (default: Rails.root.join("tmp", "doc"))
|
|
76
|
+
# config.output_dir = Rails.root.join("tmp", "doc")
|
|
77
77
|
|
|
78
78
|
# Additional RDoc options passed to the SDoc generator
|
|
79
79
|
# config.rdoc_options = ["--all", "--hyperlink-all"]
|
|
@@ -84,8 +84,8 @@ end if defined?(SdocLive)
|
|
|
84
84
|
|
|
85
85
|
1. **Development**: Puma boots → forks a child process that runs `SdocLive::Generator#build_watch`
|
|
86
86
|
2. The `listen` gem monitors `app/` and `lib/` for `.rb` file changes
|
|
87
|
-
3. On change, SDoc regenerates documentation into `
|
|
88
|
-
4. Docs are
|
|
87
|
+
3. On change, SDoc regenerates documentation into `tmp/doc/`
|
|
88
|
+
4. Docs are served by the mounted engine (e.g. at `/doc`)
|
|
89
89
|
5. Clean subprocess management with bidirectional lifecycle monitoring (Puma ↔ SDoc)
|
|
90
90
|
|
|
91
91
|
## License
|
data/lib/sdoc_live/engine.rb
CHANGED
|
@@ -7,7 +7,7 @@ module SdocLive
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
initializer "sdoc_live.static" do |app|
|
|
10
|
-
doc_root = (SdocLive.configuration.output_dir || app.root.join("
|
|
10
|
+
doc_root = (SdocLive.configuration.output_dir || app.root.join("tmp", "doc")).to_s
|
|
11
11
|
|
|
12
12
|
SdocLive::Engine.routes.draw do
|
|
13
13
|
doc_app = ::Rack::Static.new(
|
|
@@ -21,6 +21,32 @@ module SdocLive
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
initializer "sdoc_live.trailing_slash", after: :add_routing_paths do |app|
|
|
25
|
+
mount_path = nil
|
|
26
|
+
|
|
27
|
+
app.routes.routes.each do |route|
|
|
28
|
+
if route.app.respond_to?(:app) && route.app.app == SdocLive::Engine
|
|
29
|
+
mount_path = route.path.spec.to_s.gsub("(.:format)", "").chomp("/")
|
|
30
|
+
break
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if mount_path && !mount_path.empty?
|
|
35
|
+
app.middleware.use(Class.new do
|
|
36
|
+
define_method(:initialize) { |a| @app = a }
|
|
37
|
+
|
|
38
|
+
define_method(:call) do |env|
|
|
39
|
+
if env["PATH_INFO"] == mount_path && !env["PATH_INFO"].end_with?("/")
|
|
40
|
+
query = env["QUERY_STRING"].to_s.empty? ? "" : "?#{ env['QUERY_STRING'] }"
|
|
41
|
+
[301, { "location" => "#{ mount_path }/#{ query }", "content-type" => "text/html" }, ["Redirecting..."]]
|
|
42
|
+
else
|
|
43
|
+
@app.call(env)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
24
50
|
end
|
|
25
51
|
|
|
26
52
|
end
|
data/lib/sdoc_live/generator.rb
CHANGED
data/lib/sdoc_live/version.rb
CHANGED