utopia-project 0.21.0 → 0.22.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d1ad15923d59f832f9be9b32a296003f285d38b95da13ac831575dc034a6c08
4
- data.tar.gz: 3029c9fac2566ca56590ec6f15761218a0ecae564b1c55d75f2d9b6cb692a6bc
3
+ metadata.gz: af7ac04b71cc8b501069888bd23a5da5cd00bd25d7900016fe89de7e08170426
4
+ data.tar.gz: fba0add2c28c7712a0c6fd894b21aca3f0015c3fc13f3c4b0299aa053e4dca9a
5
5
  SHA512:
6
- metadata.gz: fabe143fac57289c5c273db880f66e4e2502da748b9179bb81cfe0eea38bb15d93dc042e12c2e95c1dec13b8d9cdafc108e50b1a9d8e42d5ad5955be47657788
7
- data.tar.gz: '093c1ad0f1570461d66980065a982e3acf3286a8c67d4d94d9d57d83b09b7a8f1efe149ba8042a8d23b782c0acc0c2ad73c2bbcbf6787d98a951d305dbe9710a'
6
+ metadata.gz: 0fd2ed330c03e2ba6b4dc2f5ffa7c31d88b6c974b2e1b349c03d882b11ba22cca2fd86aafef63aa09dc18a75d14c1daf766c27b7791c1d3832a67fab00ac22fa
7
+ data.tar.gz: 6d03bc32040379cfab0f3125da19bc05a21a860cded807c695c8b0592b8b6766c200b489988f9f867a42ab4053e5885a839e66c9774321217f59a4d0c0ab0d98
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,50 @@
1
+
2
+ require 'utopia/project'
3
+ require 'trenni'
4
+
5
+ def update(path: "readme.md", documentation_url: nil)
6
+ project = Utopia::Project::Base.new(context.root)
7
+ readme = project.readme_document
8
+
9
+ documentation_url ||= public_documentation_url
10
+
11
+ readme.replace_section("Usage") do |header|
12
+ current = header
13
+
14
+ usage_section = self.usage_section(documentation_url, project)
15
+ usage_section.each do |child|
16
+ current.insert_after(child)
17
+ current = child
18
+ end
19
+ end
20
+
21
+ File.write(path, readme.root.to_markdown)
22
+ end
23
+
24
+ private
25
+
26
+ Scope = Struct.new(:documentation_url, :project)
27
+
28
+ def gemspec_path
29
+ Dir.glob("*.gemspec", base: context.root).first
30
+ end
31
+
32
+ def gemspec
33
+ if gemspec_path = self.gemspec_path
34
+ @gemspec ||= Gem::Specification.load(gemspec_path)
35
+ end
36
+ end
37
+
38
+ # The public documentation URL if it can be determined.
39
+ def public_documentation_url
40
+ gemspec&.homepage
41
+ end
42
+
43
+ def usage_section(documentation_url, project)
44
+ template = Trenni::Template.load_file(File.expand_path("usage.trenni", __dir__))
45
+ scope = Scope.new(documentation_url, project)
46
+
47
+ output = template.to_string(scope)
48
+
49
+ return Markly.parse(output)
50
+ end
@@ -0,0 +1,5 @@
1
+ Please see the [project documentation](#{documentation_url}) for more details.
2
+
3
+ <?r project.guides.each do |guide| ?>
4
+ - [#{guide.title}](#{guide.href(documentation_url)}) - #{guide.description.to_markdown}
5
+ <?r end ?>
@@ -46,11 +46,12 @@ module Utopia
46
46
  if header.first_child.to_plaintext.include?(name)
47
47
  # Now subsequent children:
48
48
  current = header.next
49
-
49
+
50
50
  # Delete everything in the section until we encounter another header:
51
51
  while current && current.type != :header
52
+ current_next = current.next
52
53
  current.delete
53
- current = current.next
54
+ current = current_next
54
55
  end
55
56
 
56
57
  return yield(header)
@@ -83,8 +83,8 @@ module Utopia
83
83
 
84
84
  # The hypertext reference to this guide.
85
85
  # @returns [String]
86
- def href
87
- "/guides/#{self.name}/index"
86
+ def href(base = "/")
87
+ "#{base}guides/#{self.name}/index"
88
88
  end
89
89
 
90
90
  # The best documentation, extracted from the source files of the guide.
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Utopia
7
7
  module Project
8
- VERSION = "0.21.0"
8
+ VERSION = "0.22.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -2,19 +2,33 @@
2
2
 
3
3
  A simple Ruby project documentation website.
4
4
 
5
- [![Development Status](https://github.com/socketry/utopia-project/workflows/Test/badge.svg)](https://github.com/socketry/utopia-project/actions?workflow=Test)
5
+ [![Test](https://github.com/socketry/utopia-project/actions/workflows/test.yaml/badge.svg)](https://github.com/socketry/utopia-project/actions/workflows/test.yaml)
6
6
 
7
7
  ## Motivation
8
8
 
9
- I've used many documentation tools. Most are over-complicated and focus on what is possible rather than what is useful. Because I manage many open source projects, at a certain scale it makes sense to build something to suit your needs rather than try to adapt to existing systems. This is one such instance.
9
+ I've used many documentation tools. Most are over-complicated and focus on what is possible rather than what is useful.
10
+ Because I manage many open source projects, at a certain scale it makes sense to build something to suit your needs
11
+ rather than try to adapt to existing systems. This is one such instance.
10
12
 
11
- My goal is to provide task-centric documentation, and to continually improve the way it's presented. The primary entry point for new developers are the structured usage guides, however having rich cross-referencing into the code is equally important.
13
+ My goal is to provide task-centric documentation, and to continually improve the way it's presented. The primary entry
14
+ point for new developers are the structured usage guides, however having rich cross-referencing into the code is equally
15
+ important.
12
16
 
13
- With that in mind, this web application provides such a model and will evolve over time to suit my requirements and the needs of my users.
17
+ With that in mind, this web application provides such a model and will evolve over time to suit my requirements and the
18
+ needs of my users.
14
19
 
15
20
  ## Usage
16
21
 
17
- Please see the <a href="https://socketry.github.io/utopia-project/">project documentation</a> or run it locally using `bake utopia:project:serve`.
22
+ Please see the [project documentation](https://socketry.github.io/utopia-project/) for more details.
23
+
24
+ - [Getting Started](https://socketry.github.io/utopia-project/guides/getting-started/index) - This guide explains how
25
+ to use `utopia-project` for your own project.
26
+
27
+ - [Documentation Formatting](https://socketry.github.io/utopia-project/guides/documentation-formatting/index) - This
28
+ guide explains the conventions used by `utopia-project` when generating documentation for your project.
29
+
30
+ - [GitHub Pages Integration](https://socketry.github.io/utopia-project/guides/github-pages-integration/index) - This
31
+ guide shows you how to use `utopia-project` with GitHub Pages.
18
32
 
19
33
  ## Contributing
20
34
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia-project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -39,7 +39,7 @@ cert_chain:
39
39
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
40
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
41
  -----END CERTIFICATE-----
42
- date: 2023-02-18 00:00:00.000000000 Z
42
+ date: 2023-05-01 00:00:00.000000000 Z
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: decode
@@ -188,6 +188,8 @@ extensions: []
188
188
  extra_rdoc_files: []
189
189
  files:
190
190
  - bake/utopia/project.rb
191
+ - bake/utopia/project/readme/update.rb
192
+ - bake/utopia/project/readme/usage.trenni
191
193
  - lib/utopia/project.rb
192
194
  - lib/utopia/project/base.md
193
195
  - lib/utopia/project/base.rb
@@ -322,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
322
324
  - !ruby/object:Gem::Version
323
325
  version: '0'
324
326
  requirements: []
325
- rubygems_version: 3.4.6
327
+ rubygems_version: 3.4.10
326
328
  signing_key:
327
329
  specification_version: 4
328
330
  summary: A project documentation tool based on Utopia.
metadata.gz.sig CHANGED
Binary file