yard_ghurt 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e1d7c4b6840acda446635ca65f73e5dcd8c07b1ea4faa61b7024eb7b13641f99
4
+ data.tar.gz: c5e06179e90a77d8c485c9772f5f8d9c8ddd6ac63aabd659fd845ebdc643b659
5
+ SHA512:
6
+ metadata.gz: 5171490ed25ff1746a6c0b2fb4b606450e59075e3d2fa03d3d3cb159a25a323e106ced97096a431796f98aa106b6e891d5ec757ecec8ebd431b732c9c2d6714d
7
+ data.tar.gz: 11c61d3c8e1a89cda1259a2a9b67f946e7c927793cf1c49ec511da0e368e46d18cc02dcdb46edc3578a13d0156fc6bd90faea4d96fe3e1452be653a25a59520f
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog | YardGhurt
2
+
3
+ Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
+
5
+ ## [[Unreleased]](https://github.com/esotericpig/yard_ghurt/compare/v1.0.0...master)
6
+
7
+ ## [v1.0.0] - 2019-07-23
8
+ ### Added
9
+ - .gitignore
10
+ - CHANGELOG.md
11
+ - Gemfile
12
+ - LICENSE.txt
13
+ - README.md
14
+ - Rakefile
15
+ - yard_ghurt.gemspec
16
+ - lib/yard_ghurt.rb
17
+ - lib/yard_ghurt/anchor_links.rb
18
+ - lib/yard_ghurt/gfm_fixer_task.rb
19
+ - lib/yard_ghurt/ghp_syncer_task.rb
20
+ - lib/yard_ghurt/util.rb
21
+ - lib/yard_ghurt/version.rb
22
+ - yard/templates/default/layout/html/footer.erb
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
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
+ source 'https://rubygems.org'
24
+
25
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md ADDED
@@ -0,0 +1,335 @@
1
+ # YardGhurt
2
+
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)
9
+
10
+ <u>YARD</u>oc <u>G</u>it<u>Hu</u>b <u>R</u>ake <u>T</u>asks
11
+
12
+ - Fix GitHub Flavored Markdown files.
13
+ - Sync YARDoc to a local GitHub Pages repo.
14
+
15
+ ## Contents
16
+
17
+ - [Setup](#setup)
18
+ - [Using](#using)
19
+ - [GFMFixerTask](#gfmfixertask)
20
+ - [GHPSyncerTask](#ghpsyncertask)
21
+ - [YardGhurt / Util](#yardghurt--util)
22
+ - [AnchorLinks](#anchorlinks)
23
+ - [Hacking](#hacking)
24
+ - [Testing](#testing)
25
+ - [Tests](#tests)
26
+ - [License](#license)
27
+
28
+ ## [Setup](#contents)
29
+
30
+ Pick your poison...
31
+
32
+ With the RubyGems CLI package manager:
33
+
34
+ `$ gem install yard_ghurt`
35
+
36
+ In your *Gemspec* (*&lt;project&gt;.gemspec*):
37
+
38
+ ```Ruby
39
+ spec.add_development_dependency 'yard_ghurt', '~> X.X.X'
40
+ ```
41
+
42
+ In your *Gemfile*:
43
+
44
+ ```Ruby
45
+ gem 'yard_ghurt', '~> X.X.X', :group => [:development, :test]
46
+ # or...
47
+ gem 'yard_ghurt', :git => 'https://github.com/esotericpig/yard_ghurt.git',
48
+ :tag => 'vX.X.X', :group => [:development, :test]
49
+ ```
50
+
51
+ Manually:
52
+
53
+ ```
54
+ $ git clone 'https://github.com/esotericpig/yard_ghurt.git'
55
+ $ cd yard_ghurt
56
+ $ bundle install
57
+ $ bundle exec rake install:local
58
+ ```
59
+
60
+ ## [Using](#contents)
61
+
62
+ **Rake Tasks:**
63
+
64
+ | Task | Description |
65
+ | --- | --- |
66
+ | [GFMFixerTask](#gfmfixertask) | Fix GitHub Flavored Markdown files |
67
+ | [GHPSyncerTask](#ghpsyncertask) | Sync YARDoc to a local GitHub Pages repo. |
68
+
69
+ **Helpers:**
70
+
71
+ | Helper | Description |
72
+ | --- | --- |
73
+ | [YardGhurt / Util](#yardghurt--util) | Utility methods for tasks |
74
+ | [AnchorLinks](#anchorlinks) | A “database” of anchor links |
75
+
76
+ ### [GFMFixerTask](#using)
77
+
78
+ Fix (find & replace) text in the GitHub Flavored Markdown (GFM) files in the YARDoc directory, for differences between the two formats.
79
+
80
+ **What I typically use:**
81
+
82
+ ```Ruby
83
+ YardGhurt::GFMFixerTask.new() do |task|
84
+ task.arg_names = [:dev]
85
+ task.dry_run = false
86
+ task.fix_code_langs = true
87
+ task.md_files = ['index.html']
88
+
89
+ task.before = Proc.new() do |task,args|
90
+ # Delete this file as it's never used (index.html is an exact copy)
91
+ YardGhurt.rm_exist(File.join(task.doc_dir,'file.README.html'))
92
+
93
+ # Root dir of my GitHub Page for CSS/JS
94
+ GHP_ROOT_DIR = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
95
+
96
+ task.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{GHP_ROOT_DIR}/css/prism.css" />)
97
+ task.js_scripts << %Q(<script src="#{GHP_ROOT_DIR}/js/prism.js"></script>)
98
+ end
99
+ end
100
+ ```
101
+
102
+ **Using all options:**
103
+
104
+ ```Ruby
105
+ YardGhurt::GFMFixerTask.new(:yard_fix) do |task|
106
+ task.anchor_db = {'tests' => 'Testing'} # #tests => #Testing
107
+ task.arg_names << :name # Custom args
108
+ task.css_styles << '<link rel="stylesheet" href="css/my_css.css" />' # Inserted at </head>
109
+ task.css_styles << '<style>body{ background-color: linen; }</style>'
110
+ task.custom_gsub = Proc.new() {|line| !line.gsub!('YardGhurt','YARD GHURT!').nil?()}
111
+ task.custom_gsubs << [/newline/i,'Do you smell what The Rock is cooking?']
112
+ task.deps << :yard # Custom dependencies
113
+ task.description = 'Fix it'
114
+ task.doc_dir = 'doc'
115
+ task.dry_run = false
116
+ task.exclude_code_langs = Set['ruby']
117
+ task.fix_anchor_links = true
118
+ task.fix_code_langs = true
119
+ task.fix_file_links = true
120
+ task.js_scripts << '<script src="js/my_js.js"></script>' # Inserted at </body>
121
+ task.js_scripts << '<script>document.write("Hello World!");</script>'
122
+ task.md_files = ['index.html']
123
+ task.verbose = false
124
+
125
+ task.before = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
126
+ task.during = Proc.new() {|task,args,file| puts "#{args.name} can haz #{file}?"}
127
+ task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
128
+ end
129
+ ```
130
+
131
+ ### [GHPSyncerTask](#using)
132
+
133
+ Sync YARDoc to a local GitHub Pages repo (uses `rsync` by default).
134
+
135
+ **What I typically use:**
136
+
137
+ ```Ruby
138
+ YardGhurt::GHPSyncerTask.new() do |task|
139
+ task.ghp_dir = '../esotericpig.github.io/docs/yard_ghurt/yardoc'
140
+ task.sync_args << '--delete-after'
141
+ end
142
+ ```
143
+
144
+ **Using all options:**
145
+
146
+ ```Ruby
147
+ # Execute: rake ghp_doc[false,'Ruby']
148
+ YardGhurt::GHPSyncerTask.new(:ghp_doc) do |task|
149
+ task.arg_names << :name # Custom args
150
+ task.deps << :yard # Custom dependencies
151
+ task.description = 'Rsync my_doc/ to my page'
152
+ task.doc_dir = 'my_doc' # YARDoc directory of generated files
153
+ task.ghp_dir = '../dest_dir/my_page'
154
+ task.strict = true # Fail if doc_dir doesn't exist
155
+ task.sync_args << '--delete-after'
156
+ task.sync_cmd = '/usr/bin/rsync'
157
+
158
+ task.before = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
159
+ task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
160
+ end
161
+ ```
162
+
163
+ ### [YardGhurt / Util](#using)
164
+
165
+ Utility methods for tasks.
166
+
167
+ ```Ruby
168
+ require 'yard_ghurt'
169
+
170
+ # If the file exists, delete it, and if output is true, log it to stdout
171
+ YardGhurt.rm_exist('doc/file.README.html')
172
+ YardGhurt.rm_exist('doc/file.README.html',false)
173
+
174
+ # Convert an Object to true or false
175
+ puts YardGhurt.to_bool('true') # true
176
+ puts YardGhurt.to_bool('on') # true
177
+ puts YardGhurt.to_bool('yes') # true
178
+ ```
179
+
180
+ If you don't want to include all of the Tasks and Helpers, then you should include and use `yard_ghurt/util` instead:
181
+
182
+ ```Ruby
183
+ require 'yard_ghurt/util'
184
+
185
+ YardGhurt::Util.rm_exist('doc/file.README.html')
186
+ puts YardGhurt::Util.to_bool('true')
187
+ ```
188
+
189
+ ### [AnchorLinks](#using)
190
+ A “database” of anchor links specific to GitHub Flavored Markdown (GFM) and YARDoc.
191
+
192
+ You can use this by itself to view what anchor IDs would be generated:
193
+
194
+ ```Ruby
195
+ require 'yard_ghurt/anchor_links'
196
+
197
+ al = YardGhurt::AnchorLinks.new()
198
+
199
+ puts al.to_github_anchor_id('This is a test!')
200
+ puts al.to_yard_anchor_id('This is a test!')
201
+
202
+ # Output:
203
+ # ---
204
+ # this-is-a-test
205
+ # This_is_a_test_
206
+ ```
207
+
208
+ 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:
209
+
210
+ ```Ruby
211
+ al = YardGhurt::AnchorLinks.new()
212
+ name = 'This is a test!'
213
+
214
+ puts al.to_yard_anchor_id(name) # This_is_a_test_
215
+ puts al.to_yard_anchor_id(name) # This_is_a_test_
216
+
217
+ puts al.to_github_anchor_id(name) # this-is-a-test
218
+ puts al.to_github_anchor_id(name) # this-is-a-test
219
+
220
+ al << name # Officially add it to the database
221
+
222
+ # Instead of being 0 & 0, will be 0 & 1 (incremented),
223
+ # even without being added to the database
224
+ puts al.to_yard_anchor_id(name) # This_is_a_test_0
225
+ puts al.to_yard_anchor_id(name) # This_is_a_test_1
226
+
227
+ puts al.to_github_anchor_id(name) # this-is-a-test-1
228
+ puts al.to_github_anchor_id(name) # this-is-a-test-1
229
+
230
+ name = 'This is another test!'
231
+ al << name # Officially add it to the database
232
+
233
+ # Instead of being 0 & 1, will be 2 & 3 (global increment),
234
+ # even without being added to the database
235
+ puts al.to_yard_anchor_id(name) # This_is_another_test_2
236
+ puts al.to_yard_anchor_id(name) # This_is_another_test_3
237
+
238
+ puts al.to_github_anchor_id(name) # this-is-another-test-1
239
+ puts al.to_github_anchor_id(name) # this-is-another-test-1
240
+ ```
241
+
242
+ ## [Hacking](#contents)
243
+
244
+ ```
245
+ $ git clone 'https://github.com/esotericpig/yard_ghurt.git'
246
+ $ bundle install
247
+ $ bundle exec rake -T
248
+ ```
249
+
250
+ ### [Testing](#hacking)
251
+
252
+ First, execute this:
253
+
254
+ `$ bundle exec rake clobber yard yard_gfm_fix[true]`
255
+
256
+ Then execute this and make sure there are no warnings and no changes:
257
+
258
+ `$ bundle exec rake yard_gfm_fix[true]`
259
+
260
+ It should output this:
261
+
262
+ ```
263
+ [doc/file.README.html]:
264
+ = Nothing written (up-to-date)
265
+ [doc/index.html]:
266
+ = Nothing written (up-to-date)
267
+ ```
268
+
269
+ Then open up **doc/index.html** and check all of the [anchor links](#tests), [local file links](#license), etc.
270
+
271
+ Lastly, the 2 files should be almost identical, except for 1 line:
272
+
273
+ `$ diff doc/index.html doc/file.README.html`
274
+
275
+ ## [Tests](#contents)
276
+
277
+ These are actual tests for this gem.
278
+
279
+ - [This is Test #1](#this-is-test-1)
280
+ - [This-is-Test-#2](#this-is-test-2)
281
+ - [This_is_Test_#3](#this_is_test_3)
282
+ - ["This is Test #4"](#this-is-test-4)
283
+ - ["This is Test #4"](#this-is-test-4-1)
284
+ - [this is test #5](#this-is-test-5)
285
+ - [THIS IS TEST #6](#this-is-test-6)
286
+ - [日本語?](#日本語)
287
+ - [テスト?](#テスト)
288
+ - [中文?](#中文)
289
+ - [汉语?](#汉语)
290
+
291
+ ### [This is Test #1](#tests)
292
+ ### [This-is-Test-#2](#tests)
293
+ ### [This_is_Test_#3](#tests)
294
+ ### ["This is Test #4"](#tests)
295
+ ### ["This is Test #4"](#tests)
296
+ ### [this is test #5](#tests)
297
+ ### [THIS IS TEST #6](#tests)
298
+ ### [日本語?](#tests)
299
+ ### [テスト?](#tests)
300
+ ### [中文?](#tests)
301
+ ### [汉语?](#tests)
302
+
303
+ ```
304
+ Newline
305
+ Newline
306
+ Newline
307
+ Newline
308
+ Newline
309
+ Newline
310
+ Newline
311
+ Newline
312
+ Newline
313
+ Newline
314
+ Newline
315
+ ```
316
+
317
+ ## [License](#contents)
318
+
319
+ [GNU LGPL v3+](LICENSE.txt)
320
+
321
+ > YardGhurt (<https://github.com/esotericpig/yard_ghurt>)
322
+ > Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
323
+ >
324
+ > YardGhurt is free software: you can redistribute it and/or modify
325
+ > it under the terms of the GNU Lesser General Public License as published by
326
+ > the Free Software Foundation, either version 3 of the License, or
327
+ > (at your option) any later version.
328
+ >
329
+ > YardGhurt is distributed in the hope that it will be useful,
330
+ > but WITHOUT ANY WARRANTY; without even the implied warranty of
331
+ > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
332
+ > GNU Lesser General Public License for more details.
333
+ >
334
+ > You should have received a copy of the GNU Lesser General Public License
335
+ > along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
data/Rakefile ADDED
@@ -0,0 +1,68 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
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
+ require 'bundler/gem_tasks'
24
+
25
+ require 'yard'
26
+ require 'yard_ghurt'
27
+
28
+ require 'rake/clean'
29
+
30
+ task default: [:yard,:yard_gfm_fix]
31
+
32
+ CLEAN.exclude('.git/','stock/')
33
+ CLOBBER.include('doc/')
34
+
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
45
+
46
+ desc 'Generate pristine YARDoc'
47
+ task :yard_fresh => [:clobber,:yard,:yard_gfm_fix] do |task|
48
+ end
49
+
50
+ YardGhurt::GFMFixerTask.new() do |task|
51
+ task.arg_names = [:dev]
52
+ task.dry_run = false
53
+ 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>)
61
+ end
62
+ end
63
+
64
+ # Probably not useful for others.
65
+ YardGhurt::GHPSyncerTask.new() do |task|
66
+ task.ghp_dir = '../esotericpig.github.io/docs/yard_ghurt/yardoc'
67
+ task.sync_args << '--delete-after'
68
+ end