yard_ghurt 1.2.0 → 1.2.2
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
- data/.yardopts +5 -0
- data/Gemfile +11 -19
- data/README.md +166 -148
- data/Rakefile +22 -45
- data/bin/yard_ghurt +5 -18
- data/lib/yard_ghurt/anchor_links.rb +97 -144
- data/lib/yard_ghurt/gfm_fix_task.rb +228 -256
- data/lib/yard_ghurt/ghp_sync_task.rb +53 -86
- data/lib/yard_ghurt/util.rb +80 -38
- data/lib/yard_ghurt/version.rb +4 -17
- data/lib/yard_ghurt.rb +27 -47
- data/yard_ghurt.gemspec +45 -49
- metadata +16 -59
- data/CHANGELOG.md +0 -56
- data/yard/templates/default/layout/html/footer.erb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2bfcf160b53592d1c17718a1811ade25bc5b9ca1a873f87f86cfecaa8978bb7
|
4
|
+
data.tar.gz: 927542fe06f6dd0945a172d7e5abf5118bd1cb712aeb0f04162d691f47c600dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b9ba1d972051bf73f3c36e6042ed40c150e4f7c98f55a2c2fcb4b43beae191f6a92da951f73494a7949e6dea3828d4ba6fb841bff43796ed0d937c04b06e53
|
7
|
+
data.tar.gz: 41bc4528945c3b394434f8926ae5bff3a5e965b8c402bbaf60cb510efaa10fd8061795a409a05b3e902a67cbc28f7a26aa471bd525af4b10c595dfb7eb77ceee
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
@@ -1,25 +1,17 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#--
|
5
|
-
# This file is part of YardGhurt.
|
6
|
-
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
7
|
-
#
|
8
|
-
# YardGhurt is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# YardGhurt is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
|
22
|
-
|
23
4
|
source 'https://rubygems.org'
|
24
5
|
|
25
6
|
gemspec
|
7
|
+
|
8
|
+
group :development,:test do
|
9
|
+
gem 'bundler' ,'~> 2.6'
|
10
|
+
|
11
|
+
gem 'rdoc' ,'~> 6.14' # For RDoc for YARD (*.rb).
|
12
|
+
gem 'redcarpet','~> 3.6' # For Markdown for YARD (*.md).
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
# gem 'minitest' ,'~> 5.25'
|
17
|
+
end
|
data/README.md
CHANGED
@@ -1,189 +1,201 @@
|
|
1
1
|
# YardGhurt
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/yard_ghurt)
|
4
|
-
|
5
|
-
[](CHANGELOG.md)
|
8
|
-
[](LICENSE.txt)
|
4
|
+
[](https://esotericpig.github.io/docs/yard_ghurt/yardoc/index.html)
|
5
|
+
[](https://github.com/esotericpig/yard_ghurt)
|
6
|
+
[](LICENSE.txt)
|
9
7
|
|
10
8
|
<u>YARD</u>oc <u>G</u>it<u>Hu</u>b <u>R</u>ake <u>T</u>asks
|
11
9
|
|
12
10
|
- Fix GitHub Flavored Markdown files.
|
13
11
|
- Sync YARDoc to a local GitHub Pages repo.
|
14
12
|
|
15
|
-
## Contents
|
13
|
+
## // Contents
|
16
14
|
|
17
|
-
- [Setup](
|
18
|
-
- [Using](
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- [CLI App](
|
24
|
-
- [Hacking](
|
25
|
-
|
26
|
-
- [Tests](
|
27
|
-
- [License](
|
15
|
+
- [Setup](#-setup)
|
16
|
+
- [Using](#-using)
|
17
|
+
- [GFMFixTask](#-gfmfixtask)
|
18
|
+
- [GHPSyncTask](#-ghpsynctask)
|
19
|
+
- [Util / YardGhurt](#-util--yardghurt)
|
20
|
+
- [AnchorLinks](#-anchorlinks)
|
21
|
+
- [CLI App](#-cli-app)
|
22
|
+
- [Hacking](#-hacking)
|
23
|
+
- [Testing](#-testing)
|
24
|
+
- [Tests](#-tests)
|
25
|
+
- [License](#-license)
|
28
26
|
|
29
|
-
## [
|
27
|
+
## [//](#-contents) Setup
|
30
28
|
|
31
29
|
Pick your poison...
|
32
30
|
|
33
31
|
With the RubyGems CLI package manager:
|
34
32
|
|
35
|
-
|
33
|
+
```bash
|
34
|
+
gem install yard_ghurt
|
35
|
+
```
|
36
36
|
|
37
|
-
In your *Gemspec
|
37
|
+
In your *Gemspec*:
|
38
38
|
|
39
|
-
```
|
39
|
+
```ruby
|
40
40
|
spec.add_development_dependency 'yard_ghurt', '~> X.X.X'
|
41
41
|
```
|
42
42
|
|
43
43
|
In your *Gemfile*:
|
44
44
|
|
45
|
-
```
|
46
|
-
gem 'yard_ghurt', '~> X.X.X', :
|
45
|
+
```ruby
|
46
|
+
gem 'yard_ghurt', '~> X.X.X', group: %i[development test]
|
47
47
|
# or...
|
48
|
-
gem 'yard_ghurt', :
|
49
|
-
:
|
48
|
+
gem 'yard_ghurt', git: 'https://github.com/esotericpig/yard_ghurt.git',
|
49
|
+
branch: main, group: %i[development test]
|
50
50
|
```
|
51
51
|
|
52
|
-
|
52
|
+
From source:
|
53
53
|
|
54
|
-
```
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
```bash
|
55
|
+
git clone --depth 1 'https://github.com/esotericpig/yard_ghurt.git'
|
56
|
+
cd yard_ghurt
|
57
|
+
bundle install
|
58
|
+
bundle exec rake install:local
|
59
59
|
```
|
60
60
|
|
61
|
-
## [
|
61
|
+
## [//](#-contents) Using
|
62
|
+
|
63
|
+
Currently, you can't use this project as a YARDoc Plugin, but planning on it for v2.0. Read the [TODO](TODO.md) for more info.
|
62
64
|
|
63
65
|
**Rake Tasks:**
|
64
66
|
|
65
|
-
| Task
|
66
|
-
|
67
|
-
| [GFMFixTask](
|
68
|
-
| [GHPSyncTask](
|
67
|
+
| Task | Description |
|
68
|
+
|------------------------------|-------------------------------------------|
|
69
|
+
| [GFMFixTask](#-gfmfixtask) | Fix GitHub Flavored Markdown files. |
|
70
|
+
| [GHPSyncTask](#-ghpsynctask) | Sync YARDoc to a local GitHub Pages repo. |
|
69
71
|
|
70
72
|
**Helpers:**
|
71
73
|
|
72
|
-
| Helper
|
73
|
-
|
74
|
-
| [Util / YardGhurt](
|
75
|
-
| [AnchorLinks](
|
74
|
+
| Helper | Description |
|
75
|
+
|---------------------------------------|-------------------------------|
|
76
|
+
| [Util / YardGhurt](#-util--yardghurt) | Utility methods for tasks. |
|
77
|
+
| [AnchorLinks](#-anchorlinks) | A “database” of anchor links. |
|
76
78
|
|
77
|
-
### [
|
79
|
+
### [//](#-contents) GFMFixTask
|
78
80
|
|
79
81
|
Fix (find & replace) text in the GitHub Flavored Markdown (GFM) files in the YARDoc directory, for differences between the two formats.
|
80
82
|
|
83
|
+
**Very Important!**
|
84
|
+
|
85
|
+
In order for this to work, you must also add `redcarpet` as a dependency (per YARDoc's documentation), else, you'll get a bunch of `label-*` relative links.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
gem 'redcarpet','~> X.X' # For YARDoc Markdown (*.md).
|
89
|
+
```
|
90
|
+
|
81
91
|
You can set *dry_run* on the command line:
|
82
92
|
|
83
|
-
|
93
|
+
```bash
|
94
|
+
rake yard_gfm_fix dryrun=true
|
95
|
+
```
|
84
96
|
|
85
97
|
**What I typically use:**
|
86
98
|
|
87
|
-
```
|
88
|
-
YardGhurt::GFMFixTask.new
|
89
|
-
task.arg_names = [
|
99
|
+
```ruby
|
100
|
+
YardGhurt::GFMFixTask.new do |task|
|
101
|
+
task.arg_names = %i[dev]
|
90
102
|
task.dry_run = false
|
91
103
|
task.fix_code_langs = true
|
92
104
|
task.md_files = ['index.html']
|
93
|
-
|
94
|
-
task.before =
|
95
|
-
# Delete this file as it's never used (index.html is an exact copy)
|
96
|
-
YardGhurt.rm_exist(File.join(
|
97
|
-
|
98
|
-
# Root dir of my GitHub Page for CSS/JS
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
105
|
+
|
106
|
+
task.before = proc do |task2,args|
|
107
|
+
# Delete this file as it's never used (`index.html` is an exact copy).
|
108
|
+
YardGhurt.rm_exist(File.join(task2.doc_dir,'file.README.html'))
|
109
|
+
|
110
|
+
# Root dir of my GitHub Page for CSS/JS.
|
111
|
+
ghp_root_dir = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
|
112
|
+
|
113
|
+
task2.css_styles << %(<link rel="stylesheet" type="text/css" href="#{ghp_root_dir}/css/prism.css" />)
|
114
|
+
task2.js_scripts << %(<script src="#{ghp_root_dir}/js/prism.js"></script>)
|
103
115
|
end
|
104
116
|
end
|
105
117
|
```
|
106
118
|
|
107
|
-
**
|
119
|
+
**All options:**
|
108
120
|
|
109
|
-
```
|
121
|
+
```ruby
|
110
122
|
YardGhurt::GFMFixTask.new(:yard_fix) do |task|
|
111
|
-
task.anchor_db = {'tests' => 'Testing'} #
|
112
|
-
task.arg_names << :name # Custom args
|
113
|
-
task.css_styles << '<link rel="stylesheet" href="css/my_css.css" />' # Inserted at
|
114
|
-
task.css_styles << '<style>body{ background-color: linen; }</style>'
|
115
|
-
task.custom_gsub =
|
123
|
+
task.anchor_db = {'tests' => 'Testing'} # Anchor links `#tests` become `#Testing`.
|
124
|
+
task.arg_names << :name # Custom args.
|
125
|
+
task.css_styles << '<link rel="stylesheet" href="css/my_css.css" />' # Inserted at `</head>`.
|
126
|
+
task.css_styles << '<style>body { background-color: linen; }</style>'
|
127
|
+
task.custom_gsub = proc { |line| !line.gsub!('YardGhurt','YARD GHURT!').nil? }
|
116
128
|
task.custom_gsubs << [/newline/i,'Do you smell what The Rock is cooking?']
|
117
|
-
task.deps << :yard # Custom dependencies
|
129
|
+
task.deps << :yard # Custom dependencies.
|
118
130
|
task.description = 'Fix it'
|
119
131
|
task.doc_dir = 'doc'
|
120
|
-
task.dry_run =
|
132
|
+
task.dry_run = true
|
121
133
|
task.exclude_code_langs = Set['ruby']
|
122
134
|
task.fix_anchor_links = true
|
123
135
|
task.fix_code_langs = true
|
124
136
|
task.fix_file_links = true
|
125
|
-
task.js_scripts << '<script src="js/my_js.js"></script>' # Inserted at
|
137
|
+
task.js_scripts << '<script src="js/my_js.js"></script>' # Inserted at `</body>`.
|
126
138
|
task.js_scripts << '<script>document.write("Hello World!");</script>'
|
127
139
|
task.md_files = ['index.html']
|
128
140
|
task.verbose = false
|
129
|
-
|
130
|
-
task.before =
|
131
|
-
task.during =
|
132
|
-
task.after =
|
141
|
+
|
142
|
+
task.before = proc { |_task2,args| puts "Hi, #{args.name}!" }
|
143
|
+
task.during = proc { |_task2,args,file| puts "#{args.name} can haz #{file}?" }
|
144
|
+
task.after = proc { |_task2,args| puts "Goodbye, #{args.name}!" }
|
133
145
|
end
|
134
146
|
```
|
135
147
|
|
136
|
-
### [
|
148
|
+
### [//](#-contents) GHPSyncTask
|
137
149
|
|
138
150
|
Sync YARDoc to a local GitHub Pages repo (uses `rsync` by default).
|
139
151
|
|
140
152
|
**What I typically use:**
|
141
153
|
|
142
|
-
```
|
143
|
-
YardGhurt::GHPSyncTask.new
|
154
|
+
```ruby
|
155
|
+
YardGhurt::GHPSyncTask.new do |task|
|
144
156
|
task.ghp_dir = '../esotericpig.github.io/docs/yard_ghurt/yardoc'
|
145
157
|
task.sync_args << '--delete-after'
|
146
158
|
end
|
147
159
|
```
|
148
160
|
|
149
|
-
**
|
161
|
+
**All options:**
|
150
162
|
|
151
|
-
```
|
152
|
-
# Execute: rake ghp_doc[false,'
|
163
|
+
```ruby
|
164
|
+
# Execute: rake ghp_doc[false,'Custom']
|
153
165
|
YardGhurt::GHPSyncTask.new(:ghp_doc) do |task|
|
154
|
-
task.arg_names << :name # Custom args
|
155
|
-
task.deps << :yard # Custom dependencies
|
166
|
+
task.arg_names << :name # Custom args ('Custom').
|
167
|
+
task.deps << :yard # Custom dependencies.
|
156
168
|
task.description = 'Rsync my_doc/ to my page'
|
157
|
-
task.doc_dir = 'my_doc' # YARDoc directory of generated files
|
169
|
+
task.doc_dir = 'my_doc' # YARDoc directory of generated files.
|
158
170
|
task.ghp_dir = '../dest_dir/my_page'
|
159
|
-
task.strict = true # Fail if doc_dir doesn't exist
|
171
|
+
task.strict = true # Fail if doc_dir doesn't exist.
|
160
172
|
task.sync_args << '--delete-after'
|
161
173
|
task.sync_cmd = '/usr/bin/rsync'
|
162
|
-
|
163
|
-
task.before =
|
164
|
-
task.after =
|
174
|
+
|
175
|
+
task.before = proc { |_task2,args| puts "Hi, #{args.name}!" }
|
176
|
+
task.after = proc { |_task2,args| puts "Goodbye, #{args.name}!" }
|
165
177
|
end
|
166
178
|
```
|
167
179
|
|
168
|
-
### [Util / YardGhurt
|
180
|
+
### [//](#-contents) Util / YardGhurt
|
169
181
|
|
170
182
|
Utility methods for tasks.
|
171
183
|
|
172
|
-
```
|
184
|
+
```ruby
|
173
185
|
require 'yard_ghurt/util'
|
174
186
|
|
175
|
-
# If the file exists, delete it, and if
|
187
|
+
# If the file exists, delete it, and if `output` is true, log it to stdout.
|
176
188
|
YardGhurt::Util.rm_exist('doc/file.README.html')
|
177
189
|
YardGhurt::Util.rm_exist('doc/file.README.html',false)
|
178
190
|
|
179
|
-
# Convert an Object to true or false
|
180
|
-
puts YardGhurt::Util.to_bool('true')
|
181
|
-
puts YardGhurt::Util.to_bool('on')
|
182
|
-
puts YardGhurt::Util.to_bool('yes')
|
183
|
-
puts YardGhurt::Util.to_bool(nil)
|
191
|
+
# Convert an Object to true or false.
|
192
|
+
puts YardGhurt::Util.to_bool('true') #=> true
|
193
|
+
puts YardGhurt::Util.to_bool('on') #=> true
|
194
|
+
puts YardGhurt::Util.to_bool('yes') #=> true
|
195
|
+
puts YardGhurt::Util.to_bool(nil) #=> false
|
184
196
|
```
|
185
197
|
|
186
|
-
For convenience, *Util*'s methods are also included in the top module *YardGhurt*. However, this will also include all
|
198
|
+
For convenience, *Util*'s methods are also included in the top module *YardGhurt*. However, this will also include all the Tasks and Helpers, so *Util* is preferred, unless you're already requiring *yard_ghurt*.
|
187
199
|
|
188
200
|
```Ruby
|
189
201
|
require 'yard_ghurt'
|
@@ -192,64 +204,62 @@ YardGhurt.rm_exist('doc/file.README.html')
|
|
192
204
|
puts YardGhurt.to_bool('true')
|
193
205
|
```
|
194
206
|
|
195
|
-
### [
|
207
|
+
### [//](#-contents) AnchorLinks
|
208
|
+
|
196
209
|
A “database” of anchor links specific to GitHub Flavored Markdown (GFM) and YARDoc.
|
197
210
|
|
198
211
|
You can use this by itself to view what anchor IDs would be generated:
|
199
212
|
|
200
|
-
```
|
213
|
+
```ruby
|
201
214
|
require 'yard_ghurt/anchor_links'
|
202
215
|
|
203
|
-
al = YardGhurt::AnchorLinks.new
|
216
|
+
al = YardGhurt::AnchorLinks.new
|
204
217
|
|
205
|
-
puts al.to_github_anchor_id('This is a test!')
|
206
|
-
puts al.to_yard_anchor_id('This is a test!')
|
207
|
-
|
208
|
-
# Output:
|
209
|
-
# ---
|
210
|
-
# this-is-a-test
|
211
|
-
# This_is_a_test_
|
218
|
+
puts al.to_github_anchor_id('This is a test!') #=> this-is-a-test
|
219
|
+
puts al.to_yard_anchor_id('This is a test!') #=> This_is_a_test_
|
212
220
|
```
|
213
221
|
|
214
|
-
Be aware that YARDoc depends on a common number that will be incremented for all duplicates, while GFM's number is only local to each
|
222
|
+
Be aware that YARDoc depends on a common number that will be incremented for all duplicates, while GFM's number is only local to each duplicate:
|
215
223
|
|
216
|
-
```
|
217
|
-
al = YardGhurt::AnchorLinks.new
|
224
|
+
```ruby
|
225
|
+
al = YardGhurt::AnchorLinks.new
|
218
226
|
name = 'This is a test!'
|
219
227
|
|
220
|
-
puts al.to_yard_anchor_id(name)
|
221
|
-
puts al.to_yard_anchor_id(name)
|
228
|
+
puts al.to_yard_anchor_id(name) #=> This_is_a_test_
|
229
|
+
puts al.to_yard_anchor_id(name) #=> This_is_a_test_
|
222
230
|
|
223
|
-
puts al.to_github_anchor_id(name)
|
224
|
-
puts al.to_github_anchor_id(name)
|
231
|
+
puts al.to_github_anchor_id(name) #=> this-is-a-test
|
232
|
+
puts al.to_github_anchor_id(name) #=> this-is-a-test
|
225
233
|
|
226
|
-
al << name # Officially add it to the database
|
234
|
+
al << name # Officially add it to the database.
|
227
235
|
|
228
|
-
# Instead of being 0 & 0, will be 0 & 1 (incremented),
|
229
|
-
# even without being added to the database
|
230
|
-
puts al.to_yard_anchor_id(name)
|
231
|
-
puts al.to_yard_anchor_id(name)
|
236
|
+
# Instead of being 0 & 0, it will be 0 & 1 (incremented),
|
237
|
+
# even without being added to the database.
|
238
|
+
puts al.to_yard_anchor_id(name) #=> This_is_a_test_0
|
239
|
+
puts al.to_yard_anchor_id(name) #=> This_is_a_test_1
|
232
240
|
|
233
|
-
puts al.to_github_anchor_id(name)
|
234
|
-
puts al.to_github_anchor_id(name)
|
241
|
+
puts al.to_github_anchor_id(name) #=> this-is-a-test-1
|
242
|
+
puts al.to_github_anchor_id(name) #=> this-is-a-test-1
|
235
243
|
|
236
244
|
name = 'This is another test!'
|
237
|
-
al << name # Officially add it to the database
|
245
|
+
al << name # Officially add it to the database.
|
238
246
|
|
239
|
-
# Instead of being 0 & 1, will be 2 & 3 (global increment),
|
240
|
-
# even without being added to the database
|
241
|
-
puts al.to_yard_anchor_id(name)
|
242
|
-
puts al.to_yard_anchor_id(name)
|
247
|
+
# Instead of being 0 & 1, it will be 2 & 3 (global increment),
|
248
|
+
# even without being added to the database.
|
249
|
+
puts al.to_yard_anchor_id(name) #=> This_is_another_test_2
|
250
|
+
puts al.to_yard_anchor_id(name) #=> This_is_another_test_3
|
243
251
|
|
244
|
-
puts al.to_github_anchor_id(name)
|
245
|
-
puts al.to_github_anchor_id(name)
|
252
|
+
puts al.to_github_anchor_id(name) #=> this-is-another-test-1
|
253
|
+
puts al.to_github_anchor_id(name) #=> this-is-another-test-1
|
246
254
|
```
|
247
255
|
|
248
|
-
## [
|
256
|
+
## [//](#-contents) CLI App
|
257
|
+
|
249
258
|
A CLI app has been added for convenience for when writing your own README.
|
250
259
|
|
251
260
|
On the command line:
|
252
|
-
|
261
|
+
|
262
|
+
```bash
|
253
263
|
$ yard_ghurt -g "What's this ID?"
|
254
264
|
# => whats-this-id
|
255
265
|
|
@@ -262,6 +272,7 @@ $ yard_ghurt -a "What's this ID?"
|
|
262
272
|
```
|
263
273
|
|
264
274
|
Help:
|
275
|
+
|
265
276
|
```
|
266
277
|
Usage: yard_ghurt [options]
|
267
278
|
-a, --anchor <string> Print GitHub & YARDoc anchor link IDs of <string>
|
@@ -272,23 +283,28 @@ Usage: yard_ghurt [options]
|
|
272
283
|
-v, --version Print the version
|
273
284
|
```
|
274
285
|
|
275
|
-
## [
|
286
|
+
## [//](#-contents) Hacking
|
276
287
|
|
277
|
-
```
|
278
|
-
|
279
|
-
|
280
|
-
|
288
|
+
```bash
|
289
|
+
git clone 'https://github.com/esotericpig/yard_ghurt.git'
|
290
|
+
cd yard_ghurt
|
291
|
+
bundle install
|
292
|
+
bundle exec rake -T
|
281
293
|
```
|
282
294
|
|
283
|
-
### [
|
295
|
+
### [//](#-contents) Testing
|
284
296
|
|
285
297
|
First, execute this:
|
286
298
|
|
287
|
-
|
299
|
+
```bash
|
300
|
+
bundle exec rake clobber yard yard_gfm_fix[true]
|
301
|
+
```
|
288
302
|
|
289
303
|
Then execute this and make sure there are no warnings and no changes:
|
290
304
|
|
291
|
-
|
305
|
+
```bash
|
306
|
+
bundle exec rake yard_gfm_fix[true]
|
307
|
+
```
|
292
308
|
|
293
309
|
It should output this:
|
294
310
|
|
@@ -299,13 +315,15 @@ It should output this:
|
|
299
315
|
= Nothing written (up-to-date)
|
300
316
|
```
|
301
317
|
|
302
|
-
Then open up
|
318
|
+
Then open up [doc/index.html](doc/index.html) and check all the [anchor links](#-tests), [local file links](#-license), etc.
|
303
319
|
|
304
320
|
Lastly, the 2 files should be almost identical, except for 1 line:
|
305
321
|
|
306
|
-
|
322
|
+
```bash
|
323
|
+
diff doc/index.html doc/file.README.html
|
324
|
+
```
|
307
325
|
|
308
|
-
## [
|
326
|
+
## [//](#-contents) Tests
|
309
327
|
|
310
328
|
These are actual tests for this gem.
|
311
329
|
|
@@ -321,17 +339,17 @@ These are actual tests for this gem.
|
|
321
339
|
- [中文?](#中文)
|
322
340
|
- [汉语?](#汉语)
|
323
341
|
|
324
|
-
### [This is Test #1](
|
325
|
-
### [This-is-Test-#2](
|
326
|
-
### [This_is_Test_#3](
|
327
|
-
### ["This is Test #4"](
|
328
|
-
### ["This is Test #4"](
|
329
|
-
### [this is test #5](
|
330
|
-
### [THIS IS TEST #6](
|
331
|
-
### [日本語?](
|
332
|
-
### [テスト?](
|
333
|
-
### [中文?](
|
334
|
-
### [汉语?](
|
342
|
+
### [This is Test #1](#-tests)
|
343
|
+
### [This-is-Test-#2](#-tests)
|
344
|
+
### [This_is_Test_#3](#-tests)
|
345
|
+
### ["This is Test #4"](#-tests)
|
346
|
+
### ["This is Test #4"](#-tests)
|
347
|
+
### [this is test #5](#-tests)
|
348
|
+
### [THIS IS TEST #6](#-tests)
|
349
|
+
### [日本語?](#-tests)
|
350
|
+
### [テスト?](#-tests)
|
351
|
+
### [中文?](#-tests)
|
352
|
+
### [汉语?](#-tests)
|
335
353
|
|
336
354
|
```
|
337
355
|
Newline
|
@@ -347,12 +365,12 @@ Newline
|
|
347
365
|
Newline
|
348
366
|
```
|
349
367
|
|
350
|
-
## [
|
368
|
+
## [//](#-contents) License
|
351
369
|
|
352
370
|
[GNU LGPL v3+](LICENSE.txt)
|
353
371
|
|
354
372
|
> YardGhurt (<https://github.com/esotericpig/yard_ghurt>)
|
355
|
-
> Copyright (c) 2019-
|
373
|
+
> Copyright (c) 2019-2025 Bradley Whited
|
356
374
|
>
|
357
375
|
> YardGhurt is free software: you can redistribute it and/or modify
|
358
376
|
> it under the terms of the GNU Lesser General Public License as published by
|
data/Rakefile
CHANGED
@@ -1,68 +1,45 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
#--
|
5
|
-
# This file is part of YardGhurt.
|
6
|
-
# Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
|
7
|
-
#
|
8
|
-
# YardGhurt is free software: you can redistribute it and/or modify
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# YardGhurt is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
|
20
|
-
#++
|
21
|
-
|
22
|
-
|
23
4
|
require 'bundler/gem_tasks'
|
24
5
|
|
6
|
+
require 'rake/clean'
|
25
7
|
require 'yard'
|
26
8
|
require 'yard_ghurt'
|
27
9
|
|
28
|
-
|
29
|
-
|
30
|
-
task default: [:yard,:yard_gfm_fix]
|
10
|
+
task default: %i[doc]
|
31
11
|
|
32
|
-
CLEAN.exclude('.git/','stock/')
|
12
|
+
CLEAN.exclude('.git/','.github/','.idea/','stock/')
|
33
13
|
CLOBBER.include('doc/')
|
34
14
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
task.options += ['--readme','README.md']
|
40
|
-
|
41
|
-
task.options << '--protected' # Show protected methods
|
42
|
-
task.options += ['--template-path',File.join('yard','templates')]
|
43
|
-
task.options += ['--title',"YardGhurt v#{YardGhurt::VERSION} Doc"]
|
44
|
-
end
|
15
|
+
# TEST: To test using different Gem versions:
|
16
|
+
# GST=1 bundle update && bundle exec rake doc
|
17
|
+
desc 'Generate doc'
|
18
|
+
task doc: %i[yard yard_gfm_fix]
|
45
19
|
|
46
|
-
|
47
|
-
task
|
20
|
+
YARD::Rake::YardocTask.new do |task|
|
21
|
+
task.files = ['lib/**/*.rb']
|
22
|
+
task.options.push('--title',"YardGhurt v#{YardGhurt::VERSION}")
|
48
23
|
end
|
49
24
|
|
50
|
-
YardGhurt::GFMFixTask.new
|
51
|
-
task.arg_names = [
|
25
|
+
YardGhurt::GFMFixTask.new do |task|
|
26
|
+
task.arg_names = %i[dev]
|
52
27
|
task.dry_run = false
|
53
28
|
task.fix_code_langs = true
|
54
|
-
|
55
|
-
task.before =
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
29
|
+
|
30
|
+
task.before = proc do |task2,args|
|
31
|
+
# NOTE: Do not delete `file.README.html`, as we need it for testing.
|
32
|
+
|
33
|
+
# Root dir of my GitHub Page for CSS/JS.
|
34
|
+
ghp_root_dir = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
|
35
|
+
|
36
|
+
task2.css_styles << %(<link rel="stylesheet" type="text/css" href="#{ghp_root_dir}/css/prism.css" />)
|
37
|
+
task2.js_scripts << %(<script src="#{ghp_root_dir}/js/prism.js"></script>)
|
61
38
|
end
|
62
39
|
end
|
63
40
|
|
64
41
|
# Probably not useful for others.
|
65
|
-
YardGhurt::GHPSyncTask.new
|
42
|
+
YardGhurt::GHPSyncTask.new do |task|
|
66
43
|
task.ghp_dir = '../esotericpig.github.io/docs/yard_ghurt/yardoc'
|
67
44
|
task.sync_args << '--delete-after'
|
68
45
|
end
|