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.
@@ -1,115 +1,83 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # This file is part of YardGhurt.
7
- # Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # YardGhurt is free software: you can redistribute it and/or modify
10
- # it under the terms of the GNU Lesser General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # YardGhurt is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU Lesser General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU Lesser General Public License
20
- # along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
6
+ # Copyright (c) 2019 Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
-
24
11
  require 'rake'
25
-
26
12
  require 'rake/tasklib'
27
-
28
13
  require 'yard_ghurt/util'
29
14
 
30
15
  module YardGhurt
31
- ###
32
16
  # Sync YARDoc to a local GitHub Pages repo (uses +rsync+ by default).
33
- #
17
+ #
34
18
  # @example What I Use
35
- # YardGhurt::GHPSyncTask.new() do |task|
19
+ # YardGhurt::GHPSyncTask.new do |task|
36
20
  # task.ghp_dir = '../esotericpig.github.io/docs/yard_ghurt/yardoc'
37
21
  # task.sync_args << '--delete-after'
38
22
  # end
39
- #
40
- # @example Using All Options
41
- # # Execute: rake ghp_doc[false,'Ruby']
42
- # YardGhurt::GHPSyncTask.new(:ghp_doc) do |task|
43
- # task.arg_names << :name # Custom args
44
- # task.deps << :yard # Custom dependencies
45
- # task.description = 'Rsync my_doc/ to my page'
46
- # task.doc_dir = 'my_doc' # YARDoc directory of generated files
47
- # task.ghp_dir = '../dest_dir/my_page'
48
- # task.strict = true # Fail if doc_dir doesn't exist
49
- # task.sync_args << '--delete-after'
50
- # task.sync_cmd = '/usr/bin/rsync'
51
- #
52
- # task.before = Proc.new() {|task,args| puts "Hi, #{args.name}!"}
53
- # task.after = Proc.new() {|task,args| puts "Goodbye, #{args.name}!"}
54
- # end
55
- #
56
- # @author Jonathan Bradley Whited (@esotericpig)
57
- # @since 1.1.0
58
- ###
23
+ #
24
+ # @since 1.1.0
59
25
  class GHPSyncTask < Rake::TaskLib
60
26
  # @return [Proc,nil] the Proc ( +respond_to?(:call)+ ) to call at the end of this task or +nil+;
61
27
  # default: +nil+
62
28
  attr_accessor :after
63
-
29
+
64
30
  # @note +:deploy+ will be added no matter what (cannot be deleted)
65
- #
31
+ #
66
32
  # @return [Array<Symbol>,Symbol] the custom arg(s) for this task; default: +[:deploy]+
67
33
  attr_accessor :arg_names
68
-
34
+
69
35
  # @return [Proc,nil] the Proc ( +respond_to?(:call)+ ) to call at the beginning of this task or +nil+;
70
36
  # default: +nil+
71
37
  attr_accessor :before
72
-
38
+
73
39
  # @example
74
40
  # task.deps = :yard
75
41
  # # or...
76
42
  # task.deps = [:yard,:yard_gfm_fix]
77
- #
43
+ #
78
44
  # @return [Array<Symbol>,Symbol] the custom dependencies for this task; default: +[]+
79
45
  attr_accessor :deps
80
-
46
+
81
47
  # @return [String] the description of this task (customizable)
82
48
  attr_accessor :description
83
-
49
+
84
50
  # @return [String] the source directory of generated YARDoc files; default: +doc+
85
51
  attr_accessor :doc_dir
86
-
52
+
87
53
  # @note You must set this, else an error is thrown.
88
- #
54
+ #
89
55
  # @return [String] the destination directory to sync {doc_dir} to
90
56
  attr_accessor :ghp_dir
91
-
57
+
92
58
  # @return [String] the name of this task (customizable); default: +yard_ghp_sync+
93
59
  attr_accessor :name
94
-
60
+
95
61
  # If you want to use a non-local {doc_dir} (a remote host), set this to +false+.
96
- #
62
+ #
97
63
  # @return [true,false] whether to throw an error if {doc_dir} does not exist; default: +true+
98
64
  attr_accessor :strict
99
-
65
+
100
66
  # @note You should pass in multi-args separately: +['--exclude','*~']+
101
67
  # @note You should not single/double quote the args; +['"*~"']+ is unnecessary.
102
- #
68
+ #
103
69
  # @return [Array<String>] the args to pass to the {sync_cmd}; default: +['-ahv','--progress']+
104
70
  attr_accessor :sync_args
105
-
71
+
106
72
  # @return [String] the sync command to use on the command line; default: +rsync+
107
73
  attr_accessor :sync_cmd
108
-
74
+
109
75
  alias_method :strict?,:strict
110
-
76
+
111
77
  # @param name [Symbol] the name of this task to use on the command line with +rake+
112
- def initialize(name=:yard_ghp_sync)
78
+ def initialize(name = :yard_ghp_sync)
79
+ super()
80
+
113
81
  @after = nil
114
82
  @arg_names = []
115
83
  @before = nil
@@ -121,62 +89,61 @@ module YardGhurt
121
89
  @strict = true
122
90
  @sync_args = ['-ahv','--progress']
123
91
  @sync_cmd = 'rsync'
124
-
125
- yield self if block_given?()
126
- define()
92
+
93
+ yield(self) if block_given?
94
+ define
127
95
  end
128
-
96
+
129
97
  # Define the Rake task and description using the instance variables.
130
- def define()
98
+ def define
131
99
  @arg_names = *@arg_names
132
100
  @arg_names.unshift(:deploy) unless @arg_names.include?(:deploy)
133
-
101
+
134
102
  desc @description
135
- task @name,@arg_names => Array(@deps) do |task,args|
103
+ task @name,@arg_names => Array(@deps) do |_task,args|
136
104
  deploy = Util.to_bool(args.deploy)
137
-
105
+
138
106
  @before.call(self,args) if @before.respond_to?(:call)
139
-
140
- # Without these checks, sh raises some pretty cryptic errors.
141
- if @strict
142
- # If you want to use a non-local dir, set strict to false.
143
- if !File.exist?(@doc_dir)
144
- raise ArgumentError,%Q(#{self.class}.doc_dir [#{@doc_dir}] does not exist; execute "rake yard"?)
145
- end
107
+
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"?)
146
113
  end
147
114
  # Do not check if ghp_dir exists because rsync may create it.
148
- if @ghp_dir.nil?() || @ghp_dir.to_s().strip().empty?()
115
+ if @ghp_dir.nil? || @ghp_dir.to_s.strip.empty?
149
116
  raise ArgumentError,"#{self.class}.ghp_dir must be set"
150
117
  end
151
-
118
+
152
119
  sh(*build_sh_cmd(deploy))
153
-
120
+
154
121
  if !deploy
155
122
  puts
156
- 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))
157
124
  end
158
-
125
+
159
126
  @after.call(self,args) if @after.respond_to?(:call)
160
127
  end
161
-
128
+
162
129
  return self
163
130
  end
164
-
131
+
165
132
  # Build the sync command to use on the command line.
166
- #
133
+ #
167
134
  # @param deploy [true,false] whether to actually deploy (+true+) or to run a dry-run (+false+)
168
- #
135
+ #
169
136
  # @return [Array<String>] the sync command and its args
170
137
  def build_sh_cmd(deploy)
171
138
  sh_cmd = [@sync_cmd]
172
-
139
+
173
140
  sh_cmd << '--dry-run' unless deploy
174
141
  sh_cmd.push(*@sync_args)
175
-
142
+
176
143
  # File.join() to add a trailing '/' if not present
177
144
  sh_cmd << File.join(@doc_dir,'')
178
145
  sh_cmd << File.join(@ghp_dir,'')
179
-
146
+
180
147
  return sh_cmd
181
148
  end
182
149
  end
@@ -1,81 +1,123 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # This file is part of YardGhurt.
7
- # Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # YardGhurt is free software: you can redistribute it and/or modify
10
- # it under the terms of the GNU Lesser General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # YardGhurt is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU Lesser General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU Lesser General Public License
20
- # along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
6
+ # Copyright (c) 2019 Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
-
24
11
  module YardGhurt
25
- ###
26
12
  # Utility methods in a separate module/mixin,
27
13
  # so that a programmer can require/load a sole task:
28
14
  # require 'yard_ghurt/gfm_fix_task'
29
- #
15
+ #
30
16
  # Else, programmers would be required to always require/load the entire +yard_ghurt+ module:
31
17
  # require 'yard_ghurt'
32
- #
18
+ #
33
19
  # All internal code should use this module.
34
- #
20
+ #
35
21
  # External code can either use this module or {YardGhurt},
36
22
  # which includes this module as a mixin.
37
- #
38
- # @author Jonathan Bradley Whited (@esotericpig)
39
- # @since 1.0.0
40
- ###
23
+ #
24
+ # @since 1.0.0
41
25
  module Util
42
26
  # @return [Array<String>] the lower-case Strings that will equal to +true+
43
- TRUE_BOOLS = ['1','on','t','true','y','yes'].freeze()
44
-
27
+ TRUE_BOOLS = %w[1 on t true y yes].freeze
28
+
29
+ # @return a very flexible (non-strict) Semantic Versioning regex, ignoring pre-release/build-metadata
30
+ # @since 1.2.1
31
+ SEM_VER_REGEX = /(?<major>\d+)(?:\.(?<minor>\d+))?(?:\.(?<patch>\d+))?/.freeze
32
+
45
33
  # If +include Util+ is called, extend {ClassMethods}.
46
- #
34
+ #
47
35
  # @param mod [Module] the module to extend
48
36
  def self.included(mod)
49
37
  mod.extend ClassMethods
50
38
  end
51
-
39
+
52
40
  module ClassMethods
41
+ @yard_sem_ver = nil
42
+
53
43
  # If +filename+ exists, delete it, and if +output+ is +true+, log it to stdout.
54
- #
44
+ #
55
45
  # @param filename [String] the file to remove
56
46
  # @param output [true,false] whether to log it to stdout
57
- def rm_exist(filename,output=true)
47
+ def rm_exist(filename,output = true)
58
48
  return unless File.exist?(filename)
59
-
49
+
60
50
  puts "[#{filename}]: - Deleted" if output
61
51
  File.delete(filename)
62
52
  end
63
-
53
+
64
54
  # Convert +str+ to +true+ or +false+.
65
- #
55
+ #
66
56
  # Even if +str+ is not a String, +to_s()+ will be called, so should be safe.
67
- #
57
+ #
68
58
  # @param str [String,Object] the String (or Object) to convert
69
- #
59
+ #
70
60
  # @return [true,false] the boolean value of +str+
71
- #
61
+ #
72
62
  # @see TRUE_BOOLS
73
63
  # @see GHPSyncTask#arg_names
74
64
  def to_bool(str)
75
- return TRUE_BOOLS.include?(str.to_s().downcase())
65
+ return TRUE_BOOLS.include?(str.to_s.downcase)
66
+ end
67
+
68
+ # Parse +str+ as a non-strict Semantic Version:
69
+ # \d+.\d+.\d+
70
+ #
71
+ # Unlike the specification, minor and patch are optional.
72
+ # Also, pre-release and build metadata are ignored.
73
+ # This is used for checking the YARD version internally,
74
+ # so needs to be very flexible.
75
+ #
76
+ # @param str [String,Object] the object to parse; +to_s()+ will be called on it
77
+ # @return [Hash] the Semantic Version parts: +{:major, :minor, :patch}+
78
+ # defaults all values to +0+ if the version cannot be parsed
79
+ # @see SEM_VER_REGEX
80
+ # @see #yard_sem_ver
81
+ # @since 1.2.1
82
+ def parse_sem_ver(str)
83
+ sem_ver = {
84
+ major: 0,minor: 0,patch: 0,
85
+ }
86
+
87
+ match = SEM_VER_REGEX.match(str.to_s.gsub(/\s+/u,''))
88
+
89
+ return sem_ver unless match
90
+
91
+ sem_ver[:major] = match[:major].to_i
92
+ sem_ver[:minor] = match[:minor].to_i unless match[:minor].nil?
93
+ sem_ver[:patch] = match[:patch].to_i unless match[:patch].nil?
94
+
95
+ return sem_ver
96
+ end
97
+
98
+ # Returns YARD's version as a +Hash+ of parts:
99
+ # { major: 0, minor: 0, patch: 0 }
100
+ #
101
+ # If the version can not be parsed, it will return the exact
102
+ # same +Hash+ as above with all values to +0+.
103
+ #
104
+ # On initial call, it will parse it and store it.
105
+ # On subsequent calls, it will return the stored value.
106
+ #
107
+ # @return [Hash] YARD's version parts
108
+ # @see parse_sem_ver
109
+ # @since 1.2.1
110
+ def yard_sem_ver
111
+ return @yard_sem_ver unless @yard_sem_ver.nil?
112
+
113
+ require 'yard'
114
+
115
+ @yard_sem_ver = parse_sem_ver(defined?(YARD::VERSION) ? YARD::VERSION : '')
116
+
117
+ return @yard_sem_ver
76
118
  end
77
119
  end
78
-
120
+
79
121
  extend ClassMethods
80
122
  end
81
123
  end
@@ -1,26 +1,13 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # This file is part of YardGhurt.
7
- # Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # YardGhurt is free software: you can redistribute it and/or modify
10
- # it under the terms of the GNU Lesser General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # YardGhurt is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU Lesser General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU Lesser General Public License
20
- # along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
6
+ # Copyright (c) 2019 Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
-
24
11
  module YardGhurt
25
- VERSION = '1.2.0'
12
+ VERSION = '1.2.2'
26
13
  end
data/lib/yard_ghurt.rb CHANGED
@@ -1,26 +1,13 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
3
2
  # frozen_string_literal: true
4
3
 
5
4
  #--
6
5
  # This file is part of YardGhurt.
7
- # Copyright (c) 2019-2020 Jonathan Bradley Whited (@esotericpig)
8
- #
9
- # YardGhurt is free software: you can redistribute it and/or modify
10
- # it under the terms of the GNU Lesser General Public License as published by
11
- # the Free Software Foundation, either version 3 of the License, or
12
- # (at your option) any later version.
13
- #
14
- # YardGhurt is distributed in the hope that it will be useful,
15
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- # GNU Lesser General Public License for more details.
18
- #
19
- # You should have received a copy of the GNU Lesser General Public License
20
- # along with YardGhurt. If not, see <https://www.gnu.org/licenses/>.
6
+ # Copyright (c) 2019 Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
21
9
  #++
22
10
 
23
-
24
11
  require 'optparse'
25
12
  require 'yard_ghurt/anchor_links'
26
13
  require 'yard_ghurt/gfm_fix_task'
@@ -28,73 +15,66 @@ require 'yard_ghurt/ghp_sync_task'
28
15
  require 'yard_ghurt/util'
29
16
  require 'yard_ghurt/version'
30
17
 
31
-
32
- ###
33
18
  # YARDoc GitHub Rake Tasks
34
- #
35
- # @author Jonathan Bradley Whited (@esotericpig)
36
- # @since 1.0.0
37
- ###
19
+ #
20
+ # @since 1.0.0
38
21
  module YardGhurt
39
22
  # Internal code should use +Util.+!
40
23
  # See {Util} for details.
41
24
  include Util
42
-
43
- ###
25
+
44
26
  # A simple CLI app used in file +bin/yard_ghurt+.
45
- #
27
+ #
46
28
  # Mainly for getting GitHub/YARDoc anchor link IDs.
47
- #
48
- # @author Jonathan Bradley Whited (@esotericpig)
49
- # @since 1.2.0
50
- ###
29
+ #
30
+ # @since 1.2.0
51
31
  class App
52
32
  attr_reader :args
53
-
54
- def initialize(args=ARGV)
33
+
34
+ def initialize(args = ARGV)
55
35
  super()
56
-
36
+
57
37
  @args = args
58
38
  end
59
-
60
- def run()
61
- parser = OptionParser.new() do |op|
39
+
40
+ def run
41
+ parser = OptionParser.new do |op|
62
42
  op.program_name = 'yard_ghurt'
63
43
  op.version = VERSION
64
-
44
+
65
45
  op.banner = "Usage: #{op.program_name} [options]"
66
-
46
+
67
47
  op.on('-a','--anchor <string>','Print GitHub & YARDoc anchor link IDs of <string>') do |str|
68
- al = AnchorLinks.new()
48
+ al = AnchorLinks.new
69
49
  puts "GitHub: #{al.to_github_anchor_id(str)}"
70
50
  puts "YARDoc: #{al.to_yard_anchor_id(str)}"
71
51
  exit
72
52
  end
73
53
  op.on('-g','--github <string>','Print GitHub anchor link ID of <string>') do |str|
74
- al = AnchorLinks.new()
54
+ al = AnchorLinks.new
75
55
  puts al.to_github_anchor_id(str)
76
56
  exit
77
57
  end
78
58
  op.on('-y','--yard <string>','Print YARDoc anchor link ID of <string>') do |str|
79
- al = AnchorLinks.new()
59
+ al = AnchorLinks.new
80
60
  puts al.to_yard_anchor_id(str)
81
61
  exit
82
62
  end
83
-
84
- op.separator op.summary_indent + '---'
85
-
86
- op.on_tail('-h','--help','Print this help') do
63
+
64
+ op.separator("#{op.summary_indent}---")
65
+
66
+ op.on_tail('-h','--help','Show help') do
87
67
  puts op
88
68
  exit
89
69
  end
90
- op.on_tail('-v','--version','Print the version') do
70
+ op.on_tail('-v','--version','Show version') do
91
71
  puts "#{op.program_name} v#{op.version}"
92
72
  exit
93
73
  end
94
74
  end
95
-
75
+
96
76
  parser.parse!(@args)
97
- puts parser # Print help if nothing was parsed
77
+ puts parser # Print help if nothing was parsed.
98
78
  end
99
79
  end
100
80
  end
data/yard_ghurt.gemspec CHANGED
@@ -3,62 +3,58 @@
3
3
 
4
4
  #--
5
5
  # This file is part of YardGhurt.
6
- # Copyright (c) 2019-2020 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/>.
6
+ # Copyright (c) 2019 Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
20
9
  #++
21
10
 
11
+ require_relative 'lib/yard_ghurt/version'
22
12
 
23
- lib = File.expand_path(File.join('..','lib'),__FILE__)
24
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
25
-
26
- require 'yard_ghurt/version'
27
-
28
- Gem::Specification.new() do |spec|
13
+ Gem::Specification.new do |spec|
29
14
  spec.name = 'yard_ghurt'
30
15
  spec.version = YardGhurt::VERSION
31
- spec.authors = ['Jonathan Bradley Whited (@esotericpig)']
32
- spec.email = ['bradley@esotericpig.com']
16
+ spec.authors = ['Bradley Whited']
17
+ spec.email = ['code@esotericpig.com']
33
18
  spec.licenses = ['LGPL-3.0-or-later']
34
19
  spec.homepage = 'https://github.com/esotericpig/yard_ghurt'
35
- spec.summary = 'YARDoc GitHub Rake Tasks'
36
- spec.description = "#{spec.summary}. Fix GitHub Flavored Markdown (GFM) files."
37
-
20
+ spec.summary = 'YARDoc GitHub Rake Tasks.'
21
+ spec.description = "#{spec.summary} Fix GitHub Flavored Markdown (GFM) files."
22
+
38
23
  spec.metadata = {
39
- 'bug_tracker_uri' => 'https://github.com/esotericpig/yard_ghurt/issues',
40
- 'changelog_uri' => 'https://github.com/esotericpig/yard_ghurt/blob/master/CHANGELOG.md',
41
- 'documentation_uri' => 'https://esotericpig.github.io/docs/yard_ghurt/yardoc/index.html',
42
- 'homepage_uri' => 'https://github.com/esotericpig/yard_ghurt',
43
- 'source_code_uri' => 'https://github.com/esotericpig/yard_ghurt'
24
+ 'rubygems_mfa_required' => 'true',
25
+ 'homepage_uri' => spec.homepage,
26
+ 'source_code_uri' => 'https://github.com/esotericpig/yard_ghurt',
27
+ 'documentation_uri' => 'https://esotericpig.github.io/docs/yard_ghurt/yardoc/index.html',
28
+ 'bug_tracker_uri' => 'https://github.com/esotericpig/yard_ghurt/issues',
44
29
  }
45
-
46
- spec.require_paths = ['lib']
47
- spec.bindir = 'bin'
48
- spec.executables = [spec.name]
49
-
50
- spec.files = Dir.glob(File.join("{#{spec.require_paths.join(',')}}",'**','*.{erb,rb}')) +
51
- Dir.glob(File.join(spec.bindir,'**',"{#{spec.executables.join(',')}}")) +
52
- Dir.glob(File.join('{test,yard}','**','*.{erb,rb}')) +
53
- %W( Gemfile #{spec.name}.gemspec Rakefile ) +
54
- %w( CHANGELOG.md LICENSE.txt README.md )
55
-
56
- spec.required_ruby_version = '>= 2.1.10'
57
-
58
- spec.add_runtime_dependency 'rake' #,'~> 12.3'
59
-
60
- spec.add_development_dependency 'bundler' ,'~> 1.17'
61
- spec.add_development_dependency 'rdoc' ,'~> 6.1' # For RDoc for YARD (*.rb)
62
- spec.add_development_dependency 'redcarpet','~> 3.5' # For Markdown for YARD (*.md)
63
- spec.add_development_dependency 'yard' ,'~> 0.9'
30
+
31
+ spec.required_ruby_version = '>= 2.3'
32
+ spec.require_paths = ['lib']
33
+ spec.bindir = 'bin'
34
+ spec.executables = [spec.name]
35
+
36
+ spec.files = [
37
+ Dir.glob("{#{spec.require_paths.join(',')}}/**/*.{erb,rb}"),
38
+ Dir.glob("#{spec.bindir}/*"),
39
+ Dir.glob('{spec,test,yard}/**/*.{erb,rb}'),
40
+ %W[Gemfile #{spec.name}.gemspec Rakefile .yardopts],
41
+ %w[LICENSE.txt README.md],
42
+ ].flatten
43
+
44
+ # TEST: Test using different Gem versions:
45
+ # GST=1 bundle update && bundle exec rake doc
46
+ gemspec_test = ENV.fetch('GST','').to_s.strip
47
+ yard_gemv = false
48
+
49
+ if !gemspec_test.empty?
50
+ case gemspec_test
51
+ when '1' then yard_gemv = '0.9.24'
52
+ end
53
+
54
+ puts 'Using Gem versions:'
55
+ puts " yard: #{yard_gemv.inspect}"
56
+ end
57
+
58
+ spec.add_dependency 'rake' # 13.0.3.
59
+ spec.add_dependency 'yard',yard_gemv || '>= 0' # 0.9.26, 0.9.24 (diff).
64
60
  end