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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d6655a3fefa8677dd2b00ea73dbd7b87cf1c6d13b888ed67c29feb899f2555e
4
- data.tar.gz: 52ffccc6f6a7d98e7865396b1c8c3e2b8c9a58452d3e724b0d0eb0c75e3495ab
3
+ metadata.gz: c2bfcf160b53592d1c17718a1811ade25bc5b9ca1a873f87f86cfecaa8978bb7
4
+ data.tar.gz: 927542fe06f6dd0945a172d7e5abf5118bd1cb712aeb0f04162d691f47c600dd
5
5
  SHA512:
6
- metadata.gz: bcab8039ee10ff48858cd161483bbbc32ebe23a038f32303defe23081932ab4bc97b7e0d64a4de15307c14993cdf4d311d7385ed00a920af324b641b3e11d110
7
- data.tar.gz: 31b278e7cbc842b3431eda53f8737bf957ff7068c4796ca984c0362040777b31f8542270e0844942b7a47906b464a41be7cf155712f4a9f1a05b2a41c391ad93
6
+ metadata.gz: b0b9ba1d972051bf73f3c36e6042ed40c150e4f7c98f55a2c2fcb4b43beae191f6a92da951f73494a7949e6dea3828d4ba6fb841bff43796ed0d937c04b06e53
7
+ data.tar.gz: 41bc4528945c3b394434f8926ae5bff3a5e965b8c402bbaf60cb510efaa10fd8061795a409a05b3e902a67cbc28f7a26aa471bd525af4b10c595dfb7eb77ceee
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ --charset 'UTF-8'
2
+ --embed-mixins
3
+ --files 'LICENSE.txt,TODO.md'
4
+ --protected
5
+ --readme 'README.md'
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
  [![Gem Version](https://badge.fury.io/rb/yard_ghurt.svg)](https://badge.fury.io/rb/yard_ghurt)
4
-
5
- [![Documentation](https://img.shields.io/badge/doc-yard-%23A0522D.svg?style=for-the-badge)](https://esotericpig.github.io/docs/yard_ghurt/yardoc/index.html)
6
- [![Source Code](https://img.shields.io/badge/source-github-%23A0522D.svg?style=for-the-badge)](https://github.com/esotericpig/yard_ghurt)
7
- [![Changelog](https://img.shields.io/badge/changelog-md-%23A0522D.svg?style=for-the-badge)](CHANGELOG.md)
8
- [![License](https://img.shields.io/github/license/esotericpig/yard_ghurt.svg?color=%23A0522D&style=for-the-badge)](LICENSE.txt)
4
+ [![Documentation](https://img.shields.io/badge/doc-yard-%23A0522D.svg)](https://esotericpig.github.io/docs/yard_ghurt/yardoc/index.html)
5
+ [![Source Code](https://img.shields.io/badge/source-github-%23211F1F.svg)](https://github.com/esotericpig/yard_ghurt)
6
+ [![License](https://img.shields.io/github/license/esotericpig/yard_ghurt.svg)](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](#setup)
18
- - [Using](#using)
19
- - [GFMFixTask](#gfmfixtask)
20
- - [GHPSyncTask](#ghpsynctask)
21
- - [Util / YardGhurt](#util--yardghurt)
22
- - [AnchorLinks](#anchorlinks)
23
- - [CLI App](#cli-app)
24
- - [Hacking](#hacking)
25
- - [Testing](#testing)
26
- - [Tests](#tests)
27
- - [License](#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
- ## [Setup](#contents)
27
+ ## [//](#-contents) Setup
30
28
 
31
29
  Pick your poison...
32
30
 
33
31
  With the RubyGems CLI package manager:
34
32
 
35
- `$ gem install yard_ghurt`
33
+ ```bash
34
+ gem install yard_ghurt
35
+ ```
36
36
 
37
- In your *Gemspec* (*&lt;project&gt;.gemspec*):
37
+ In your *Gemspec*:
38
38
 
39
- ```Ruby
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
- ```Ruby
46
- gem 'yard_ghurt', '~> X.X.X', :group => [:development, :test]
45
+ ```ruby
46
+ gem 'yard_ghurt', '~> X.X.X', group: %i[development test]
47
47
  # or...
48
- gem 'yard_ghurt', :git => 'https://github.com/esotericpig/yard_ghurt.git',
49
- :tag => 'vX.X.X', :group => [:development, :test]
48
+ gem 'yard_ghurt', git: 'https://github.com/esotericpig/yard_ghurt.git',
49
+ branch: main, group: %i[development test]
50
50
  ```
51
51
 
52
- Manually:
52
+ From source:
53
53
 
54
- ```
55
- $ git clone 'https://github.com/esotericpig/yard_ghurt.git'
56
- $ cd yard_ghurt
57
- $ bundle install
58
- $ bundle exec rake install:local
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
- ## [Using](#contents)
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 | Description |
66
- | --- | --- |
67
- | [GFMFixTask](#gfmfixtask) | Fix GitHub Flavored Markdown files |
68
- | [GHPSyncTask](#ghpsynctask) | Sync YARDoc to a local GitHub Pages repo. |
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 | Description |
73
- | --- | --- |
74
- | [Util / YardGhurt](#util--yardghurt) | Utility methods for tasks |
75
- | [AnchorLinks](#anchorlinks) | A “database” of anchor links |
74
+ | Helper | Description |
75
+ |---------------------------------------|-------------------------------|
76
+ | [Util / YardGhurt](#-util--yardghurt) | Utility methods for tasks. |
77
+ | [AnchorLinks](#-anchorlinks) | A “database” of anchor links. |
76
78
 
77
- ### [GFMFixTask](#using)
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
- `$ rake yard_gfm_fix dryrun=true`
93
+ ```bash
94
+ rake yard_gfm_fix dryrun=true
95
+ ```
84
96
 
85
97
  **What I typically use:**
86
98
 
87
- ```Ruby
88
- YardGhurt::GFMFixTask.new() do |task|
89
- task.arg_names = [:dev]
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 = Proc.new() do |task,args|
95
- # Delete this file as it's never used (index.html is an exact copy)
96
- YardGhurt.rm_exist(File.join(task.doc_dir,'file.README.html'))
97
-
98
- # Root dir of my GitHub Page for CSS/JS
99
- GHP_ROOT_DIR = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
100
-
101
- task.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{GHP_ROOT_DIR}/css/prism.css" />)
102
- task.js_scripts << %Q(<script src="#{GHP_ROOT_DIR}/js/prism.js"></script>)
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
- **Using all options:**
119
+ **All options:**
108
120
 
109
- ```Ruby
121
+ ```ruby
110
122
  YardGhurt::GFMFixTask.new(:yard_fix) do |task|
111
- task.anchor_db = {'tests' => 'Testing'} # #tests => #Testing
112
- task.arg_names << :name # Custom args
113
- task.css_styles << '<link rel="stylesheet" href="css/my_css.css" />' # Inserted at </head>
114
- task.css_styles << '<style>body{ background-color: linen; }</style>'
115
- task.custom_gsub = Proc.new() {|line| !line.gsub!('YardGhurt','YARD GHURT!').nil?()}
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 = false
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 </body>
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 = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
131
- task.during = Proc.new() {|task,args,file| puts "#{args.name} can haz #{file}?"}
132
- task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
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
- ### [GHPSyncTask](#using)
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
- ```Ruby
143
- YardGhurt::GHPSyncTask.new() do |task|
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
- **Using all options:**
161
+ **All options:**
150
162
 
151
- ```Ruby
152
- # Execute: rake ghp_doc[false,'Ruby']
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 = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
164
- task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
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](#using)
180
+ ### [//](#-contents) Util / YardGhurt
169
181
 
170
182
  Utility methods for tasks.
171
183
 
172
- ```Ruby
184
+ ```ruby
173
185
  require 'yard_ghurt/util'
174
186
 
175
- # If the file exists, delete it, and if +output+ is true, log it to stdout
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') # true
181
- puts YardGhurt::Util.to_bool('on') # true
182
- puts YardGhurt::Util.to_bool('yes') # true
183
- puts YardGhurt::Util.to_bool(nil) # false
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 of the Tasks and Helpers, so *Util* is preferred, unless you're already requiring *yard_ghurt*.
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
- ### [AnchorLinks](#using)
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
- ```Ruby
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 specific duplicate:
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
- ```Ruby
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) # This_is_a_test_
221
- puts al.to_yard_anchor_id(name) # This_is_a_test_
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) # this-is-a-test
224
- puts al.to_github_anchor_id(name) # this-is-a-test
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) # This_is_a_test_0
231
- puts al.to_yard_anchor_id(name) # This_is_a_test_1
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) # this-is-a-test-1
234
- puts al.to_github_anchor_id(name) # this-is-a-test-1
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) # This_is_another_test_2
242
- puts al.to_yard_anchor_id(name) # This_is_another_test_3
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) # this-is-another-test-1
245
- puts al.to_github_anchor_id(name) # this-is-another-test-1
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
- ## [CLI App](#contents)
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
- ## [Hacking](#contents)
286
+ ## [//](#-contents) Hacking
276
287
 
277
- ```
278
- $ git clone 'https://github.com/esotericpig/yard_ghurt.git'
279
- $ bundle install
280
- $ bundle exec rake -T
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
- ### [Testing](#hacking)
295
+ ### [//](#-contents) Testing
284
296
 
285
297
  First, execute this:
286
298
 
287
- `$ bundle exec rake clobber yard yard_gfm_fix[true]`
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
- `$ bundle exec rake yard_gfm_fix[true]`
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 **doc/index.html** and check all of the [anchor links](#tests), [local file links](#license), etc.
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
- `$ diff doc/index.html doc/file.README.html`
322
+ ```bash
323
+ diff doc/index.html doc/file.README.html
324
+ ```
307
325
 
308
- ## [Tests](#contents)
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](#tests)
325
- ### [This-is-Test-#2](#tests)
326
- ### [This_is_Test_#3](#tests)
327
- ### ["This is Test #4"](#tests)
328
- ### ["This is Test #4"](#tests)
329
- ### [this is test #5](#tests)
330
- ### [THIS IS TEST #6](#tests)
331
- ### [日本語?](#tests)
332
- ### [テスト?](#tests)
333
- ### [中文?](#tests)
334
- ### [汉语?](#tests)
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
- ## [License](#contents)
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-2020 Jonathan Bradley Whited (@esotericpig)
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
- require 'rake/clean'
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
- YARD::Rake::YardocTask.new() do |task|
36
- task.files = [File.join('lib','**','*.rb')]
37
-
38
- task.options += ['--files','CHANGELOG.md,LICENSE.txt']
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
- desc 'Generate pristine YARDoc'
47
- task :yard_fresh => [:clobber,:yard,:yard_gfm_fix] do |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() do |task|
51
- task.arg_names = [:dev]
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 = Proc.new() do |task,args|
56
- # Root dir of my GitHub Page for CSS/JS
57
- GHP_ROOT_DIR = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
58
-
59
- task.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{GHP_ROOT_DIR}/css/prism.css" />)
60
- task.js_scripts << %Q(<script src="#{GHP_ROOT_DIR}/js/prism.js"></script>)
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() do |task|
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