yard_ghurt 1.2.1 → 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.
@@ -3,67 +3,29 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2021 Jonathan Bradley Whited
6
+ # Copyright (c) 2019 Bradley Whited
7
7
  #
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  require 'set'
13
12
  require 'uri'
14
13
 
15
14
  module YardGhurt
16
- ###
17
15
  # A "database" of anchor links specific to GitHub Flavored Markdown (GFM) & YARDoc.
18
16
  #
19
17
  # You can use this by itself to view what anchor IDs would be generated:
20
- # al = YardGhurt::AnchorLinks.new()
21
- #
22
- # puts al.to_github_anchor_id('This is a test!')
23
- # puts al.to_yard_anchor_id('This is a test!')
18
+ # al = YardGhurt::AnchorLinks.new
24
19
  #
25
- # # Output:
26
- # # ---
27
- # # this-is-a-test
28
- # # This_is_a_test_
20
+ # puts al.to_github_anchor_id('This is a test!') #=> this-is-a-test
21
+ # puts al.to_yard_anchor_id('This is a test!') #=> This_is_a_test_
29
22
  #
30
23
  # Be aware that YARDoc depends on a common number that will be incremented for all duplicates,
31
- # while GFM's number is only local to each specific duplicate:
32
- # al = YardGhurt::AnchorLinks.new()
33
- # name = 'This is a test!'
34
- #
35
- # puts al.to_yard_anchor_id(name) # This_is_a_test_
36
- # puts al.to_yard_anchor_id(name) # This_is_a_test_
37
- #
38
- # puts al.to_github_anchor_id(name) # this-is-a-test
39
- # puts al.to_github_anchor_id(name) # this-is-a-test
40
- #
41
- # al << name # Officially add it to the database
42
- #
43
- # # Instead of being 0 & 0, will be 0 & 1 (incremented),
44
- # # even without being added to the database
45
- # puts al.to_yard_anchor_id(name) # This_is_a_test_0
46
- # puts al.to_yard_anchor_id(name) # This_is_a_test_1
24
+ # while GFM's number is only local to each duplicate.
47
25
  #
48
- # puts al.to_github_anchor_id(name) # this-is-a-test-1
49
- # puts al.to_github_anchor_id(name) # this-is-a-test-1
50
- #
51
- # name = 'This is another test!'
52
- # al << name # Officially add it to the database
53
- #
54
- # # Instead of being 0 & 1, will be 2 & 3 (global increment),
55
- # # even without being added to the database
56
- # puts al.to_yard_anchor_id(name) # This_is_another_test_2
57
- # puts al.to_yard_anchor_id(name) # This_is_another_test_3
58
- #
59
- # puts al.to_github_anchor_id(name) # this-is-another-test-1
60
- # puts al.to_github_anchor_id(name) # this-is-another-test-1
61
- #
62
- # @author Jonathan Bradley Whited
63
- # @since 1.0.0
26
+ # @since 1.0.0
64
27
  #
65
28
  # @see GFMFixTask
66
- ###
67
29
  class AnchorLinks
68
30
  # @return [Hash] the GFM-style anchor IDs pointing to their YARDoc ID equivalents that have been added
69
31
  attr_reader :anchor_ids
@@ -75,7 +37,7 @@ module YardGhurt
75
37
  attr_accessor :yard_dup_num
76
38
 
77
39
  def initialize
78
- super()
40
+ super
79
41
  reset
80
42
  end
81
43
 
@@ -101,7 +63,7 @@ module YardGhurt
101
63
  #
102
64
  # @note +yard_id:+ was added in v1.2.1 for YARD v0.9.25+.
103
65
  #
104
- # @param name [String] the name (header text) to convert to anchor IDs and add to the database
66
+ # @param name [String] the name (header text) to convert to anchor IDs and add to the database
105
67
  # @return [self]
106
68
  def add_anchor(name,yard_id: nil)
107
69
  yard_id = to_yard_anchor_id(name) if yard_id.nil?
@@ -119,9 +81,9 @@ module YardGhurt
119
81
  #
120
82
  # @return [String] the escaped string
121
83
  #
122
- # @since 1.2.0
84
+ # @since 1.2.0
123
85
  def self.escape(str)
124
- # URI.escape()/encode() is obsolete
86
+ # URI.escape()/encode() is obsolete.
125
87
  return URI.encode_www_form_component(str)
126
88
  end
127
89
 
@@ -202,7 +164,7 @@ module YardGhurt
202
164
  id.downcase!
203
165
  end
204
166
 
205
- id = self.class.escape(id) # For non-English languages
167
+ id = self.class.escape(id) # For non-English languages.
206
168
 
207
169
  # Duplicates
208
170
  dup_num = 1
@@ -251,9 +213,9 @@ module YardGhurt
251
213
  id.strip!
252
214
  id.gsub!(/&[^;]+;/,'_') # Replace entities: &...;
253
215
  id.gsub!(/[^a-z0-9-]/i,'_')
254
- id = self.class.escape(id) # For non-English languages
216
+ id = self.class.escape(id) # For non-English languages.
255
217
 
256
- # Duplicates
218
+ # Duplicates.
257
219
  orig_id = id.dup
258
220
 
259
221
  while @yard_anchor_ids.include?(id)
@@ -3,22 +3,18 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2021 Jonathan Bradley Whited
6
+ # Copyright (c) 2019 Bradley Whited
7
7
  #
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  require 'rake'
13
- require 'set'
14
-
15
12
  require 'rake/tasklib'
16
-
13
+ require 'set'
17
14
  require 'yard_ghurt/anchor_links'
18
15
  require 'yard_ghurt/util'
19
16
 
20
17
  module YardGhurt
21
- ###
22
18
  # Fix (find & replace) text in the GitHub Flavored Markdown (GFM) files in the YARDoc directory,
23
19
  # for differences between the two formats.
24
20
  #
@@ -26,53 +22,27 @@ module YardGhurt
26
22
  # rake yard_gfm_fix dryrun=true
27
23
  #
28
24
  # @example What I Use
29
- # YardGhurt::GFMFixTask.new() do |task|
25
+ # YardGhurt::GFMFixTask.new do |task|
30
26
  # task.arg_names = [:dev]
31
27
  # task.dry_run = false
32
28
  # task.fix_code_langs = true
33
29
  # task.md_files = ['index.html']
34
30
  #
35
- # task.before = Proc.new() do |t2,args|
36
- # # Delete this file as it's never used (index.html is an exact copy)
37
- # YardGhurt.rm_exist(File.join(t2.doc_dir,'file.README.html'))
31
+ # task.before = proc do |task2,args|
32
+ # # Delete this file as it's never used (`index.html` is an exact copy).
33
+ # YardGhurt.rm_exist(File.join(task2.doc_dir,'file.README.html'))
38
34
  #
39
- # # Root dir of my GitHub Page for CSS/JS
35
+ # # Root dir of my GitHub Page for CSS/JS.
40
36
  # ghp_root_dir = YardGhurt.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
41
37
  #
42
- # t2.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{ghp_root_dir}/css/prism.css" />)
43
- # t2.js_scripts << %Q(<script src="#{ghp_root_dir}/js/prism.js"></script>)
38
+ # task2.css_styles << %(
39
+ # <link rel="stylesheet" type="text/css" href="#{ghp_root_dir}/css/prism.css" />
40
+ # )
41
+ # task2.js_scripts << %(<script src="#{ghp_root_dir}/js/prism.js"></script>)
44
42
  # end
45
43
  # end
46
44
  #
47
- # @example Using All Options
48
- # YardGhurt::GFMFixTask.new(:yard_fix) do |task|
49
- # task.anchor_db = {'tests' => 'Testing'} # #tests => #Testing
50
- # task.arg_names << :name # Custom args
51
- # task.css_styles << '<link rel="stylesheet" href="css/my_css.css" />' # Inserted at </head>
52
- # task.css_styles << '<style>body{ background-color: linen; }</style>'
53
- # task.custom_gsub = Proc.new() {|line| !line.gsub!('YardGhurt','YARD GHURT!').nil?()}
54
- # task.custom_gsubs << [/newline/i,'Do you smell what The Rock is cooking?']
55
- # task.deps << :yard # Custom dependencies
56
- # task.description = 'Fix it'
57
- # task.doc_dir = 'doc'
58
- # task.dry_run = false
59
- # task.exclude_code_langs = Set['ruby']
60
- # task.fix_anchor_links = true
61
- # task.fix_code_langs = true
62
- # task.fix_file_links = true
63
- # task.js_scripts << '<script src="js/my_js.js"></script>' # Inserted at </body>
64
- # task.js_scripts << '<script>document.write("Hello World!");</script>'
65
- # task.md_files = ['index.html']
66
- # task.verbose = false
67
- #
68
- # task.before = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
69
- # task.during = Proc.new() {|task,args,file| puts "#{args.name} can haz #{file}?"}
70
- # task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
71
- # end
72
- #
73
- # @author Jonathan Bradley Whited
74
- # @since 1.1.0
75
- ###
45
+ # @since 1.1.0
76
46
  class GFMFixTask < Rake::TaskLib
77
47
  # This is important so that a subsequent call to this task will not write the CSS again.
78
48
  #
@@ -93,7 +63,7 @@ module YardGhurt
93
63
  #
94
64
  # # @param task [self]
95
65
  # # @param args [Rake::TaskArguments] the args specified by {arg_names}
96
- # task.after = Proc.new do |task,args|
66
+ # task.after = proc do |task,args|
97
67
  # puts args.dev
98
68
  # end
99
69
  #
@@ -120,7 +90,7 @@ module YardGhurt
120
90
  #
121
91
  # # @param task [self]
122
92
  # # @param args [Rake::TaskArguments] the args specified by {arg_names}
123
- # task.before = Proc.new do |task,args|
93
+ # task.before = proc do |task,args|
124
94
  # puts args.dev
125
95
  # end
126
96
  #
@@ -141,10 +111,10 @@ module YardGhurt
141
111
  # # @param line [String] the current line being processed from the current file
142
112
  # #
143
113
  # # @return [true,false] whether there was a change
144
- # task.custom_gsub = Proc.new do |line|
114
+ # task.custom_gsub = proc do |line|
145
115
  # has_change = false
146
116
  #
147
- # has_change = !line.gsub!('dev','prod').nil?() || has_change
117
+ # has_change = !line.gsub!('dev','prod').nil? || has_change
148
118
  # # More changes...
149
119
  #
150
120
  # return has_change
@@ -191,7 +161,7 @@ module YardGhurt
191
161
  # # @param task [self]
192
162
  # # @param args [Rake::TaskArguments] the args specified by {arg_names}
193
163
  # # @param file [String] the current file being processed
194
- # task.during = Proc.new do |task,args,file|
164
+ # task.during = proc do |task,args,file|
195
165
  # puts args.dev
196
166
  # end
197
167
  #
@@ -259,7 +229,7 @@ module YardGhurt
259
229
  alias_method :verbose?,:verbose
260
230
 
261
231
  # @param name [Symbol] the name of this task to use on the command line with +rake+
262
- def initialize(name=:yard_gfm_fix)
232
+ def initialize(name = :yard_gfm_fix)
263
233
  super()
264
234
 
265
235
  @after = nil
@@ -283,7 +253,7 @@ module YardGhurt
283
253
  @name = name
284
254
  @verbose = true
285
255
 
286
- yield self if block_given?
256
+ yield(self) if block_given?
287
257
  define
288
258
  end
289
259
 
@@ -298,7 +268,7 @@ module YardGhurt
298
268
  # Define the Rake task and description using the instance variables.
299
269
  def define
300
270
  desc @description
301
- task @name,Array(@arg_names) => Array(@deps) do |task,args|
271
+ task @name,Array(@arg_names) => Array(@deps) do |_task,args|
302
272
  env_dryrun = ENV['dryrun']
303
273
 
304
274
  if !env_dryrun.nil? && !(env_dryrun = env_dryrun.to_s.strip).empty?
@@ -390,14 +360,14 @@ module YardGhurt
390
360
 
391
361
  has_change = false
392
362
 
393
- # Standard
363
+ # Standard.
394
364
  has_change = add_css_styles!(line) || has_change
395
365
  has_change = add_js_scripts!(line) || has_change
396
366
  has_change = gsub_anchor_links!(line) || has_change
397
367
  has_change = gsub_code_langs!(line) || has_change
398
368
  has_change = gsub_local_file_links!(line) || has_change
399
369
 
400
- # Custom
370
+ # Custom.
401
371
  has_change = gsub_customs!(line) || has_change
402
372
  has_change = gsub_custom!(line) || has_change
403
373
 
@@ -506,14 +476,14 @@ module YardGhurt
506
476
 
507
477
  if yard_link.nil?
508
478
  # Either the GFM link is wrong [check with @anchor_links.to_github_anchor_id()]
509
- # or the internal code is broken [check with @anchor_links.to_s()]
479
+ # or the internal code is broken [check with @anchor_links.to_s()].
510
480
  puts "! YARDoc anchor link for GFM anchor link [#{link}] does not exist"
511
481
 
512
482
  if !@has_verbose_anchor_links
513
483
  if @verbose
514
484
  puts ' GFM anchor link in the Markdown file is wrong?'
515
485
  puts ' Please check the generated links:'
516
- puts %Q( #{@anchor_links.to_s.strip.gsub("\n","\n ")})
486
+ puts %( #{@anchor_links.to_s.strip.gsub("\n","\n ")})
517
487
  else
518
488
  puts " Turn on #{self.class}.verbose for more info"
519
489
  end
@@ -525,7 +495,7 @@ module YardGhurt
525
495
  else
526
496
  has_change = true
527
497
 
528
- %Q(href="##{yard_link}")
498
+ %(href="##{yard_link}")
529
499
  end
530
500
  end
531
501
  end
@@ -543,22 +513,22 @@ module YardGhurt
543
513
  has_change = false
544
514
  tag = 'code class="'
545
515
 
546
- line.gsub!(Regexp.new(Regexp.quote(tag) + '[^"]*"')) do |code_class|
516
+ line.gsub!(Regexp.new(%(#{Regexp.quote(tag)}[^"]*"))) do |code_class|
547
517
  lang = code_class[tag.length..-2].strip
548
518
 
549
- if lang.empty? || lang =~ /^language\-/ || @exclude_code_langs.include?(lang)
519
+ if lang.empty? || lang =~ /^language-/ || @exclude_code_langs.include?(lang)
550
520
  code_class
551
521
  else
552
522
  has_change = true
553
523
 
554
- %Q(#{tag}language-#{lang.downcase}")
524
+ %(#{tag}language-#{lang.downcase}")
555
525
  end
556
526
  end
557
527
 
558
528
  return has_change
559
529
  end
560
530
 
561
- # Call the custom Proc {custom_gsub} (if it responds to +:call+) on +line+,
531
+ # Call the custom Proc {custom_gsub} (if it responds to +:call+) on +line+.
562
532
  #
563
533
  # @param line [String] the line from the file to fix
564
534
  def gsub_custom!(line)
@@ -596,7 +566,7 @@ module YardGhurt
596
566
  has_change = false
597
567
  tag = 'href="'
598
568
 
599
- line.gsub!(Regexp.new(Regexp.quote(tag) + '[^#][^"]*"')) do |href|
569
+ line.gsub!(Regexp.new(%(#{Regexp.quote(tag)}[^#][^"]*"))) do |href|
600
570
  link = href[tag.length..-2].strip
601
571
 
602
572
  if link.empty? || !File.exist?(link)
@@ -605,7 +575,7 @@ module YardGhurt
605
575
  link = File.basename(link,'.*')
606
576
  has_change = true
607
577
 
608
- %Q(#{tag}file.#{link}.html")
578
+ %(#{tag}file.#{link}.html")
609
579
  end
610
580
  end
611
581
 
@@ -3,47 +3,25 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2021 Jonathan Bradley Whited
6
+ # Copyright (c) 2019 Bradley Whited
7
7
  #
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  require 'rake'
13
-
14
12
  require 'rake/tasklib'
15
-
16
13
  require 'yard_ghurt/util'
17
14
 
18
15
  module YardGhurt
19
- ###
20
16
  # Sync YARDoc to a local GitHub Pages repo (uses +rsync+ by default).
21
17
  #
22
18
  # @example What I Use
23
- # YardGhurt::GHPSyncTask.new() do |task|
19
+ # YardGhurt::GHPSyncTask.new do |task|
24
20
  # task.ghp_dir = '../esotericpig.github.io/docs/yard_ghurt/yardoc'
25
21
  # task.sync_args << '--delete-after'
26
22
  # end
27
23
  #
28
- # @example Using All Options
29
- # # Execute: rake ghp_doc[false,'Ruby']
30
- # YardGhurt::GHPSyncTask.new(:ghp_doc) do |task|
31
- # task.arg_names << :name # Custom args
32
- # task.deps << :yard # Custom dependencies
33
- # task.description = 'Rsync my_doc/ to my page'
34
- # task.doc_dir = 'my_doc' # YARDoc directory of generated files
35
- # task.ghp_dir = '../dest_dir/my_page'
36
- # task.strict = true # Fail if doc_dir doesn't exist
37
- # task.sync_args << '--delete-after'
38
- # task.sync_cmd = '/usr/bin/rsync'
39
- #
40
- # task.before = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
41
- # task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
42
- # end
43
- #
44
- # @author Jonathan Bradley Whited
45
- # @since 1.1.0
46
- ###
24
+ # @since 1.1.0
47
25
  class GHPSyncTask < Rake::TaskLib
48
26
  # @return [Proc,nil] the Proc ( +respond_to?(:call)+ ) to call at the end of this task or +nil+;
49
27
  # default: +nil+
@@ -97,7 +75,7 @@ module YardGhurt
97
75
  alias_method :strict?,:strict
98
76
 
99
77
  # @param name [Symbol] the name of this task to use on the command line with +rake+
100
- def initialize(name=:yard_ghp_sync)
78
+ def initialize(name = :yard_ghp_sync)
101
79
  super()
102
80
 
103
81
  @after = nil
@@ -112,7 +90,7 @@ module YardGhurt
112
90
  @sync_args = ['-ahv','--progress']
113
91
  @sync_cmd = 'rsync'
114
92
 
115
- yield self if block_given?
93
+ yield(self) if block_given?
116
94
  define
117
95
  end
118
96
 
@@ -122,17 +100,16 @@ module YardGhurt
122
100
  @arg_names.unshift(:deploy) unless @arg_names.include?(:deploy)
123
101
 
124
102
  desc @description
125
- task @name,@arg_names => Array(@deps) do |task,args|
103
+ task @name,@arg_names => Array(@deps) do |_task,args|
126
104
  deploy = Util.to_bool(args.deploy)
127
105
 
128
106
  @before.call(self,args) if @before.respond_to?(:call)
129
107
 
130
- # Without these checks, sh raises some pretty cryptic errors.
131
- if @strict
132
- # If you want to use a non-local dir, set strict to false.
133
- if !File.exist?(@doc_dir)
134
- raise ArgumentError,%Q(#{self.class}.doc_dir [#{@doc_dir}] does not exist; execute "rake yard"?)
135
- end
108
+ # Without the below checks, sh() raises some pretty cryptic errors.
109
+
110
+ # If you want to use a non-local dir, set strict to false.
111
+ if @strict && !File.exist?(@doc_dir)
112
+ raise ArgumentError,%(#{self.class}.doc_dir [#{@doc_dir}] does not exist; execute "rake yard"?)
136
113
  end
137
114
  # Do not check if ghp_dir exists because rsync may create it.
138
115
  if @ghp_dir.nil? || @ghp_dir.to_s.strip.empty?
@@ -143,7 +120,7 @@ module YardGhurt
143
120
 
144
121
  if !deploy
145
122
  puts
146
- puts %Q(Execute "rake #{@name}[true]" for actually deploying (not a dry-run))
123
+ puts %(Execute "rake #{@name}[true]" for actually deploying (not a dry-run))
147
124
  end
148
125
 
149
126
  @after.call(self,args) if @after.respond_to?(:call)
@@ -3,14 +3,12 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2021 Jonathan Bradley Whited
6
+ # Copyright (c) 2019 Bradley Whited
7
7
  #
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  module YardGhurt
13
- ###
14
12
  # Utility methods in a separate module/mixin,
15
13
  # so that a programmer can require/load a sole task:
16
14
  # require 'yard_ghurt/gfm_fix_task'
@@ -23,15 +21,13 @@ module YardGhurt
23
21
  # External code can either use this module or {YardGhurt},
24
22
  # which includes this module as a mixin.
25
23
  #
26
- # @author Jonathan Bradley Whited
27
- # @since 1.0.0
28
- ###
24
+ # @since 1.0.0
29
25
  module Util
30
26
  # @return [Array<String>] the lower-case Strings that will equal to +true+
31
- TRUE_BOOLS = %w[ 1 on t true y yes ].freeze
27
+ TRUE_BOOLS = %w[1 on t true y yes].freeze
32
28
 
33
29
  # @return a very flexible (non-strict) Semantic Versioning regex, ignoring pre-release/build-metadata
34
- # @since 1.2.1
30
+ # @since 1.2.1
35
31
  SEM_VER_REGEX = /(?<major>\d+)(?:\.(?<minor>\d+))?(?:\.(?<patch>\d+))?/.freeze
36
32
 
37
33
  # If +include Util+ is called, extend {ClassMethods}.
@@ -48,7 +44,7 @@ module YardGhurt
48
44
  #
49
45
  # @param filename [String] the file to remove
50
46
  # @param output [true,false] whether to log it to stdout
51
- def rm_exist(filename,output=true)
47
+ def rm_exist(filename,output = true)
52
48
  return unless File.exist?(filename)
53
49
 
54
50
  puts "[#{filename}]: - Deleted" if output
@@ -77,12 +73,12 @@ module YardGhurt
77
73
  # This is used for checking the YARD version internally,
78
74
  # so needs to be very flexible.
79
75
  #
80
- # @param str [String,Object] the object to parse; +to_s()+ will be called on it
76
+ # @param str [String,Object] the object to parse; +to_s()+ will be called on it
81
77
  # @return [Hash] the Semantic Version parts: +{:major, :minor, :patch}+
82
78
  # defaults all values to +0+ if the version cannot be parsed
83
- # @see SEM_VER_REGEX
84
- # @see #yard_sem_ver
85
- # @since 1.2.1
79
+ # @see SEM_VER_REGEX
80
+ # @see #yard_sem_ver
81
+ # @since 1.2.1
86
82
  def parse_sem_ver(str)
87
83
  sem_ver = {
88
84
  major: 0,minor: 0,patch: 0,
@@ -109,20 +105,16 @@ module YardGhurt
109
105
  # On subsequent calls, it will return the stored value.
110
106
  #
111
107
  # @return [Hash] YARD's version parts
112
- # @see parse_sem_ver
113
- # @since 1.2.1
108
+ # @see parse_sem_ver
109
+ # @since 1.2.1
114
110
  def yard_sem_ver
115
111
  return @yard_sem_ver unless @yard_sem_ver.nil?
116
112
 
117
113
  require 'yard'
118
114
 
119
- if defined?(YARD::VERSION)
120
- ver = YARD::VERSION
121
- else
122
- ver = ''
123
- end
115
+ @yard_sem_ver = parse_sem_ver(defined?(YARD::VERSION) ? YARD::VERSION : '')
124
116
 
125
- return(@yard_sem_ver = parse_sem_ver(ver))
117
+ return @yard_sem_ver
126
118
  end
127
119
  end
128
120
 
@@ -3,12 +3,11 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2021 Jonathan Bradley Whited
6
+ # Copyright (c) 2019 Bradley Whited
7
7
  #
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  module YardGhurt
13
- VERSION = '1.2.1'
12
+ VERSION = '1.2.2'
14
13
  end
data/lib/yard_ghurt.rb CHANGED
@@ -3,12 +3,11 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2021 Jonathan Bradley Whited
6
+ # Copyright (c) 2019 Bradley Whited
7
7
  #
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  require 'optparse'
13
12
  require 'yard_ghurt/anchor_links'
14
13
  require 'yard_ghurt/gfm_fix_task'
@@ -16,30 +15,23 @@ require 'yard_ghurt/ghp_sync_task'
16
15
  require 'yard_ghurt/util'
17
16
  require 'yard_ghurt/version'
18
17
 
19
-
20
- ###
21
18
  # YARDoc GitHub Rake Tasks
22
19
  #
23
- # @author Jonathan Bradley Whited
24
- # @since 1.0.0
25
- ###
20
+ # @since 1.0.0
26
21
  module YardGhurt
27
22
  # Internal code should use +Util.+!
28
23
  # See {Util} for details.
29
24
  include Util
30
25
 
31
- ###
32
26
  # A simple CLI app used in file +bin/yard_ghurt+.
33
27
  #
34
28
  # Mainly for getting GitHub/YARDoc anchor link IDs.
35
29
  #
36
- # @author Jonathan Bradley Whited
37
- # @since 1.2.0
38
- ###
30
+ # @since 1.2.0
39
31
  class App
40
32
  attr_reader :args
41
33
 
42
- def initialize(args=ARGV)
34
+ def initialize(args = ARGV)
43
35
  super()
44
36
 
45
37
  @args = args
@@ -69,20 +61,20 @@ module YardGhurt
69
61
  exit
70
62
  end
71
63
 
72
- op.separator op.summary_indent + '---'
64
+ op.separator("#{op.summary_indent}---")
73
65
 
74
- op.on_tail('-h','--help','Print this help') do
66
+ op.on_tail('-h','--help','Show help') do
75
67
  puts op
76
68
  exit
77
69
  end
78
- op.on_tail('-v','--version','Print the version') do
70
+ op.on_tail('-v','--version','Show version') do
79
71
  puts "#{op.program_name} v#{op.version}"
80
72
  exit
81
73
  end
82
74
  end
83
75
 
84
76
  parser.parse!(@args)
85
- puts parser # Print help if nothing was parsed
77
+ puts parser # Print help if nothing was parsed.
86
78
  end
87
79
  end
88
80
  end