utopia-project 0.7.1 → 0.8.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: fb8a529c1cca5ba878e32e433757429ad8bbcda4f6355242b11caba109595825
4
- data.tar.gz: 120aca31fec8a99abd38d002ea890f282228e198406424cdaec874a16d30188d
3
+ metadata.gz: 85b28d4f829a2a136cfecc1d3eb56f969f12120dc3811f854eea5969970cf662
4
+ data.tar.gz: a5d2f5460d383fbc2260f14145e01ca8dcd0ababf874ba6a4ea899236457b14a
5
5
  SHA512:
6
- metadata.gz: f611f36fb5cde35ae5943177cc101f619c9251cfb66edc47ecdca7fca21af75410e9c8dd0378951f8df1f1470601bdd7c8e0fc3b92808ae82ec91de8e7e4199a
7
- data.tar.gz: dbae08da7898f04c8fef56e04a9eac068a3f4fdf4b141e976498a72c83ce11ff4ccf18ca1aec2f73c4f43a127d995f3f8aba2a740a78dbe611e3f52498847a23
6
+ metadata.gz: 880f4b5705451fa21fcf48042ed447b0265ac75e12c877a5683b87c939f2185f57858fc066aae39110ed48e69f04f57b76c2af8b38b6bd08df8f95e15c22091b
7
+ data.tar.gz: 56504db1b9b96fa279d91aa99beb3c3a0fcb9f5c00e918857b2c6247681c9406f4f77c1e0c166721449b319c46c71f50fc37d1c68102a0da5856dad5c6a146fa
@@ -11,8 +11,8 @@ end
11
11
  # Serve the project using a web server.
12
12
  # Binds to `https://localhost:9292` by default.
13
13
  #
14
- # @param port [Integer] The port to bind to.
15
- # @param bind [String] The URL to bind to, e.g. `http://localhost:80`.
14
+ # @parameter port [Integer] The port to bind to.
15
+ # @parameter bind [String] The URL to bind to, e.g. `http://localhost:80`.
16
16
  def serve(port: nil, bind: nil)
17
17
  config_path = File.expand_path("../../template/config.ru", __dir__)
18
18
  preload_path = File.expand_path("../../template/preload.rb", __dir__)
@@ -31,7 +31,7 @@ def serve(port: nil, bind: nil)
31
31
  end
32
32
 
33
33
  # Generate a static copy of the site.
34
- # @param output_path [String] The output path for the static site.
34
+ # @parameter output_path [String] The output path for the static site.
35
35
  def static(output_path: "docs")
36
36
  require 'rackula/command'
37
37
 
@@ -51,7 +51,7 @@ module Utopia
51
51
  end
52
52
 
53
53
  # Initialize the project with the given root path.
54
- # @param root [String] The file-system path to the root of the project.
54
+ # @parameter root [String] The file-system path to the root of the project.
55
55
  def initialize(root = Dir.pwd)
56
56
  @root = root
57
57
 
@@ -63,13 +63,16 @@ module Utopia
63
63
  end
64
64
 
65
65
  # The file-system path to the root of the project.
66
+ # @attribute [String]
66
67
  attr :root
67
68
 
68
69
  # The source code index which is used for generating pages.
70
+ # @attribute [Decode::Index]
69
71
  attr :index
70
72
 
71
73
  # Return the absolute path for the given file name, if it exists in the project.
72
- # @param file_name [String] The relative path to the project file, e.g. `README.md`.
74
+ # @parameter file_name [String] The relative path to the project file, e.g. `README.md`.
75
+ # @returns [String] The file-system path.
73
76
  def path_for(file_name)
74
77
  full_path = File.expand_path(file_name, @root)
75
78
  if File.exist?(full_path)
@@ -78,28 +81,35 @@ module Utopia
78
81
  end
79
82
 
80
83
  # Update the index with the specified paths.
81
- # @param paths [Array(String)] The paths to load and parse.
84
+ # @parameter paths [Array(String)] The paths to load and parse.
82
85
  def update(paths)
83
86
  @index.update(paths)
84
87
  end
85
88
 
86
- def best(symbols)
87
- symbols.each do |symbol|
88
- if symbol.documentation
89
- return symbol
89
+ # Given an array of defintions, return the best definition for the purposes of generating documentation.
90
+ # @returns [Decode::Definition | Nil]
91
+ def best(definitions)
92
+ definitions.each do |definition|
93
+ if definition.documentation
94
+ return definition
90
95
  end
91
96
  end
92
97
 
93
- return symbols.first
98
+ return definitions.first
94
99
  end
95
100
 
101
+ # Given a lexical path, find the best definition for that path.
102
+ # @returns [Tuple(Decode::Trie::Node, Decode::Definition)]
96
103
  def lookup(path)
97
104
  if node = @index.trie.lookup(path.map(&:to_sym))
98
105
  return node, best(node.values)
99
106
  end
100
107
  end
101
108
 
102
- def format(text, symbol = nil, language: symbol&.language)
109
+ # Format the given text in the context of the given definition and language.
110
+ # See {document} for details.
111
+ # @returns [Trenni::MarkupString]
112
+ def format(text, definition = nil, language: definition&.language)
103
113
  case text
104
114
  when Enumerable
105
115
  text = text.to_a.join("\n")
@@ -107,29 +117,38 @@ module Utopia
107
117
  return nil
108
118
  end
109
119
 
110
- if document = self.document(text, symbol, language: language)
120
+ if document = self.document(text, definition, language: language)
111
121
  return Trenni::MarkupString.raw(
112
122
  document.to_html
113
123
  )
114
124
  end
115
125
  end
116
126
 
117
- def document(text, symbol = nil, language: symbol&.language)
118
- text = text&.gsub(/{(.*?)}/) do |match|
119
- linkify($1, symbol, language: language)
127
+ # Convert the given markdown text into HTML.
128
+ #
129
+ # - Updates source code references (`{language identifier}`) into links.
130
+ # - Uses {Kramdown} to convert the text into HTML.
131
+ #
132
+ # @returns [Kramdown::Document]
133
+ def document(text, definition = nil, language: definition&.language)
134
+ text = text&.gsub(/(?<!`){(.*?)}/) do |match|
135
+ linkify($1, definition, language: language)
120
136
  end
121
137
 
122
138
  return Kramdown::Document.new(text, syntax_highlighter: nil)
123
139
  end
124
140
 
125
- def linkify(text, symbol = nil, language: symbol&.language)
141
+ # Replace source code references in the given text with HTML anchors.
142
+ #
143
+ # @returns [Trenni::Builder]
144
+ def linkify(text, definition = nil, language: definition&.language)
126
145
  reference = @index.languages.parse_reference(text, default_language: language)
127
146
 
128
147
  Trenni::Builder.fragment do |builder|
129
- if reference and definition = @index.lookup(reference, relative_to: symbol)&.first
148
+ if reference and definition = @index.lookup(reference, relative_to: definition)&.first
130
149
  builder.inline('a', href: link_for(definition)) do
131
150
  builder.inline('code', class: "language-#{definition.language.name}") do
132
- builder.text definition.short_form
151
+ builder.text definition.qualified_form
133
152
  end
134
153
  end
135
154
  elsif reference
@@ -145,26 +164,32 @@ module Utopia
145
164
  end
146
165
 
147
166
  # Compute a unique string which can be used as `id` attribute in the HTML output.
148
- def id_for(symbol, suffix = nil)
167
+ # @returns [String]
168
+ def id_for(definition, suffix = nil)
149
169
  if suffix
150
- "#{symbol.qualified_name}-#{suffix}"
170
+ "#{definition.qualified_name}-#{suffix}"
151
171
  else
152
- symbol.qualified_name
172
+ definition.qualified_name
153
173
  end
154
174
  end
155
175
 
156
- # Compute a link href to the given symbol for use within the HTML output.
157
- def link_for(symbol)
158
- path = symbol.lexical_path.map{|entry| entry.to_s}
176
+ # Compute a link href to the given definition for use within the HTML output.
177
+ # @returns [Trenni::Reference]
178
+ def link_for(definition)
179
+ path = definition.lexical_path.map{|entry| entry.to_s}
159
180
 
160
- if symbol.container?
181
+ if definition.container?
161
182
  return Trenni::Reference.new(@source_path + path + "index")
162
183
  else
163
184
  name = path.pop
164
- return Trenni::Reference.new(@source_path + path + "index", fragment: id_for(symbol))
185
+ return Trenni::Reference.new(@source_path + path + "index", fragment: id_for(definition))
165
186
  end
166
187
  end
167
188
 
189
+ # Enumerate over all available guides in order.
190
+ # @block {|guide| ... }
191
+ # @yield guide [Guide]
192
+ # @returns [Enumerator(Guide)]
168
193
  def guides
169
194
  return to_enum(:guides) unless block_given?
170
195
 
@@ -30,8 +30,8 @@ module Utopia
30
30
  # Provides structured access to a directory which contains documentation and source code to explain a specific process.
31
31
  class Guide
32
32
  # Initialize the example with the given root path.
33
- # @param base [Base] The base instance for the project.
34
- # @param root [String] The file-system path to the root of the example.
33
+ # @parameter base [Base] The base instance for the project.
34
+ # @parameter root [String] The file-system path to the root of the example.
35
35
  def initialize(base, root)
36
36
  @base = base
37
37
  @root = root
@@ -46,25 +46,25 @@ module Utopia
46
46
  end
47
47
 
48
48
  # The description from the first paragraph in the README.
49
- # @attr [String | Nil]
49
+ # @attribute [String | Nil]
50
50
  attr :description
51
51
 
52
52
  README = "README.md"
53
53
 
54
+ # The path to the README file for the guide.
55
+ # @returns [String] The file-system path.
54
56
  def readme_path
55
57
  File.expand_path(README, @root)
56
58
  end
57
59
 
60
+ # Does a README file exist for this guide?
61
+ # @returns [Boolean]
58
62
  def readme?
59
63
  File.exist?(readme_path)
60
64
  end
61
65
 
62
- def readme_document
63
- content = File.read(self.readme_path)
64
-
65
- return @base.document(content)
66
- end
67
-
66
+ # The document for the README, if one exists.
67
+ # @returns [Kramdown::Document]
68
68
  def document
69
69
  if self.readme?
70
70
  @document ||= self.readme_document.tap do |document|
@@ -89,31 +89,47 @@ module Utopia
89
89
  end
90
90
 
91
91
  # The base instance of the project this example is loaded from.
92
+ # @attribute [Base]
92
93
  attr :base
93
94
 
94
95
  # The file-system path to the root of the project.
96
+ # @attribute [String]
95
97
  attr :root
96
98
 
99
+ # The name of the guide.
100
+ # @returns [String]
97
101
  def name
98
102
  File.basename(@root)
99
103
  end
100
104
 
105
+ # The title of the guide.
106
+ # @returns [String]
101
107
  def title
102
108
  @title || Trenni::Strings.to_title(self.name)
103
109
  end
104
110
 
111
+ # The hypertext reference to this guide.
112
+ # @returns [String]
105
113
  def href
106
114
  "/guides/#{self.name}/index"
107
115
  end
108
116
 
117
+ # The best documentation, extracted from the source files of the guide.
118
+ # @returns [Decode::Documentation]
109
119
  def documentation
110
120
  @documentation ||= self.best_documentation
111
121
  end
112
122
 
123
+ # All files associated with this guide.
124
+ # @returns [Array(String)] The file-system paths.
113
125
  def files
114
126
  Dir.glob(File.expand_path("*", @root))
115
127
  end
116
128
 
129
+ # All the source files associated with this guide.
130
+ # @block {|source| ... } If a block is given.
131
+ # @yield source [Decode::Source]
132
+ # @returns [Enumerator(Decode::Source)] If no block is given.
117
133
  def sources
118
134
  return to_enum(:sources) unless block_given?
119
135
 
@@ -126,6 +142,12 @@ module Utopia
126
142
 
127
143
  private
128
144
 
145
+ def readme_document
146
+ content = File.read(self.readme_path)
147
+
148
+ return @base.document(content)
149
+ end
150
+
129
151
  def best_documentation
130
152
  if source = sources.first
131
153
  if segment = source.segments.first
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Utopia
24
24
  module Project
25
- VERSION = "0.7.1"
25
+ VERSION = "0.8.0"
26
26
  end
27
27
  end
@@ -41,9 +41,9 @@ module Utopia
41
41
 
42
42
  # Appends a project application to the rack builder.
43
43
  #
44
- # @param builder [Rack::Builder]
45
- # @param root [String] The file-system root path of the project/gem.
46
- # @param locales [Array(String)] an array of locales to support, e.g. `['en', 'ja']`.
44
+ # @parameter builder [Rack::Builder]
45
+ # @parameter root [String] The file-system root path of the project/gem.
46
+ # @parameter locales [Array(String)] an array of locales to support, e.g. `['en', 'ja']`.
47
47
  def self.call(builder, root = Dir.pwd, locales: nil)
48
48
  if UTOPIA.production?
49
49
  # Handle exceptions in production with a error page and send an email notification:
data/pages/_usage.xnode CHANGED
@@ -9,8 +9,8 @@
9
9
  ?>
10
10
  <h3><a href="#{guide.href}">#{guide.title}</a></h3>
11
11
 
12
- <?r if description = guide.documentation&.description ?>
13
- #{base.format(description.first, language: guide.documentation.language)}
12
+ <?r if documentation = guide.documentation ?>
13
+ #{base.format(documentation.details, language: guide.documentation.language)}
14
14
  <?r elsif description = guide.description ?>
15
15
  #{MarkupString.raw Kramdown::Document.new(description, syntax_highlighter: nil).to_html}
16
16
  <?r else ?>
@@ -14,7 +14,7 @@
14
14
  ?><h2><code>#{File.basename source.path}</code></h2><?r
15
15
  source.segments.each do |segment|
16
16
  if documentation = segment.documentation
17
- ?>#{base.format(documentation.description, language: source.language)}<?r
17
+ ?>#{base.format(documentation.text, language: source.language)}<?r
18
18
  end
19
19
 
20
20
  ?><pre><code class="language-#{source.language.name}">#{segment.code}</code></pre><?r
@@ -0,0 +1,40 @@
1
+ <?r
2
+ base = self[:base]
3
+ symbol = self[:symbol]
4
+ documentation = symbol&.documentation
5
+
6
+ if documentation.children?
7
+ ?>
8
+ <details open>
9
+ <summary><h4>Signature</h4></summary>
10
+ <dl><?r
11
+ documentation.traverse do |node, descend|
12
+ node.each do |child|
13
+ ?><dt>
14
+ <strong>#{child.directive}</strong><?r
15
+ case child
16
+ when Decode::Comment::Parameter
17
+ ?> <code class="syntax">#{child.name}</code> #{base.linkify(child.type, symbol)}<?r
18
+ when Decode::Comment::Returns
19
+ ?> #{base.linkify(child.type, symbol)}<?r
20
+ when Decode::Comment::Yields
21
+ ?> <code class="syntax language-#{symbol.language.name}">#{child.block}</code><?r
22
+ end
23
+ ?></dt><?r
24
+
25
+ if text = child.text
26
+ ?><dd>#{base.format(text, symbol)}</dd><?r
27
+ end
28
+
29
+ if child.children?
30
+ ?><dd><dl>
31
+ <?r descend.call(child) ?>
32
+ </dl></dd><?r
33
+ end
34
+ end
35
+ end
36
+ ?></dl>
37
+ </details>
38
+ <?r
39
+ end
40
+ ?>
@@ -15,7 +15,7 @@
15
15
  <a href="#{base.link_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></a>
16
16
 
17
17
  <?r if documentation ?>
18
- #{base.format(documentation.description.first, symbol)}
18
+ #{base.format(documentation.details, symbol)}
19
19
  <?r end ?>
20
20
 
21
21
  <?r if symbol.container?
@@ -1,15 +1,15 @@
1
1
  <content:page>
2
2
  <?r
3
- base = controller[:base]
4
- node = controller[:node]
5
- symbol = controller[:symbol]
3
+ base = self[:base]
4
+ node = self[:node]
5
+ symbol = self[:symbol]
6
6
  ?>
7
7
  <content:heading><code class="language-#{symbol.language.name}">#{symbol.qualified_name}</code></content:heading>
8
8
 
9
9
  <main>
10
10
  <?r
11
11
  if documentation = symbol.documentation
12
- ?>#{base.format(documentation.description.to_a.join("\n"), symbol)}<?r
12
+ ?>#{base.format(documentation.text.join("\n"), symbol)}<?r
13
13
  end
14
14
  ?>
15
15
 
@@ -38,25 +38,8 @@
38
38
  ?><h3 id="#{base.id_for(symbol)}"><code class="language-#{symbol.language.name}">#{symbol.long_form}</code></h3><?r
39
39
 
40
40
  if documentation = symbol.documentation
41
- ?>#{base.format(documentation.description, symbol)}<?r
42
- end
43
-
44
- parameters = documentation.parameters.to_a
45
-
46
- if parameters.any?
47
- ?><details open>
48
- <summary><h4>Parameters</h4></summary>
49
- <dl><?r
50
- parameters.each do |parameter|
51
- ?>
52
- <dt><code class="syntax">#{parameter[:name]}</code> &mdash; #{base.linkify(parameter[:type], symbol)}</dt>
53
- <?r if details = parameter[:details] ?>
54
- <dd>#{base.format(parameter[:details], symbol)}</dd>
55
- <?r end ?>
56
- <?r
57
- end
58
- ?></dl>
59
- </details><?r
41
+ ?>#{base.format(documentation.text, symbol)}<?r
42
+ ?>#{partial 'content:signature', symbol: symbol}<?r
60
43
  end
61
44
 
62
45
  if symbol.multiline?
@@ -13,15 +13,26 @@ html {
13
13
  font-size: 18px;
14
14
  --tab-size: 4;
15
15
  }
16
+
17
+ main > pre {
18
+ margin: 2rem;
19
+ }
16
20
  }
17
21
 
18
22
  @media (min-width: 80em) {
19
23
  html {
20
24
  font-size: 20px;
21
- --tab-size: 4;
22
25
  }
23
26
  }
24
27
 
28
+ p code {
29
+ padding: 0 0.2rem;
30
+ }
31
+
32
+ p code:first-child, p code:last-child {
33
+ padding: 0;
34
+ }
35
+
25
36
  pre {
26
37
  /* -moz-tab-size is still required by Firefox */
27
38
  --tab-size: 2;
@@ -96,10 +107,14 @@ nav {
96
107
  color: #aaa;
97
108
  }
98
109
 
99
- li {
110
+ li, dt, dd {
100
111
  margin: 0.5rem 0;
101
112
  }
102
113
 
114
+ details dt, details dd {
115
+ margin: 1rem 0;
116
+ }
117
+
103
118
  ul.index {
104
119
  padding: 0;
105
120
  list-style: none;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia-project
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-09 00:00:00.000000000 Z
11
+ date: 2020-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: utopia
@@ -185,23 +185,11 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
- - ".editorconfig"
189
- - ".github/workflows/development.yml"
190
- - ".gitignore"
191
- - ".rspec"
192
- - ".yarnrc"
193
- - README.md
194
188
  - bake/utopia/project.rb
195
- - gems.rb
196
- - guides/documentation-formatting/README.md
197
- - guides/getting-started/README.md
198
- - guides/github-pages-integration/README.md
199
- - guides/links.yaml
200
189
  - lib/utopia/project.rb
201
190
  - lib/utopia/project/base.rb
202
191
  - lib/utopia/project/guide.rb
203
192
  - lib/utopia/project/version.rb
204
- - package.json
205
193
  - pages/_heading.xnode
206
194
  - pages/_navigation.xnode
207
195
  - pages/_page.xnode
@@ -215,10 +203,10 @@ files:
215
203
  - pages/guides/show.xnode
216
204
  - pages/index.xnode
217
205
  - pages/links.yaml
206
+ - pages/source/_signature.xnode
218
207
  - pages/source/controller.rb
219
208
  - pages/source/index.xnode
220
209
  - pages/source/show.xnode
221
- - public/.nojekyll
222
210
  - public/_components/jquery-litebox/jquery.litebox.css
223
211
  - public/_components/jquery-litebox/jquery.litebox.gallery.css
224
212
  - public/_components/jquery-litebox/jquery.litebox.js
@@ -297,8 +285,6 @@ files:
297
285
  - template/Gemfile
298
286
  - template/config.ru
299
287
  - template/preload.rb
300
- - utopia-project.gemspec
301
- - yarn.lock
302
288
  homepage: https://github.com/socketry/utopia-project
303
289
  licenses:
304
290
  - MIT
@@ -309,9 +295,9 @@ require_paths:
309
295
  - lib
310
296
  required_ruby_version: !ruby/object:Gem::Requirement
311
297
  requirements:
312
- - - ">="
298
+ - - "~>"
313
299
  - !ruby/object:Gem::Version
314
- version: '0'
300
+ version: '2.5'
315
301
  required_rubygems_version: !ruby/object:Gem::Requirement
316
302
  requirements:
317
303
  - - ">="
data/.editorconfig DELETED
@@ -1,13 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
7
- [*.md]
8
- indent_style = tab
9
- indent_size = 2
10
-
11
- [.*]
12
- indent_style = tab
13
- indent_size = 2
@@ -1,62 +0,0 @@
1
- name: Development
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- test:
7
- runs-on: ${{matrix.os}}-latest
8
- continue-on-error: ${{matrix.experimental}}
9
-
10
- strategy:
11
- matrix:
12
- os:
13
- - ubuntu
14
- - macos
15
-
16
- ruby:
17
- - 2.5
18
- - 2.6
19
- - 2.7
20
-
21
- experimental: [false]
22
- env: [""]
23
-
24
- include:
25
- - os: ubuntu
26
- ruby: truffleruby
27
- experimental: true
28
- env: JRUBY_OPTS="--debug -X+O"
29
- - os: ubuntu
30
- ruby: jruby
31
- experimental: true
32
- - os: ubuntu
33
- ruby: head
34
- experimental: true
35
- - os: ubuntu
36
- ruby: 2.6
37
- experimental: false
38
- env: COVERAGE=PartialSummary,Coveralls
39
-
40
- steps:
41
- - uses: actions/checkout@v1
42
- - uses: ruby/setup-ruby@v1
43
- with:
44
- ruby-version: ${{matrix.ruby}}
45
-
46
- - name: Installing packages (ubuntu)
47
- if: matrix.os == 'ubuntu'
48
- run: sudo apt-get install wget pkg-config
49
-
50
- - name: Installing packages (macos)
51
- if: matrix.os == 'macos'
52
- run: brew install wget pkg-config
53
-
54
- - name: Install dependencies
55
- run: ${{matrix.env}} bundle install
56
-
57
- - name: Run tests
58
- timeout-minutes: 5
59
- run: |
60
- git config --global user.email "samuel@oriontransfer.net"
61
- git config --global user.name "Samuel Williams"
62
- ${{matrix.env}} bundle exec rspec
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- # Development specific:
2
- /.rspec_status
3
- /.bundle
4
- /pkg
5
- /gems.locked
6
-
7
- # Temporary data should not be added to the repository:
8
- /tmp
9
-
10
- # Node modules are 3rd party dependencies which can be fetched easily:
11
- /node_modules
12
-
13
- # This file should only ever exist on production, and may contain sensitive information:
14
- /config/environment.yaml
15
-
16
- # Ignore resized gallery photos:
17
- /public/_gallery
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --require spec_helper
data/.yarnrc DELETED
@@ -1 +0,0 @@
1
- --modules-folder lib/components
data/README.md DELETED
@@ -1,54 +0,0 @@
1
- # Utopia::Project
2
-
3
- A simple Ruby project documentation website.
4
-
5
- ## Motivation
6
-
7
- 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.
8
-
9
- 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.
10
-
11
- 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.
12
-
13
- ## Usage
14
-
15
- Please see the <a href="https://socketry.github.io/utopia-project/">project documentation</a> or run it locally using `bake utopia:project:serve`.
16
-
17
- ## Contributing
18
-
19
- We welcome contributions to this project.
20
-
21
- 1. Fork it
22
- 2. Create your feature branch (`git checkout -b my-new-feature`)
23
- 3. Commit your changes (`git commit -am 'Add some feature'`)
24
- 4. Push to the branch (`git push origin my-new-feature`)
25
- 5. Create new Pull Request
26
-
27
- ## See Also
28
-
29
- - [Utopia](https://github.com/socketry/utopia) — The website framework which powers this web application.
30
- - [Decode](https://github.com/ioquatix/decode) — The source code parser and cross-referencing library.
31
-
32
- ## License
33
-
34
- Released under the MIT license.
35
-
36
- Copyright, 2020, by [Samuel G. D. Williams](http://www.codeotaku.com).
37
-
38
- Permission is hereby granted, free of charge, to any person obtaining a copy
39
- of this software and associated documentation files (the "Software"), to deal
40
- in the Software without restriction, including without limitation the rights
41
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
42
- copies of the Software, and to permit persons to whom the Software is
43
- furnished to do so, subject to the following conditions:
44
-
45
- The above copyright notice and this permission notice shall be included in
46
- all copies or substantial portions of the Software.
47
-
48
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
54
- THE SOFTWARE.
data/gems.rb DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in utopia-project.gemspec
4
- gemspec
@@ -1,55 +0,0 @@
1
- # Documentation Formatting
2
-
3
- This guide explains the conventions used by `utopia-project` when generating documentation for your project.
4
-
5
- ## Source Code Documentation
6
-
7
- Source code documentation is expected to be in markdown format. This is different from the canonical `RDoc` format used by Ruby. However, using markdown is a good format for standardised documentation across a range of different languages.
8
-
9
- ### Tags
10
-
11
- #### `@param`
12
-
13
- The `@param` tag is used to describe the parameters of a method:
14
-
15
- ~~~ ruby
16
- # @param x [Integer] The x co-ordinate.
17
- # @param y [Integer] The y co-ordinate.
18
- def move(x, y)
19
- # ...
20
- end
21
- ~~~
22
-
23
- #### `@return`
24
-
25
- The `@return` tag is used to describe the return type of the definition:
26
-
27
- ~~~ ruby
28
- # @return [Integer] The result of the computation.
29
- def fib(n)
30
- # ...
31
- end
32
- ~~~
33
-
34
- ### References
35
-
36
- It is possible to insert references in your documentation using curly brackets. In the following example `{Input}` will be expanded relative to the usage, to some symbol named `Input`.
37
-
38
- ~~~ ruby
39
- # Frobulates the input, see {Input} for more details.
40
- def frobulate(input)
41
- # ... left to the imagination ...
42
- end
43
- ~~~
44
-
45
- ## Examples & Guides
46
-
47
- Examples provide structured information to help users understand your project and are located in the `examples/` directory. One sub-directory per example.
48
-
49
- ### `README.md`
50
-
51
- If an example has a `README.md` file, it is used as the main source of documentation.
52
-
53
- ### Source Files
54
-
55
- All other source files are listed on the example page. Top level comments with trailing code (segments) are used to help guide the user through the example.
@@ -1,31 +0,0 @@
1
- # Getting Started
2
-
3
- This guide explains how to use `utopia-project` for your own project.
4
-
5
- ## Installation
6
-
7
- Firstly, add the gem to your project:
8
-
9
- ~~~ bash
10
- $ bundle add utopia-project
11
- ~~~
12
-
13
- ## Start Local Server
14
-
15
- Start the local server to preview documentation:
16
-
17
- ~~~ bash
18
- $ bake utopia:project:serve
19
- ~~~
20
-
21
- Right now, this server does not reload the code index, so you will need to restart the server to update the code index. This will be fixed in the future.
22
-
23
- ## Generate Static Site
24
-
25
- You can generate a static copy of your documentation into the `docs/` folder:
26
-
27
- ~~~ bash
28
- $ bake utopia:project:static
29
- ~~~
30
-
31
- You can check the [guide for GitHub Pages](../github-pages-integration/index) which gives more details on how to deploy the static site using GitHub.
@@ -1,17 +0,0 @@
1
- # GitHub Pages Integration
2
-
3
- This guide shows you how to use `utopia-project` with GitHub Pages.
4
-
5
- ## Static Site Generation
6
-
7
- Once you are happy with your project's documentation, simply generate a static site:
8
-
9
- ~~~ bash
10
- $ bake utopia:project:static
11
- ~~~
12
-
13
- This will generate a static copy of your documentation into `docs/` which is what is required by GitHub Pages.
14
-
15
- ## Enable GitHub Pages
16
-
17
- In your GitHub project settings, you will need to [enable GitHub Pages served from `docs/`](https://help.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#choosing-a-publishing-source).
data/guides/links.yaml DELETED
@@ -1,6 +0,0 @@
1
- getting-started:
2
- order: 1
3
- documentation-formatting:
4
- order: 2
5
- github-pages-integration:
6
- order: 3
data/package.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "dependencies": {
3
- "jquery-litebox": "^1.0.2",
4
- "jquery-syntax": "^4.1.1"
5
- }
6
- }
data/public/.nojekyll DELETED
File without changes
@@ -1,35 +0,0 @@
1
- require_relative 'lib/utopia/project/version'
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "utopia-project"
5
- spec.version = Utopia::Project::VERSION
6
- spec.authors = ["Samuel Williams"]
7
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
8
-
9
- spec.summary = "A project documentation tool based on Utopia."
10
- spec.homepage = "https://github.com/socketry/utopia-project"
11
- spec.license = "MIT"
12
-
13
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
14
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(docs|test|spec|features)/}) }
15
- end
16
-
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_dependency "utopia", "~> 2.14"
20
- # spec.add_dependency "utopia-gallery"
21
-
22
- spec.add_dependency "kramdown"
23
- spec.add_dependency "decode", "~> 0.13"
24
- spec.add_dependency "rackula"
25
- spec.add_dependency "falcon"
26
- spec.add_dependency "thread-local"
27
-
28
- spec.add_development_dependency 'async-rspec'
29
- spec.add_development_dependency 'rack-test'
30
-
31
- spec.add_development_dependency 'covered'
32
- spec.add_development_dependency 'bundler'
33
- spec.add_development_dependency 'rspec'
34
- spec.add_development_dependency 'bake-bundler'
35
- end
data/yarn.lock DELETED
@@ -1,22 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-
5
- jquery-litebox@^1.0.2:
6
- version "1.0.2"
7
- resolved "https://registry.yarnpkg.com/jquery-litebox/-/jquery-litebox-1.0.2.tgz#122caec1e8ec1452f88d1d3eb3dd6f541f3f98c9"
8
- integrity sha1-EiyuwejsFFL4jR0+s91vVB8/mMk=
9
- dependencies:
10
- jquery ">=1.4.1"
11
-
12
- jquery-syntax@^4.1.1:
13
- version "4.1.1"
14
- resolved "https://registry.yarnpkg.com/jquery-syntax/-/jquery-syntax-4.1.1.tgz#8e15d85952cfee02dda579564eef4b813e5fe4f9"
15
- integrity sha512-W7HqdQV37N2r9JISW90liYaRNzam++0+zt3gFGzkAa/l4eHF11vyOKBhsadEhewYKBOsWSVIXqdcLtAxYgwT+g==
16
- dependencies:
17
- jquery ">=1.4.1"
18
-
19
- jquery@>=1.4.1:
20
- version "3.5.0"
21
- resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.0.tgz#9980b97d9e4194611c36530e7dc46a58d7340fc9"
22
- integrity sha512-Xb7SVYMvygPxbFMpTFQiHh1J7HClEaThguL15N/Gg37Lri/qKyhRGZYzHRyLH8Stq3Aow0LsHO2O2ci86fCrNQ==