utopia-project 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7571eadd6ab883d2405f012181f6079c01c3775a9678e8529920b7768445c7b3
4
- data.tar.gz: 967608452801fd109a543d90d0b5bc7d5020148e90e2ccf9d87052160f43a893
3
+ metadata.gz: b31386125a2a1880b8d162ff278234e5c969b5ad658639e93ecf543b259b55d5
4
+ data.tar.gz: 35cab271274f82f93153d527631c3798342c5f08e2dd8a1e317a521730b89866
5
5
  SHA512:
6
- metadata.gz: 832377189cf4125315baf88d81691e6dea3173cfdbef2a7ccb291cadb7fe8f62186561374d5295c2ee1f68860c4c5cd911c3a6409431acc70fae9de75cba5f45
7
- data.tar.gz: c886453e9447576f9983f7dd476f09042bbb7df9ea1af627896ecee051162d276544e6d7f56b60bc2d3a2893f455210337f9af7eef677217870c59ca58dc5bce
6
+ metadata.gz: 98738871025a6afa851a009f41ea8a4d8cd47b54ace8ecf64fce5fe78b90e31e8bf0923ce9bed3ee2cd18de1a69e92e0b01d22ca61542dc68ed5d969c428758a
7
+ data.tar.gz: 96fa148979e16c1cea5d46c9ff8e669c4588b8183d47005bf6d3f41484aca4013232127c4dcbfea4dd12b7b2388895e35f70d83695ae1bcad72416d190967c18
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,11 @@
1
+ <?r
2
+ project.releases.each do |release|
3
+ ?>
4
+ ### #{release.name}
5
+
6
+ <?r release.summary do |title| ?>
7
+ - [#{title}](#{release.href(documentation_url, title)})
8
+ <?r
9
+ end
10
+ end
11
+ ?>
@@ -22,6 +22,16 @@ def update(path: "readme.md", documentation_url: nil)
22
22
  end
23
23
  end
24
24
 
25
+ readme.replace_section("Releases", children: true) do |header|
26
+ current = header
27
+
28
+ releases_section = self.releases_section(documentation_url, project)
29
+ releases_section.each do |child|
30
+ current.insert_after(child)
31
+ current = child
32
+ end
33
+ end
34
+
25
35
  File.write(path, readme.root.to_markdown)
26
36
  end
27
37
 
@@ -58,3 +68,12 @@ def usage_section(documentation_url, project)
58
68
 
59
69
  return Markly.parse(output)
60
70
  end
71
+
72
+ def releases_section(documentation_url, project)
73
+ template = XRB::Template.load_file(File.expand_path("releases.xrb", __dir__))
74
+ scope = Scope.new(documentation_url, project)
75
+
76
+ output = template.to_string(scope)
77
+
78
+ return Markly.parse(output)
79
+ end
data/changes.md ADDED
@@ -0,0 +1,5 @@
1
+ # v0.28.0
2
+
3
+ ## Introduce Changes Document
4
+
5
+ A new changes document, if present, will be used to display changes in the release notes. The changes document should be named `changes.md` and should be placed in the root of the project. The changes document should be written in markdown format.
@@ -13,6 +13,8 @@ require 'decode'
13
13
  require 'thread/local'
14
14
 
15
15
  require_relative 'document'
16
+ require_relative 'changes_document'
17
+
16
18
  require_relative 'guide'
17
19
  require_relative 'linkify'
18
20
 
@@ -189,6 +191,18 @@ module Utopia
189
191
  def project_title
190
192
  readme_document&.title || "Project"
191
193
  end
194
+
195
+ def changes_document
196
+ if path = self.path_for('changes.md')
197
+ ChangesDocument.new(File.read(path), self)
198
+ end
199
+ end
200
+
201
+ def releases
202
+ if changes_document = self.changes_document
203
+ changes_document.releases
204
+ end
205
+ end
192
206
  end
193
207
  end
194
208
  end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
5
+
6
+ require_relative 'document'
7
+
8
+ module Utopia
9
+ module Project
10
+ class ChangesDocument < Document
11
+ class Release
12
+ def initialize(node)
13
+ @node = node
14
+ end
15
+
16
+ def changes
17
+ return to_enum(:changes) unless block_given?
18
+
19
+ node = @node.next
20
+
21
+ while node
22
+ if node.type == :header
23
+ if node.header_level <= @node.header_level
24
+ break
25
+ end
26
+
27
+ if node.header_level == @node.header_level + 1
28
+ yield node
29
+ end
30
+ end
31
+
32
+ node = node.next
33
+ end
34
+ end
35
+
36
+ def name
37
+ @node.to_plaintext.chomp
38
+ end
39
+
40
+ def summary
41
+ return to_enum(:summary) unless block_given?
42
+
43
+ changes.each do |node|
44
+ yield node.to_plaintext.chomp
45
+ end
46
+ end
47
+
48
+ def href(base = "/", change)
49
+ "#{base}changes/index##{change.downcase.gsub(/\s+/, "-")}"
50
+ end
51
+ end
52
+
53
+ def release_names
54
+ return to_enum(:release_names) unless block_given?
55
+
56
+ self.root.each do |node|
57
+ if node.type == :header and node.header_level == 1
58
+ yield node.to_plaintext.chomp
59
+ end
60
+ end
61
+ end
62
+
63
+ def release(name)
64
+ self.root.each do |node|
65
+ if node.type == :header and node.header_level == 1 and node.to_plaintext.chomp == name
66
+ return Release.new(node)
67
+ end
68
+ end
69
+ end
70
+
71
+ def latest_release
72
+ if name = release_names.first
73
+ release(name)
74
+ end
75
+ end
76
+
77
+ def releases
78
+ return to_enum(:releases) unless block_given?
79
+
80
+ release_names.each do |name|
81
+ yield release(name)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2020-2024, by Samuel Williams.
5
5
 
6
6
  require_relative 'renderer'
7
+ require 'xrb'
7
8
 
8
9
  module Utopia
9
10
  module Project
@@ -35,7 +36,7 @@ module Utopia
35
36
  self.root.first_child
36
37
  end
37
38
 
38
- def replace_section(name)
39
+ def replace_section(name, children: false)
39
40
  child = self.first_child
40
41
 
41
42
  while child
@@ -48,7 +49,16 @@ module Utopia
48
49
  current = header.next
49
50
 
50
51
  # Delete everything in the section until we encounter another header:
51
- while current && current.type != :header
52
+ while current
53
+ if current.type == :header
54
+ # If we are removing all children, keep on going until we reach a header of the same level or higher:
55
+ if children
56
+ break if current.header_level <= header.header_level
57
+ else
58
+ break
59
+ end
60
+ end
61
+
52
62
  current_next = current.next
53
63
  current.delete
54
64
  current = current_next
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Utopia
7
7
  module Project
8
- VERSION = "0.27.0"
8
+ VERSION = "0.28.0"
9
9
  end
10
10
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
5
+
6
+ prepend Actions
7
+
8
+ on 'index' do
9
+ @document = @base.changes_document
10
+ end
@@ -0,0 +1,13 @@
1
+ <content:page>
2
+ <?r
3
+ if document = self[:document]
4
+ ?>#{MarkupString.raw document.to_html}<?r
5
+ else
6
+ ?>
7
+ <content:heading>Project</content:heading>
8
+
9
+ <p>This project does not have a <code>changes.md</code> file.</p>
10
+ <?r
11
+ end
12
+ ?>
13
+ </content:page>
data/pages/index.xnode CHANGED
@@ -34,5 +34,5 @@
34
34
  <p>This project does not have a <code>readme.md</code> file.</p>
35
35
  <?r
36
36
  end
37
- ?>
37
+ ?>
38
38
  </content:page>
data/readme.md CHANGED
@@ -21,14 +21,22 @@ 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
25
- to use `utopia-project` for your own project.
24
+ - [Getting Started](https://socketry.github.io/utopia-project/guides/getting-started/index) - This guide explains how to use `utopia-project` for your own project.
26
25
 
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.
26
+ - [Documentation Formatting](https://socketry.github.io/utopia-project/guides/documentation-formatting/index) - This guide explains the conventions used by `utopia-project` when generating documentation for your project.
29
27
 
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.
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.
29
+
30
+ ## Releases
31
+
32
+ ### v0.28.0
33
+
34
+ - [Introduce Changes Document](https://socketry.github.io/utopia-project/changes/index#introduce-changes-document)
35
+
36
+ ## See Also
37
+
38
+ - [Utopia](https://github.com/socketry/utopia) — The website framework which powers this web application.
39
+ - [Decode](https://github.com/ioquatix/decode) — The source code parser and cross-referencing library.
32
40
 
33
41
  ## Contributing
34
42
 
@@ -47,8 +55,3 @@ In order to protect users of this project, we require all contributors to comply
47
55
  ### Community Guidelines
48
56
 
49
57
  This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
50
-
51
- ## See Also
52
-
53
- - [Utopia](https://github.com/socketry/utopia) — The website framework which powers this web application.
54
- - [Decode](https://github.com/ioquatix/decode) — The source code parser and cross-referencing library.
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.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -40,7 +40,7 @@ cert_chain:
40
40
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
41
41
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
42
42
  -----END CERTIFICATE-----
43
- date: 2024-07-24 00:00:00.000000000 Z
43
+ date: 2024-08-18 00:00:00.000000000 Z
44
44
  dependencies:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: decode
@@ -133,11 +133,14 @@ extensions: []
133
133
  extra_rdoc_files: []
134
134
  files:
135
135
  - bake/utopia/project.rb
136
+ - bake/utopia/project/readme/releases.xrb
136
137
  - bake/utopia/project/readme/update.rb
137
138
  - bake/utopia/project/readme/usage.xrb
139
+ - changes.md
138
140
  - lib/utopia/project.rb
139
141
  - lib/utopia/project/base.md
140
142
  - lib/utopia/project/base.rb
143
+ - lib/utopia/project/changes_document.rb
141
144
  - lib/utopia/project/document.rb
142
145
  - lib/utopia/project/guide.rb
143
146
  - lib/utopia/project/linkify.rb
@@ -151,6 +154,8 @@ files:
151
154
  - pages/_thumbnail.xnode
152
155
  - pages/_usage.xnode
153
156
  - pages/_youtube-video.xnode
157
+ - pages/changes/controller.rb
158
+ - pages/changes/index.xnode
154
159
  - pages/controller.rb
155
160
  - pages/errors/exception.xnode
156
161
  - pages/errors/file-not-found.xnode
@@ -256,6 +261,7 @@ homepage: https://socketry.github.io/utopia-project
256
261
  licenses:
257
262
  - MIT
258
263
  metadata:
264
+ documentation_uri: https://socketry.github.io/utopia-project/
259
265
  funding_uri: https://github.com/sponsors/ioquatix/
260
266
  source_code_uri: https://github.com/socketry/utopia-project/
261
267
  post_install_message:
metadata.gz.sig CHANGED
Binary file