yard_ghurt 1.0.0 → 1.0.1
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/CHANGELOG.md +9 -1
- data/README.md +15 -14
- data/lib/yard_ghurt/gfm_fixer_task.rb +17 -8
- data/lib/yard_ghurt/ghp_syncer_task.rb +1 -1
- data/lib/yard_ghurt/util.rb +2 -1
- data/lib/yard_ghurt/version.rb +1 -1
- data/lib/yard_ghurt.rb +0 -1
- data/yard_ghurt.gemspec +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09e5e44f79301b48fc0c128b2c28f92ed6214dde2e6ea95c4a251c658eba1c41'
|
4
|
+
data.tar.gz: 9ae774c08a531397baac550dd52facda1d82cbc3614ec74b5737dfd3940f4acf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd582fde644bc58bf50734da87a79f3579b8c78563badd8b4dded47b234c93d54561f871563640f2a912f412d929a43dfc001bb8a721f711c23c19bba89b050
|
7
|
+
data.tar.gz: f803e9360a6205b5c8af74eb548e64e5c7e00ab5cd7b8a356733db0107c7d6c854f357a79bbc376ed67f7c571a6fa3068129f93b34222924e24ef3538390a712
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,15 @@
|
|
2
2
|
|
3
3
|
Format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
4
4
|
|
5
|
-
## [[Unreleased]](https://github.com/esotericpig/yard_ghurt/compare/v1.0.
|
5
|
+
## [[Unreleased]](https://github.com/esotericpig/yard_ghurt/compare/v1.0.1...master)
|
6
|
+
|
7
|
+
## [v1.0.1] - 2019-07-28
|
8
|
+
### Changed
|
9
|
+
- Some minor comments/doc
|
10
|
+
- Refactored the Gemspec (minor)
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- In GFMFixerTask, ignore empty lines
|
6
14
|
|
7
15
|
## [v1.0.0] - 2019-07-23
|
8
16
|
### Added
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
- [Using](#using)
|
19
19
|
- [GFMFixerTask](#gfmfixertask)
|
20
20
|
- [GHPSyncerTask](#ghpsyncertask)
|
21
|
-
- [
|
21
|
+
- [Util / YardGhurt](#util--yardghurt)
|
22
22
|
- [AnchorLinks](#anchorlinks)
|
23
23
|
- [Hacking](#hacking)
|
24
24
|
- [Testing](#testing)
|
@@ -70,7 +70,7 @@ $ bundle exec rake install:local
|
|
70
70
|
|
71
71
|
| Helper | Description |
|
72
72
|
| --- | --- |
|
73
|
-
| [
|
73
|
+
| [Util / YardGhurt](#util--yardghurt) | Utility methods for tasks |
|
74
74
|
| [AnchorLinks](#anchorlinks) | A “database” of anchor links |
|
75
75
|
|
76
76
|
### [GFMFixerTask](#using)
|
@@ -160,30 +160,31 @@ YardGhurt::GHPSyncerTask.new(:ghp_doc) do |task|
|
|
160
160
|
end
|
161
161
|
```
|
162
162
|
|
163
|
-
### [
|
163
|
+
### [Util / YardGhurt](#using)
|
164
164
|
|
165
165
|
Utility methods for tasks.
|
166
166
|
|
167
167
|
```Ruby
|
168
|
-
require 'yard_ghurt'
|
168
|
+
require 'yard_ghurt/util'
|
169
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)
|
170
|
+
# If the file exists, delete it, and if +output+ is true, log it to stdout
|
171
|
+
YardGhurt::Util.rm_exist('doc/file.README.html')
|
172
|
+
YardGhurt::Util.rm_exist('doc/file.README.html',false)
|
173
173
|
|
174
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
|
175
|
+
puts YardGhurt::Util.to_bool('true') # true
|
176
|
+
puts YardGhurt::Util.to_bool('on') # true
|
177
|
+
puts YardGhurt::Util.to_bool('yes') # true
|
178
|
+
puts YardGhurt::Util.to_bool(nil) # false
|
178
179
|
```
|
179
180
|
|
180
|
-
|
181
|
+
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*.
|
181
182
|
|
182
183
|
```Ruby
|
183
|
-
require 'yard_ghurt
|
184
|
+
require 'yard_ghurt'
|
184
185
|
|
185
|
-
YardGhurt
|
186
|
-
puts YardGhurt
|
186
|
+
YardGhurt.rm_exist('doc/file.README.html')
|
187
|
+
puts YardGhurt.to_bool('true')
|
187
188
|
```
|
188
189
|
|
189
190
|
### [AnchorLinks](#using)
|
@@ -340,6 +340,9 @@ module YardGhurt
|
|
340
340
|
next if line !~ /<h\d+>/i
|
341
341
|
|
342
342
|
line.gsub!(/<[^>]+>/,'') # Remove tags: <...>
|
343
|
+
line.strip!()
|
344
|
+
|
345
|
+
next if line.empty?()
|
343
346
|
|
344
347
|
@anchor_links << line
|
345
348
|
end
|
@@ -367,6 +370,12 @@ module YardGhurt
|
|
367
370
|
|
368
371
|
File.open(filename,'r') do |file|
|
369
372
|
file.each_line do |line|
|
373
|
+
if line.strip().empty?()
|
374
|
+
lines << line
|
375
|
+
|
376
|
+
next
|
377
|
+
end
|
378
|
+
|
370
379
|
has_change = false
|
371
380
|
|
372
381
|
# Standard
|
@@ -476,9 +485,9 @@ module YardGhurt
|
|
476
485
|
tag = 'href="#'
|
477
486
|
|
478
487
|
line.gsub!(Regexp.new(Regexp.quote(tag) + '[^"]*"')) do |href|
|
479
|
-
link = href[tag.length..-2]
|
488
|
+
link = href[tag.length..-2].strip()
|
480
489
|
|
481
|
-
if @anchor_links.yard_anchor_id?(link)
|
490
|
+
if link.empty?() || @anchor_links.yard_anchor_id?(link)
|
482
491
|
href
|
483
492
|
else
|
484
493
|
yard_link = @anchor_links[link]
|
@@ -523,9 +532,9 @@ module YardGhurt
|
|
523
532
|
tag = 'code class="'
|
524
533
|
|
525
534
|
line.gsub!(Regexp.new(Regexp.quote(tag) + '[^"]*"')) do |code_class|
|
526
|
-
lang = code_class[tag.length..-2]
|
535
|
+
lang = code_class[tag.length..-2].strip()
|
527
536
|
|
528
|
-
if lang =~ /^language\-/ || @exclude_code_langs.include?(lang)
|
537
|
+
if lang.empty?() || lang =~ /^language\-/ || @exclude_code_langs.include?(lang)
|
529
538
|
code_class
|
530
539
|
else
|
531
540
|
has_change = true
|
@@ -576,15 +585,15 @@ module YardGhurt
|
|
576
585
|
tag = 'href="'
|
577
586
|
|
578
587
|
line.gsub!(Regexp.new(Regexp.quote(tag) + '[^#][^"]*"')) do |href|
|
579
|
-
link = href[tag.length..-2]
|
588
|
+
link = href[tag.length..-2].strip()
|
580
589
|
|
581
|
-
if File.exist?(link)
|
590
|
+
if link.empty?() || !File.exist?(link)
|
591
|
+
href
|
592
|
+
else
|
582
593
|
link = File.basename(link,'.*')
|
583
594
|
has_change = true
|
584
595
|
|
585
596
|
%Q(#{tag}file.#{link}.html")
|
586
|
-
else
|
587
|
-
href
|
588
597
|
end
|
589
598
|
end
|
590
599
|
|
data/lib/yard_ghurt/util.rb
CHANGED
@@ -32,7 +32,8 @@ module YardGhurt
|
|
32
32
|
#
|
33
33
|
# All internal code should use this module.
|
34
34
|
#
|
35
|
-
#
|
35
|
+
# External code can either use this module or {YardGhurt},
|
36
|
+
# which includes this module as a mixin.
|
36
37
|
#
|
37
38
|
# @author Jonathan Bradley Whited (@esotericpig)
|
38
39
|
# @since 1.0.0
|
data/lib/yard_ghurt/version.rb
CHANGED
data/lib/yard_ghurt.rb
CHANGED
data/yard_ghurt.gemspec
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
#++
|
21
21
|
|
22
22
|
|
23
|
-
lib = File.expand_path('
|
23
|
+
lib = File.expand_path(File.join('..','lib'),__FILE__)
|
24
24
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
25
25
|
|
26
26
|
require 'yard_ghurt/version'
|
@@ -33,7 +33,7 @@ Gem::Specification.new() do |spec|
|
|
33
33
|
spec.licenses = ['LGPL-3.0-or-later']
|
34
34
|
spec.homepage = 'https://github.com/esotericpig/yard_ghurt'
|
35
35
|
spec.summary = 'YARDoc GitHub Rake Tasks'
|
36
|
-
spec.description =
|
36
|
+
spec.description = "#{spec.summary}. Fix GitHub Flavored Markdown (GFM) files."
|
37
37
|
|
38
38
|
spec.metadata = {
|
39
39
|
'bug_tracker_uri' => 'https://github.com/esotericpig/yard_ghurt/issues',
|
@@ -45,7 +45,8 @@ Gem::Specification.new() do |spec|
|
|
45
45
|
|
46
46
|
spec.require_paths = ['lib']
|
47
47
|
|
48
|
-
spec.files = Dir.glob(File.join("{#{spec.require_paths.join(',')}
|
48
|
+
spec.files = Dir.glob(File.join("{#{spec.require_paths.join(',')}}",'**','*.{erb,rb}')) +
|
49
|
+
Dir.glob(File.join('{test,yard}','**','*.{erb,rb}')) +
|
49
50
|
%W( Gemfile #{spec.name}.gemspec Rakefile ) +
|
50
51
|
%w( CHANGELOG.md LICENSE.txt README.md )
|
51
52
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard_ghurt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Bradley Whited (@esotericpig)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|