utopia-project 0.34.0 → 0.35.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/utopia/project/agent/context.rb +23 -12
- data/bake/utopia/project/readme/update.rb +4 -14
- data/context/getting-started.md +4 -2
- data/context/github-pages-integration.md +59 -9
- data/context/index.yaml +16 -11
- data/lib/utopia/project/base.rb +14 -0
- data/lib/utopia/project/guide.rb +25 -0
- data/lib/utopia/project/version.rb +1 -1
- data/readme.md +7 -3
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce836aa13bef0faf0023d66ba3c5fcb0dca6447e872df581110221fe38ba5991
|
4
|
+
data.tar.gz: 191dba3b66205f9bf29b4095d53681a70c1a9db1d00698ebacc0a38878306295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89c0377b952cd09fafb222248c25bb4d4e16a3a068ce40099c0106bd3ef623321fc5bbedb24e226e24d3ed2aaad13137f4d5d69093ea5520906b93cbd320e43a
|
7
|
+
data.tar.gz: fa29db6a3865b528aeef22bd187db14c9cd737efcd6f8fc202d47857e4b4d3454e19794937e40c1d4ec410010007e3bb2fe9a72c89eafe0da602fe382d63c144
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -14,28 +14,39 @@ def update
|
|
14
14
|
project = Utopia::Project::Base.new(context.root)
|
15
15
|
|
16
16
|
FileUtils.mkdir_p self.context_root
|
17
|
-
|
17
|
+
files = []
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
# Sort guides by order, then by name
|
20
|
+
sorted_guides = project.guides.select(&:readme?).sort
|
21
|
+
|
22
|
+
sorted_guides.each do |guide|
|
23
|
+
FileUtils.cp guide.readme_path, self.context_path_for(guide)
|
24
|
+
files << {
|
25
|
+
"path" => guide.name + ".md",
|
26
|
+
"title" => guide.title,
|
27
|
+
"description" => guide.description.to_markdown.chomp,
|
28
|
+
}
|
28
29
|
end
|
29
30
|
|
30
|
-
if
|
31
|
+
if files.any?
|
32
|
+
# Create index in agent-context compatible format
|
33
|
+
gemspec = project.gemspec
|
34
|
+
index = {
|
35
|
+
"description" => gemspec&.summary,
|
36
|
+
"metadata" => gemspec&.metadata || {},
|
37
|
+
"files" => files,
|
38
|
+
}
|
39
|
+
|
31
40
|
File.open(self.context_index_path, "w") do |file|
|
32
41
|
file.puts "# Automatically generated context index for Utopia::Project guides."
|
33
42
|
file.puts "# Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`."
|
34
43
|
YAML.dump(index, file)
|
35
44
|
end
|
45
|
+
|
46
|
+
return index
|
36
47
|
end
|
37
48
|
|
38
|
-
return
|
49
|
+
return nil
|
39
50
|
end
|
40
51
|
|
41
52
|
private
|
@@ -13,7 +13,7 @@ def update(path: "readme.md", documentation_url: nil)
|
|
13
13
|
project = Utopia::Project::Base.new(context.root)
|
14
14
|
readme = project.readme_document
|
15
15
|
|
16
|
-
documentation_url ||= public_documentation_url
|
16
|
+
documentation_url ||= public_documentation_url(project)
|
17
17
|
|
18
18
|
readme.replace_section("Usage") do |header|
|
19
19
|
current = header
|
@@ -42,25 +42,15 @@ private
|
|
42
42
|
|
43
43
|
Scope = Struct.new(:documentation_url, :project)
|
44
44
|
|
45
|
-
def gemspec_path
|
46
|
-
Dir.glob("*.gemspec", base: context.root).first
|
47
|
-
end
|
48
|
-
|
49
|
-
def gemspec
|
50
|
-
if gemspec_path = self.gemspec_path
|
51
|
-
@gemspec ||= ::Gem::Specification.load(gemspec_path)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
45
|
# The public documentation URL if it can be determined.
|
56
|
-
def public_documentation_url
|
57
|
-
if metadata = gemspec
|
46
|
+
def public_documentation_url(project)
|
47
|
+
if metadata = project.gemspec&.metadata
|
58
48
|
if documentation_uri = metadata["documentation_uri"]
|
59
49
|
return documentation_uri
|
60
50
|
end
|
61
51
|
end
|
62
52
|
|
63
|
-
return gemspec&.homepage
|
53
|
+
return project.gemspec&.homepage
|
64
54
|
end
|
65
55
|
|
66
56
|
def usage_section(documentation_url, project)
|
data/context/getting-started.md
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
# Getting Started
|
2
2
|
|
3
|
-
This guide explains how to use `utopia-project`
|
3
|
+
This guide explains how to use `utopia-project` to add documentation to your project.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Add the gem to your project:
|
8
8
|
|
9
9
|
~~~ bash
|
10
10
|
$ bundle add utopia-project
|
11
11
|
~~~
|
12
12
|
|
13
|
+
## Usage
|
14
|
+
|
13
15
|
## Start Local Server
|
14
16
|
|
15
17
|
Start the local server to preview documentation:
|
@@ -1,17 +1,67 @@
|
|
1
1
|
# GitHub Pages Integration
|
2
2
|
|
3
|
-
This guide shows you how to use `utopia-project` with GitHub Pages.
|
3
|
+
This guide shows you how to use `utopia-project` with GitHub Pages to deploy documentation.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Enable GitHub Pages
|
6
6
|
|
7
|
-
|
7
|
+
In your GitHub project settings, you will need to [enable GitHub Pages from a custom GitHub Actions workflow](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow). Then, use the workflow below to publish the documentation:
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
~~~
|
9
|
+
```yaml
|
10
|
+
name: Documentation
|
12
11
|
|
13
|
-
|
12
|
+
on:
|
13
|
+
push:
|
14
|
+
branches:
|
15
|
+
- main
|
14
16
|
|
15
|
-
|
17
|
+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages:
|
18
|
+
permissions:
|
19
|
+
contents: read
|
20
|
+
pages: write
|
21
|
+
id-token: write
|
22
|
+
|
23
|
+
# Allow one concurrent deployment:
|
24
|
+
concurrency:
|
25
|
+
group: "pages"
|
26
|
+
cancel-in-progress: true
|
27
|
+
|
28
|
+
env:
|
29
|
+
BUNDLE_WITH: maintenance
|
30
|
+
|
31
|
+
jobs:
|
32
|
+
generate:
|
33
|
+
runs-on: ubuntu-latest
|
34
|
+
|
35
|
+
steps:
|
36
|
+
- uses: actions/checkout@v4
|
16
37
|
|
17
|
-
|
38
|
+
- uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
ruby-version: ruby
|
41
|
+
bundler-cache: true
|
42
|
+
|
43
|
+
- name: Installing packages
|
44
|
+
run: sudo apt-get install wget
|
45
|
+
|
46
|
+
- name: Generate documentation
|
47
|
+
timeout-minutes: 5
|
48
|
+
run: bundle exec bake utopia:project:static --force no
|
49
|
+
|
50
|
+
- name: Upload documentation artifact
|
51
|
+
uses: actions/upload-pages-artifact@v3
|
52
|
+
with:
|
53
|
+
path: docs
|
54
|
+
|
55
|
+
deploy:
|
56
|
+
runs-on: ubuntu-latest
|
57
|
+
|
58
|
+
environment:
|
59
|
+
name: github-pages
|
60
|
+
url: ${{steps.deployment.outputs.page_url}}
|
61
|
+
|
62
|
+
needs: generate
|
63
|
+
steps:
|
64
|
+
- name: Deploy to GitHub Pages
|
65
|
+
id: deployment
|
66
|
+
uses: actions/deploy-pages@v4
|
67
|
+
```
|
data/context/index.yaml
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
# Automatically generated context index for Utopia::Project guides.
|
2
2
|
# Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
|
3
3
|
---
|
4
|
-
|
4
|
+
description: A project documentation tool based on Utopia.
|
5
|
+
metadata:
|
6
|
+
documentation_uri: https://socketry.github.io/utopia-project/
|
7
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
8
|
+
source_code_uri: https://github.com/socketry/utopia-project/
|
9
|
+
files:
|
10
|
+
- path: getting-started.md
|
5
11
|
title: Getting Started
|
6
|
-
|
7
|
-
|
8
|
-
documentation-
|
9
|
-
title: Documentation
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
github-pages-integration:
|
12
|
+
description: This guide explains how to use `utopia-project` to add documentation
|
13
|
+
to your project.
|
14
|
+
- path: documentation-guidelines.md
|
15
|
+
title: Documentation Guides
|
16
|
+
description: This guide explains how to create and maintain documentation for your
|
17
|
+
project using `utopia-project`.
|
18
|
+
- path: github-pages-integration.md
|
14
19
|
title: GitHub Pages Integration
|
15
|
-
|
16
|
-
|
20
|
+
description: This guide shows you how to use `utopia-project` with GitHub Pages
|
21
|
+
to deploy documentation.
|
data/lib/utopia/project/base.rb
CHANGED
@@ -203,6 +203,20 @@ module Utopia
|
|
203
203
|
releases_document.releases
|
204
204
|
end
|
205
205
|
end
|
206
|
+
|
207
|
+
# Get the path to the gemspec file for this project.
|
208
|
+
# @returns [String | nil] The relative path to the gemspec file, or nil if not found.
|
209
|
+
private def gemspec_path
|
210
|
+
Dir.glob("*.gemspec", base: @root).first
|
211
|
+
end
|
212
|
+
|
213
|
+
# Load and return the gemspec for this project.
|
214
|
+
# @returns [Gem::Specification | nil] The loaded gemspec, or nil if not found.
|
215
|
+
def gemspec
|
216
|
+
if gemspec_path = self.gemspec_path
|
217
|
+
@gemspec ||= ::Gem::Specification.load(File.join(@root, gemspec_path))
|
218
|
+
end
|
219
|
+
end
|
206
220
|
end
|
207
221
|
end
|
208
222
|
end
|
data/lib/utopia/project/guide.rb
CHANGED
@@ -40,6 +40,31 @@ module Utopia
|
|
40
40
|
metadata[:order]
|
41
41
|
end
|
42
42
|
|
43
|
+
def <=> other
|
44
|
+
if order = self.order
|
45
|
+
if other_order = other.order
|
46
|
+
if order < other_order
|
47
|
+
return -1
|
48
|
+
elsif order > other_order
|
49
|
+
return 1
|
50
|
+
end
|
51
|
+
else
|
52
|
+
# If we have order, but the other doesn't, we come first:
|
53
|
+
return -1
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if name = self.name
|
58
|
+
if other_name = other.name
|
59
|
+
return name <=> other_name
|
60
|
+
else
|
61
|
+
return -1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
return 0
|
66
|
+
end
|
67
|
+
|
43
68
|
README = "readme.md"
|
44
69
|
|
45
70
|
# The path to the README file for the guide.
|
data/readme.md
CHANGED
@@ -21,16 +21,20 @@ needs of my users.
|
|
21
21
|
|
22
22
|
Please see the [project documentation](https://socketry.github.io/utopia-project/) for more details.
|
23
23
|
|
24
|
-
- [Getting Started](https://socketry.github.io/utopia-project/guides/getting-started/index) - This guide explains how to use `utopia-project`
|
24
|
+
- [Getting Started](https://socketry.github.io/utopia-project/guides/getting-started/index) - This guide explains how to use `utopia-project` to add documentation to your project.
|
25
25
|
|
26
|
-
- [Documentation
|
26
|
+
- [Documentation Guides](https://socketry.github.io/utopia-project/guides/documentation-guidelines/index) - This guide explains how to create and maintain documentation for your project using `utopia-project`.
|
27
27
|
|
28
|
-
- [GitHub Pages Integration](https://socketry.github.io/utopia-project/guides/github-pages-integration/index) - This guide shows you how to use `utopia-project` with GitHub Pages.
|
28
|
+
- [GitHub Pages Integration](https://socketry.github.io/utopia-project/guides/github-pages-integration/index) - This guide shows you how to use `utopia-project` with GitHub Pages to deploy documentation.
|
29
29
|
|
30
30
|
## Releases
|
31
31
|
|
32
32
|
Please see the [project releases](https://socketry.github.io/utopia-project/releases/index) for all releases.
|
33
33
|
|
34
|
+
### v0.34.1
|
35
|
+
|
36
|
+
- Fix schema for `index.yaml` context file.
|
37
|
+
|
34
38
|
### v0.34.0
|
35
39
|
|
36
40
|
- Introduce `bake utopia:project:agent:context:update` command to update the agent context from the guides in the project.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|