elder_docs 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 53d1646bb49d2be38dcc43d646f38e63a257e31e3e49e7725ee5b856e88eebcc
4
+ data.tar.gz: 69f62037def7feea699bfbecf03b91b3769bc40321e86573f498f8bda2d41f8f
5
+ SHA512:
6
+ metadata.gz: 209001181a6d81f7eaebab82cf9a0b2df905ecc7b00b867bad810c7d20714bec87defd399a1ad58c683702359bcd2dcf46bbaaec08fa90f76c851389d76e1f9e
7
+ data.tar.gz: 1fd1fa84bb406777bc81cdb8121794cac0c0049cf0df3561615540f8bb3a19e8499561d32c5273d52bfa8d877132b2a18329aa62aea5df0c28914fd956c8d8b1
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ElderDocs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,145 @@
1
+ # ElderDocs
2
+
3
+ Interactive API documentation for Rails. Convert your OpenAPI spec into a beautiful, testable documentation site.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **Interactive API Explorer** - Test endpoints directly from docs
8
+ - 🎨 **Customizable UI** - Web-based configurator at `/docs/ui`
9
+ - 📖 **Guides & Articles** - Add custom documentation
10
+ - 🔐 **Multiple Auth Types** - Bearer, API Key, Basic, OAuth2
11
+ - ⚡ **Zero Config** - Works out of the box
12
+
13
+ ## Installation
14
+
15
+ Add to your `Gemfile`:
16
+
17
+ ```ruby
18
+ gem 'elder_docs'
19
+ ```
20
+
21
+ Then:
22
+
23
+ ```bash
24
+ bundle install
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ### 1. Create your OpenAPI file
30
+
31
+ Create `definitions.json` in your Rails root:
32
+
33
+ ```json
34
+ {
35
+ "openapi": "3.0.0",
36
+ "info": {
37
+ "title": "My API",
38
+ "version": "1.0.0"
39
+ },
40
+ "servers": [{"url": "https://api.example.com"}],
41
+ "paths": {
42
+ "/users": {
43
+ "get": {
44
+ "summary": "List users",
45
+ "responses": {
46
+ "200": {"description": "Success"}
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### 2. Create articles (optional)
55
+
56
+ Create `articles.json`:
57
+
58
+ ```json
59
+ [
60
+ {
61
+ "id": "getting_started",
62
+ "title": "Getting Started",
63
+ "markdown_content": "## Welcome\n\nYour guide here..."
64
+ }
65
+ ]
66
+ ```
67
+
68
+ ### 3. Generate docs
69
+
70
+ ```bash
71
+ bundle exec elderdocs deploy
72
+ ```
73
+
74
+ ### 4. Mount in routes
75
+
76
+ ```ruby
77
+ # config/routes.rb
78
+ mount ElderDocs::Engine, at: '/docs'
79
+ ```
80
+
81
+ ### 5. Visit
82
+
83
+ Open `http://localhost:3000/docs` 🎉
84
+
85
+ ## Customize UI
86
+
87
+ Visit `/docs/ui` to customize fonts, colors, and styling with a visual editor.
88
+
89
+ **Default password:** `admin` (or set `admin_password` in `elderdocs.yml`)
90
+
91
+ ## Configuration
92
+
93
+ Create `elderdocs.yml` in your Rails root:
94
+
95
+ ```yaml
96
+ # API server URL
97
+ api_server: https://api.example.com
98
+
99
+ # Multiple environments
100
+ api_servers:
101
+ - url: https://api-sandbox.example.com
102
+ description: Sandbox
103
+ - url: https://api.example.com
104
+ description: Production
105
+
106
+ # Authentication types
107
+ auth_types:
108
+ - bearer
109
+ - api_key
110
+ - basic
111
+ - oauth2
112
+
113
+ # UI customization (or use /docs/ui)
114
+ ui:
115
+ font_heading: 'Syne'
116
+ font_body: 'IBM Plex Sans'
117
+ colors:
118
+ primary: '#f8d447'
119
+ secondary: '#000000'
120
+ background: '#ffffff'
121
+ surface: '#ffffff'
122
+ corner_radius: '0px'
123
+
124
+ # Admin password for /docs/ui
125
+ admin_password: your-secure-password
126
+ ```
127
+
128
+ ## CLI Options
129
+
130
+ ```bash
131
+ bundle exec elderdocs deploy \
132
+ --definitions custom.json \
133
+ --articles guides.json \
134
+ --api-server https://api.example.com
135
+ ```
136
+
137
+ ## Requirements
138
+
139
+ - Ruby >= 2.7.0
140
+ - Rails >= 6.0
141
+ - Node.js >= 16.0 (for building assets)
142
+
143
+ ## License
144
+
145
+ MIT
@@ -0,0 +1,49 @@
1
+ # ElderDocs Configuration File
2
+ # Copy this to elderdocs.yml in your Rails root directory
3
+
4
+ # Mount path for the documentation (default: /docs)
5
+ # If /docs is already taken, ElderDocs will try: /api-docs, /documentation, /api, /docs/api
6
+ mount_path: /docs
7
+
8
+ # Admin password for UI configuration page (/docs/ui)
9
+ # Default: 'admin' (or set via ELDERDOCS_ADMIN_PASSWORD environment variable)
10
+ # admin_password: your-secure-password-here
11
+
12
+ # Default API server URL (overrides OpenAPI servers if set)
13
+ # Leave empty to use the first server from your OpenAPI spec
14
+ # api_server: https://api.example.com
15
+
16
+ # Or define multiple environments:
17
+ # api_servers:
18
+ # - url: https://api-sandbox.example.com
19
+ # description: Sandbox
20
+ # - url: https://api.example.com
21
+ # description: Production
22
+
23
+ # Supported authentication types
24
+ # Options: bearer, api_key, basic, oauth2
25
+ auth_types:
26
+ - bearer
27
+ - api_key
28
+ - basic
29
+ - oauth2
30
+
31
+ # UI Customization
32
+ # Customize fonts, colors, and button styles
33
+ ui:
34
+ # Font families for headings and body text
35
+ # Available fonts: Syne, Inter, Space Grotesk, Oswald, Fira Code, Roboto, Open Sans, IBM Plex Sans
36
+ font_heading: 'Syne' # Font for headings, buttons, and UI elements
37
+ font_body: 'IBM Plex Sans' # Font for body text and content
38
+
39
+ # Color palette
40
+ colors:
41
+ primary: '#f8d447' # Primary accent color (buttons, highlights) - Bright Yellow
42
+ secondary: '#000000' # Secondary color (text, borders) - Black
43
+ background: '#ffffff' # Page background color - White
44
+ surface: '#ffffff' # Panel/Card background color - White
45
+
46
+ # Corner radius for all UI elements (buttons, cards, inputs)
47
+ # Examples: '0px' (sharp corners), '8px' (rounded), '99px' (pill-shaped)
48
+ corner_radius: '0px'
49
+
data/exe/elderdocs ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/elder_docs'
5
+
6
+ ElderDocs::CLI.start(ARGV)
7
+