utopia-project 0.20.2 → 0.21.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: a592172db272c2789de44f49c0b441741a3d269f19f849ef5718aaf3c5a7152e
4
- data.tar.gz: 66078c8df37cbff16f1dc674d18b05efef27f910894d258647189f4944d83b40
3
+ metadata.gz: 4d1ad15923d59f832f9be9b32a296003f285d38b95da13ac831575dc034a6c08
4
+ data.tar.gz: 3029c9fac2566ca56590ec6f15761218a0ecae564b1c55d75f2d9b6cb692a6bc
5
5
  SHA512:
6
- metadata.gz: 1ce5ea33622890abb90b9192be7a546219f5e0b8f94cf193fe3640b1177f9c2a17ec0c0a3a037f52be677addfa255b6529a40059f1b063de9fd74e4e3224eae0
7
- data.tar.gz: 01f392ac81d5d68117298bf3d803bc7d1f3171bde53a9c670e2eb9e737e7d09b24b122505b1fcfa970f526525232bd7e13c4a357730055594c262bfd3e7e7232
6
+ metadata.gz: fabe143fac57289c5c273db880f66e4e2502da748b9179bb81cfe0eea38bb15d93dc042e12c2e95c1dec13b8d9cdafc108e50b1a9d8e42d5ad5955be47657788
7
+ data.tar.gz: '093c1ad0f1570461d66980065a982e3acf3286a8c67d4d94d9d57d83b09b7a8f1efe149ba8042a8d23b782c0acc0c2ad73c2bbcbf6787d98a951d305dbe9710a'
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
1
5
 
2
6
  # Create an empty project in the current directory.
3
7
  def create
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
22
5
 
23
6
  require 'utopia/path'
24
7
  require 'utopia/content/links'
@@ -71,7 +54,7 @@ module Utopia
71
54
  attr :index
72
55
 
73
56
  # Return the absolute path for the given file name, if it exists in the project.
74
- # @parameter file_name [String] The relative path to the project file, e.g. `README.md`.
57
+ # @parameter file_name [String] The relative path to the project file, e.g. `readme.md`.
75
58
  # @returns [String] The file-system path.
76
59
  def path_for(file_name)
77
60
  full_path = File.expand_path(file_name, @root)
@@ -195,6 +178,16 @@ module Utopia
195
178
  yield Guide.new(self, guide_path)
196
179
  end
197
180
  end
181
+
182
+ def readme_document
183
+ if path = self.path_for('readme.md') || self.path_for('README.md')
184
+ Document.new(File.read(path), self)
185
+ end
186
+ end
187
+
188
+ def project_title
189
+ readme_document&.title || "Project"
190
+ end
198
191
  end
199
192
  end
200
193
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
22
5
 
23
6
  require_relative 'renderer'
24
7
 
@@ -40,6 +23,14 @@ module Utopia
40
23
  @root ||= resolve(Markly.parse(@text, extensions: [:table]))
41
24
  end
42
25
 
26
+ def title
27
+ child = self.root.first_child
28
+
29
+ if child && child.type == :header
30
+ return child.first_child.to_plaintext
31
+ end
32
+ end
33
+
43
34
  def first_child
44
35
  self.root.first_child
45
36
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
22
5
 
23
6
  require 'utopia/path'
24
7
  require 'trenni/reference'
@@ -48,18 +31,18 @@ module Utopia
48
31
  # @attribute [String | Nil]
49
32
  attr :description
50
33
 
51
- README = "README.md"
34
+ README = "readme.md"
52
35
 
53
36
  # The path to the README file for the guide.
54
37
  # @returns [String] The file-system path.
55
38
  def readme_path
56
- File.expand_path(README, @root)
39
+ Dir[File.expand_path(README, @root)].first
57
40
  end
58
41
 
59
42
  # Does a README file exist for this guide?
60
43
  # @returns [Boolean]
61
44
  def readme?
62
- File.exist?(readme_path)
45
+ !readme_path.nil?
63
46
  end
64
47
 
65
48
  # The document for the README, if one exists.
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2023, by Samuel Williams.
22
5
 
23
6
  require 'decode/syntax/rewriter'
24
7
 
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2022, by Samuel Williams.
22
5
 
23
6
  require 'markly'
24
7
  require 'markly/renderer/html'
@@ -1,27 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
22
5
 
23
6
  module Utopia
24
7
  module Project
25
- VERSION = "0.20.2"
8
+ VERSION = "0.21.0"
26
9
  end
27
10
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
13
- # all 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
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2023, by Samuel Williams.
22
5
 
23
6
  require "utopia/project/version"
24
7
 
data/license.md ADDED
@@ -0,0 +1,23 @@
1
+ # MIT License
2
+
3
+ Copyright, 2020-2023, by Samuel Williams.
4
+ Copyright, 2020, by Olle Jonsson.
5
+ Copyright, 2022, by dependabot[bot].
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
data/pages/_header.xnode CHANGED
@@ -7,7 +7,11 @@
7
7
  end
8
8
 
9
9
  if link = links(path.dirname, name: path.last, locale: localization.current_locale, indices: true).first
10
- ?> &rsaquo; #{link.to_href}<?r
10
+ if replace = link[:replace]&.to_sym
11
+ ?> &rsaquo; #{link.to_href(content: controller[:base].public_send(replace))}<?r
12
+ else
13
+ ?> &rsaquo; #{link.to_href}<?r
14
+ end
11
15
  else
12
16
  ?> &rsaquo; <span>#{path.last}</span><?r
13
17
  end
data/pages/controller.rb CHANGED
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
1
5
 
2
6
  prepend Actions
3
7
 
4
8
  on 'index' do
5
9
  @base = Utopia::Project::Base.instance
6
10
 
7
- if readme_path = @base.path_for('README.md')
8
- @document = Utopia::Project::Document.new(File.read(readme_path), @base)
11
+ if @document = @base.readme_document
9
12
 
10
13
  @document.replace_section("Usage") do |header|
11
14
  header.insert_after(@document.html_node("<content:usage/>"))
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2023, by Samuel Williams.
1
5
 
2
6
  prepend Actions
3
7
 
data/pages/index.xnode CHANGED
@@ -31,7 +31,7 @@
31
31
  ?>
32
32
  <content:heading>Project</content:heading>
33
33
 
34
- <p>This project does not have a README.md file.</p>
34
+ <p>This project does not have a <code>readme.md</code> file.</p>
35
35
  <?r
36
36
  end
37
37
  ?>
data/pages/links.yaml CHANGED
@@ -1,4 +1,5 @@
1
1
  index:
2
2
  title: Project
3
+ replace: project_title
3
4
  errors:
4
5
  display: false
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2022, by Samuel Williams.
1
5
 
2
6
  prepend Actions
3
7