rdoc 6.4.0 → 6.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.rdoc +1 -2
  3. data/LEGAL.rdoc +1 -1
  4. data/exe/rdoc +0 -1
  5. data/lib/rdoc/any_method.rb +2 -2
  6. data/lib/rdoc/code_objects.rb +1 -2
  7. data/lib/rdoc/context/section.rb +2 -0
  8. data/lib/rdoc/context.rb +1 -3
  9. data/lib/rdoc/cross_reference.rb +17 -1
  10. data/lib/rdoc/generator/markup.rb +1 -1
  11. data/lib/rdoc/generator/template/darkfish/_head.rhtml +10 -10
  12. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +27 -3
  13. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +22 -2
  14. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +25 -4
  15. data/lib/rdoc/generator/template/darkfish/class.rhtml +22 -20
  16. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +24 -1
  17. data/lib/rdoc/generator/template/darkfish/index.rhtml +1 -1
  18. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +1 -1
  19. data/lib/rdoc/generator/template/darkfish/js/search.js +1 -1
  20. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +2 -2
  21. data/lib/rdoc/generator.rb +5 -5
  22. data/lib/rdoc/i18n.rb +1 -1
  23. data/lib/rdoc/known_classes.rb +5 -4
  24. data/lib/rdoc/markdown/literals.rb +24 -8
  25. data/lib/rdoc/markdown.kpeg +25 -18
  26. data/lib/rdoc/markdown.rb +323 -226
  27. data/lib/rdoc/markup/attribute_manager.rb +29 -35
  28. data/lib/rdoc/markup/parser.rb +12 -6
  29. data/lib/rdoc/markup/to_html.rb +18 -14
  30. data/lib/rdoc/markup/to_label.rb +1 -1
  31. data/lib/rdoc/markup/to_rdoc.rb +3 -20
  32. data/lib/rdoc/markup.rb +35 -667
  33. data/lib/rdoc/method_attr.rb +1 -1
  34. data/lib/rdoc/normal_class.rb +1 -1
  35. data/lib/rdoc/normal_module.rb +1 -1
  36. data/lib/rdoc/options.rb +33 -18
  37. data/lib/rdoc/parser/c.rb +89 -101
  38. data/lib/rdoc/parser/ruby.rb +25 -10
  39. data/lib/rdoc/parser.rb +19 -2
  40. data/lib/rdoc/rd/block_parser.rb +13 -9
  41. data/lib/rdoc/rd/block_parser.ry +12 -8
  42. data/lib/rdoc/rd/inline_parser.rb +1 -1
  43. data/lib/rdoc/rd.rb +3 -4
  44. data/lib/rdoc/rdoc.rb +17 -3
  45. data/lib/rdoc/ri/driver.rb +11 -78
  46. data/lib/rdoc/ri.rb +4 -5
  47. data/lib/rdoc/rubygems_hook.rb +1 -1
  48. data/lib/rdoc/servlet.rb +1 -1
  49. data/lib/rdoc/single_class.rb +5 -0
  50. data/lib/rdoc/stats.rb +3 -4
  51. data/lib/rdoc/store.rb +4 -4
  52. data/lib/rdoc/task.rb +3 -3
  53. data/lib/rdoc/version.rb +3 -1
  54. data/lib/rdoc.rb +46 -46
  55. metadata +4 -9
  56. data/Gemfile +0 -12
  57. data/Rakefile +0 -107
  58. data/bin/console +0 -7
  59. data/bin/setup +0 -6
  60. data/rdoc.gemspec +0 -249
data/lib/rdoc/rdoc.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rdoc'
2
+ require_relative '../rdoc'
3
3
 
4
4
  require 'find'
5
5
  require 'fileutils'
@@ -35,6 +35,17 @@ class RDoc::RDoc
35
35
 
36
36
  GENERATORS = {}
37
37
 
38
+ ##
39
+ # List of directory names always skipped
40
+
41
+ UNCONDITIONALLY_SKIPPED_DIRECTORIES = %w[CVS .svn .git].freeze
42
+
43
+ ##
44
+ # List of directory names skipped if test suites should be skipped
45
+
46
+ TEST_SUITE_DIRECTORY_NAMES = %w[spec test].freeze
47
+
48
+
38
49
  ##
39
50
  # Generator instance used for creating output
40
51
 
@@ -280,7 +291,10 @@ option)
280
291
  file_list[rel_file_name] = mtime
281
292
  end
282
293
  when "directory" then
283
- next if rel_file_name == "CVS" || rel_file_name == ".svn"
294
+ next if UNCONDITIONALLY_SKIPPED_DIRECTORIES.include?(rel_file_name)
295
+
296
+ basename = File.basename(rel_file_name)
297
+ next if options.skip_tests && TEST_SUITE_DIRECTORY_NAMES.include?(basename)
284
298
 
285
299
  created_rid = File.join rel_file_name, "created.rid"
286
300
  next if File.file? created_rid
@@ -440,11 +454,11 @@ The internal error was:
440
454
 
441
455
  if RDoc::Options === options then
442
456
  @options = options
443
- @options.finish
444
457
  else
445
458
  @options = RDoc::Options.load_options
446
459
  @options.parse options
447
460
  end
461
+ @options.finish
448
462
 
449
463
  if @options.pipe then
450
464
  handle_pipe
@@ -1,23 +1,10 @@
1
1
  # frozen_string_literal: true
2
- require 'abbrev'
3
2
  require 'optparse'
4
3
 
5
- begin
6
- require 'readline'
7
- rescue LoadError
8
- end
9
-
10
- begin
11
- require 'win32console'
12
- rescue LoadError
13
- end
14
-
15
- require 'rdoc'
16
-
17
- ##
18
- # For RubyGems backwards compatibility
4
+ require_relative '../../rdoc'
19
5
 
20
- require_relative 'formatter'
6
+ require_relative 'formatter' # For RubyGems backwards compatibility
7
+ # TODO: Fix weird documentation with `require_relative`
21
8
 
22
9
  ##
23
10
  # The RI driver implements the command-line ri tool.
@@ -433,9 +420,6 @@ or the PAGER environment variable.
433
420
  @use_stdout = options[:use_stdout]
434
421
  @show_all = options[:show_all]
435
422
  @width = options[:width]
436
-
437
- # pager process for jruby
438
- @jruby_pager_process = nil
439
423
  end
440
424
 
441
425
  ##
@@ -1051,36 +1035,6 @@ or the PAGER environment variable.
1051
1035
  self
1052
1036
  end
1053
1037
 
1054
- ##
1055
- # Finds the given +pager+ for jruby. Returns an IO if +pager+ was found.
1056
- #
1057
- # Returns false if +pager+ does not exist.
1058
- #
1059
- # Returns nil if the jruby JVM doesn't support ProcessBuilder redirection
1060
- # (1.6 and older).
1061
-
1062
- def find_pager_jruby pager
1063
- require 'java'
1064
- require 'shellwords'
1065
-
1066
- return nil unless java.lang.ProcessBuilder.constants.include? :Redirect
1067
-
1068
- pager = Shellwords.split pager
1069
-
1070
- pb = java.lang.ProcessBuilder.new(*pager)
1071
- pb = pb.redirect_output java.lang.ProcessBuilder::Redirect::INHERIT
1072
-
1073
- @jruby_pager_process = pb.start
1074
-
1075
- input = @jruby_pager_process.output_stream
1076
-
1077
- io = input.to_io
1078
- io.sync = true
1079
- io
1080
- rescue java.io.IOException
1081
- false
1082
- end
1083
-
1084
1038
  ##
1085
1039
  # Finds a store that matches +name+ which can be the name of a gem, "ruby",
1086
1040
  # "home" or "site".
@@ -1120,6 +1074,10 @@ or the PAGER environment variable.
1120
1074
  def interactive
1121
1075
  puts "\nEnter the method name you want to look up."
1122
1076
 
1077
+ begin
1078
+ require 'readline'
1079
+ rescue LoadError
1080
+ end
1123
1081
  if defined? Readline then
1124
1082
  Readline.completion_proc = method :complete
1125
1083
  puts "You can use tab to autocomplete."
@@ -1148,17 +1106,6 @@ or the PAGER environment variable.
1148
1106
  exit
1149
1107
  end
1150
1108
 
1151
- ##
1152
- # Is +file+ in ENV['PATH']?
1153
-
1154
- def in_path? file
1155
- return true if file =~ %r%\A/% and File.exist? file
1156
-
1157
- ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|
1158
- File.exist? File.join(path, file)
1159
- end
1160
- end
1161
-
1162
1109
  ##
1163
1110
  # Lists classes known to ri starting with +names+. If +names+ is empty all
1164
1111
  # known classes are shown.
@@ -1353,7 +1300,6 @@ or the PAGER environment variable.
1353
1300
  yield pager
1354
1301
  ensure
1355
1302
  pager.close
1356
- @jruby_pager_process.wait_for if @jruby_pager_process
1357
1303
  end
1358
1304
  else
1359
1305
  yield $stdout
@@ -1521,27 +1467,14 @@ or the PAGER environment variable.
1521
1467
  def setup_pager
1522
1468
  return if @use_stdout
1523
1469
 
1524
- jruby = RUBY_ENGINE == 'jruby'
1525
-
1526
1470
  pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
1527
1471
 
1472
+ require 'shellwords'
1528
1473
  pagers.compact.uniq.each do |pager|
1529
- next unless pager
1530
-
1531
- pager_cmd = pager.split(' ').first
1532
-
1533
- next unless in_path? pager_cmd
1534
-
1535
- if jruby then
1536
- case io = find_pager_jruby(pager)
1537
- when nil then break
1538
- when false then next
1539
- else io
1540
- end
1541
- else
1542
- io = IO.popen(pager, 'w') rescue next
1543
- end
1474
+ pager = Shellwords.split(pager)
1475
+ next if pager.empty?
1544
1476
 
1477
+ io = IO.popen(pager, 'w') rescue next
1545
1478
  next if $? and $?.pid == io.pid and $?.exited? # pager didn't work
1546
1479
 
1547
1480
  @paging = true
data/lib/rdoc/ri.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rdoc'
2
+ require_relative '../rdoc'
3
3
 
4
4
  ##
5
5
  # Namespace for the ri command line tool's implementation.
@@ -13,9 +13,8 @@ module RDoc::RI
13
13
 
14
14
  class Error < RDoc::Error; end
15
15
 
16
- autoload :Driver, 'rdoc/ri/driver'
17
- autoload :Paths, 'rdoc/ri/paths'
18
- autoload :Store, 'rdoc/ri/store'
16
+ autoload :Driver, "#{__dir__}/ri/driver"
17
+ autoload :Paths, "#{__dir__}/ri/paths"
18
+ autoload :Store, "#{__dir__}/ri/store"
19
19
 
20
20
  end
21
-
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rubygems/user_interaction'
3
3
  require 'fileutils'
4
- require 'rdoc'
4
+ require_relative '../rdoc'
5
5
 
6
6
  ##
7
7
  # Gem::RDoc provides methods to generate RDoc and ri data for installed gems
data/lib/rdoc/servlet.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rdoc'
2
+ require_relative '../rdoc'
3
3
  require 'erb'
4
4
  require 'time'
5
5
  require 'json'
@@ -22,5 +22,10 @@ class RDoc::SingleClass < RDoc::ClassModule
22
22
  "class << #{full_name}"
23
23
  end
24
24
 
25
+ def pretty_print q # :nodoc:
26
+ q.group 2, "[class << #{full_name}", "]" do
27
+ next
28
+ end
29
+ end
25
30
  end
26
31
 
data/lib/rdoc/stats.rb CHANGED
@@ -454,9 +454,8 @@ class RDoc::Stats
454
454
  [params.length, undoc]
455
455
  end
456
456
 
457
- autoload :Quiet, 'rdoc/stats/quiet'
458
- autoload :Normal, 'rdoc/stats/normal'
459
- autoload :Verbose, 'rdoc/stats/verbose'
457
+ autoload :Quiet, "#{__dir__}/stats/quiet"
458
+ autoload :Normal, "#{__dir__}/stats/normal"
459
+ autoload :Verbose, "#{__dir__}/stats/verbose"
460
460
 
461
461
  end
462
-
data/lib/rdoc/store.rb CHANGED
@@ -557,7 +557,7 @@ class RDoc::Store
557
557
  #orig_enc = @encoding
558
558
 
559
559
  File.open cache_path, 'rb' do |io|
560
- @cache = Marshal.load io.read
560
+ @cache = Marshal.load io
561
561
  end
562
562
 
563
563
  load_enc = @cache[:encoding]
@@ -616,7 +616,7 @@ class RDoc::Store
616
616
  file = class_file klass_name
617
617
 
618
618
  File.open file, 'rb' do |io|
619
- Marshal.load io.read
619
+ Marshal.load io
620
620
  end
621
621
  rescue Errno::ENOENT => e
622
622
  error = MissingFileError.new(self, file, klass_name)
@@ -631,7 +631,7 @@ class RDoc::Store
631
631
  file = method_file klass_name, method_name
632
632
 
633
633
  File.open file, 'rb' do |io|
634
- obj = Marshal.load io.read
634
+ obj = Marshal.load io
635
635
  obj.store = self
636
636
  obj.parent =
637
637
  find_class_or_module(klass_name) || load_class(klass_name) unless
@@ -651,7 +651,7 @@ class RDoc::Store
651
651
  file = page_file page_name
652
652
 
653
653
  File.open file, 'rb' do |io|
654
- obj = Marshal.load io.read
654
+ obj = Marshal.load io
655
655
  obj.store = self
656
656
  obj
657
657
  end
data/lib/rdoc/task.rb CHANGED
@@ -32,7 +32,7 @@ begin
32
32
  rescue Gem::LoadError
33
33
  end unless defined?(Rake)
34
34
 
35
- require 'rdoc'
35
+ require_relative '../rdoc'
36
36
  require 'rake'
37
37
  require 'rake/tasklib'
38
38
 
@@ -71,7 +71,7 @@ require 'rake/tasklib'
71
71
  # require 'rdoc/task'
72
72
  #
73
73
  # RDoc::Task.new :rdoc_dev do |rdoc|
74
- # rdoc.main = "README.doc"
74
+ # rdoc.main = "README.rdoc"
75
75
  # rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
76
76
  # rdoc.options << "--all"
77
77
  # end
@@ -323,7 +323,7 @@ module Rake
323
323
  ##
324
324
  # For backwards compatibility
325
325
 
326
- RDocTask = RDoc::Task
326
+ RDocTask = RDoc::Task # :nodoc:
327
327
 
328
328
  end
329
329
  # :startdoc:
data/lib/rdoc/version.rb CHANGED
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RDoc
2
4
 
3
5
  ##
4
6
  # RDoc version you are using
5
7
 
6
- VERSION = '6.4.0'
8
+ VERSION = '6.5.0'
7
9
 
8
10
  end
data/lib/rdoc.rb CHANGED
@@ -62,7 +62,7 @@ module RDoc
62
62
 
63
63
  class Error < RuntimeError; end
64
64
 
65
- require 'rdoc/version'
65
+ require_relative 'rdoc/version'
66
66
 
67
67
  ##
68
68
  # Method visibilities
@@ -141,61 +141,61 @@ module RDoc
141
141
  end
142
142
  end
143
143
 
144
- autoload :RDoc, 'rdoc/rdoc'
144
+ autoload :RDoc, "#{__dir__}/rdoc/rdoc"
145
145
 
146
- autoload :CrossReference, 'rdoc/cross_reference'
147
- autoload :ERBIO, 'rdoc/erbio'
148
- autoload :ERBPartial, 'rdoc/erb_partial'
149
- autoload :Encoding, 'rdoc/encoding'
150
- autoload :Generator, 'rdoc/generator'
151
- autoload :Options, 'rdoc/options'
152
- autoload :Parser, 'rdoc/parser'
153
- autoload :Servlet, 'rdoc/servlet'
154
- autoload :RI, 'rdoc/ri'
155
- autoload :Stats, 'rdoc/stats'
156
- autoload :Store, 'rdoc/store'
157
- autoload :Task, 'rdoc/task'
158
- autoload :Text, 'rdoc/text'
146
+ autoload :CrossReference, "#{__dir__}/rdoc/cross_reference"
147
+ autoload :ERBIO, "#{__dir__}/rdoc/erbio"
148
+ autoload :ERBPartial, "#{__dir__}/rdoc/erb_partial"
149
+ autoload :Encoding, "#{__dir__}/rdoc/encoding"
150
+ autoload :Generator, "#{__dir__}/rdoc/generator"
151
+ autoload :Options, "#{__dir__}/rdoc/options"
152
+ autoload :Parser, "#{__dir__}/rdoc/parser"
153
+ autoload :Servlet, "#{__dir__}/rdoc/servlet"
154
+ autoload :RI, "#{__dir__}/rdoc/ri"
155
+ autoload :Stats, "#{__dir__}/rdoc/stats"
156
+ autoload :Store, "#{__dir__}/rdoc/store"
157
+ autoload :Task, "#{__dir__}/rdoc/task"
158
+ autoload :Text, "#{__dir__}/rdoc/text"
159
159
 
160
- autoload :Markdown, 'rdoc/markdown'
161
- autoload :Markup, 'rdoc/markup'
162
- autoload :RD, 'rdoc/rd'
163
- autoload :TomDoc, 'rdoc/tom_doc'
160
+ autoload :Markdown, "#{__dir__}/rdoc/markdown"
161
+ autoload :Markup, "#{__dir__}/rdoc/markup"
162
+ autoload :RD, "#{__dir__}/rdoc/rd"
163
+ autoload :TomDoc, "#{__dir__}/rdoc/tom_doc"
164
164
 
165
- autoload :KNOWN_CLASSES, 'rdoc/known_classes'
165
+ autoload :KNOWN_CLASSES, "#{__dir__}/rdoc/known_classes"
166
166
 
167
- autoload :TokenStream, 'rdoc/token_stream'
167
+ autoload :TokenStream, "#{__dir__}/rdoc/token_stream"
168
168
 
169
- autoload :Comment, 'rdoc/comment'
169
+ autoload :Comment, "#{__dir__}/rdoc/comment"
170
170
 
171
- require 'rdoc/i18n'
171
+ require_relative 'rdoc/i18n'
172
172
 
173
173
  # code objects
174
174
  #
175
175
  # We represent the various high-level code constructs that appear in Ruby
176
176
  # programs: classes, modules, methods, and so on.
177
- autoload :CodeObject, 'rdoc/code_object'
178
-
179
- autoload :Context, 'rdoc/context'
180
- autoload :TopLevel, 'rdoc/top_level'
181
-
182
- autoload :AnonClass, 'rdoc/anon_class'
183
- autoload :ClassModule, 'rdoc/class_module'
184
- autoload :NormalClass, 'rdoc/normal_class'
185
- autoload :NormalModule, 'rdoc/normal_module'
186
- autoload :SingleClass, 'rdoc/single_class'
187
-
188
- autoload :Alias, 'rdoc/alias'
189
- autoload :AnyMethod, 'rdoc/any_method'
190
- autoload :MethodAttr, 'rdoc/method_attr'
191
- autoload :GhostMethod, 'rdoc/ghost_method'
192
- autoload :MetaMethod, 'rdoc/meta_method'
193
- autoload :Attr, 'rdoc/attr'
194
-
195
- autoload :Constant, 'rdoc/constant'
196
- autoload :Mixin, 'rdoc/mixin'
197
- autoload :Include, 'rdoc/include'
198
- autoload :Extend, 'rdoc/extend'
199
- autoload :Require, 'rdoc/require'
177
+ autoload :CodeObject, "#{__dir__}/rdoc/code_object"
178
+
179
+ autoload :Context, "#{__dir__}/rdoc/context"
180
+ autoload :TopLevel, "#{__dir__}/rdoc/top_level"
181
+
182
+ autoload :AnonClass, "#{__dir__}/rdoc/anon_class"
183
+ autoload :ClassModule, "#{__dir__}/rdoc/class_module"
184
+ autoload :NormalClass, "#{__dir__}/rdoc/normal_class"
185
+ autoload :NormalModule, "#{__dir__}/rdoc/normal_module"
186
+ autoload :SingleClass, "#{__dir__}/rdoc/single_class"
187
+
188
+ autoload :Alias, "#{__dir__}/rdoc/alias"
189
+ autoload :AnyMethod, "#{__dir__}/rdoc/any_method"
190
+ autoload :MethodAttr, "#{__dir__}/rdoc/method_attr"
191
+ autoload :GhostMethod, "#{__dir__}/rdoc/ghost_method"
192
+ autoload :MetaMethod, "#{__dir__}/rdoc/meta_method"
193
+ autoload :Attr, "#{__dir__}/rdoc/attr"
194
+
195
+ autoload :Constant, "#{__dir__}/rdoc/constant"
196
+ autoload :Mixin, "#{__dir__}/rdoc/mixin"
197
+ autoload :Include, "#{__dir__}/rdoc/include"
198
+ autoload :Extend, "#{__dir__}/rdoc/extend"
199
+ autoload :Require, "#{__dir__}/rdoc/require"
200
200
 
201
201
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.0
4
+ version: 6.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: exe
16
16
  cert_chain: []
17
- date: 2021-12-24 00:00:00.000000000 Z
17
+ date: 2022-12-05 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: psych
@@ -46,8 +46,8 @@ executables:
46
46
  - ri
47
47
  extensions: []
48
48
  extra_rdoc_files:
49
- - CVE-2013-0256.rdoc
50
49
  - CONTRIBUTING.rdoc
50
+ - CVE-2013-0256.rdoc
51
51
  - ExampleMarkdown.md
52
52
  - ExampleRDoc.rdoc
53
53
  - History.rdoc
@@ -61,16 +61,12 @@ files:
61
61
  - CVE-2013-0256.rdoc
62
62
  - ExampleMarkdown.md
63
63
  - ExampleRDoc.rdoc
64
- - Gemfile
65
64
  - History.rdoc
66
65
  - LEGAL.rdoc
67
66
  - LICENSE.rdoc
68
67
  - README.rdoc
69
68
  - RI.rdoc
70
- - Rakefile
71
69
  - TODO.rdoc
72
- - bin/console
73
- - bin/setup
74
70
  - exe/rdoc
75
71
  - exe/ri
76
72
  - lib/rdoc.rb
@@ -250,7 +246,6 @@ files:
250
246
  - lib/rdoc/top_level.rb
251
247
  - lib/rdoc/version.rb
252
248
  - man/ri.1
253
- - rdoc.gemspec
254
249
  homepage: https://ruby.github.io/rdoc
255
250
  licenses:
256
251
  - Ruby
@@ -272,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
267
  - !ruby/object:Gem::Version
273
268
  version: '2.2'
274
269
  requirements: []
275
- rubygems_version: 3.2.22
270
+ rubygems_version: 3.4.0.dev
276
271
  signing_key:
277
272
  specification_version: 4
278
273
  summary: RDoc produces HTML and command-line documentation for Ruby projects
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'rake'
7
- gem 'racc', '> 1.4.10'
8
- gem 'kpeg', github: 'evanphx/kpeg'
9
- gem 'test-unit'
10
- gem 'rubocop'
11
- gem 'gettext'
12
- end
data/Rakefile DELETED
@@ -1,107 +0,0 @@
1
- $:.unshift File.expand_path 'lib'
2
- require 'rdoc/task'
3
- require 'bundler/gem_tasks'
4
- require 'rake/testtask'
5
-
6
- task :docs => :generate
7
- task :test => [:normal_test, :rubygems_test]
8
-
9
- PARSER_FILES = %w[
10
- lib/rdoc/rd/block_parser.ry
11
- lib/rdoc/rd/inline_parser.ry
12
- lib/rdoc/markdown.kpeg
13
- lib/rdoc/markdown/literals.kpeg
14
- ]
15
-
16
- $rdoc_rakefile = true
17
-
18
- task :default => :test
19
-
20
- RDoc::Task.new do |doc|
21
- doc.main = 'README.rdoc'
22
- doc.title = "rdoc #{RDoc::VERSION} Documentation"
23
- doc.rdoc_dir = 'html'
24
- doc.rdoc_files = FileList.new %w[lib/**/*.rb *.rdoc] - PARSER_FILES
25
- end
26
-
27
- task ghpages: :rdoc do
28
- `git checkout gh-pages`
29
- require "fileutils"
30
- FileUtils.rm_rf "/tmp/html"
31
- FileUtils.mv "html", "/tmp"
32
- FileUtils.rm_rf "*"
33
- FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
34
- end
35
-
36
- Rake::TestTask.new(:normal_test) do |t|
37
- t.libs << "test/rdoc"
38
- t.verbose = true
39
- t.deps = :generate
40
- t.test_files = FileList["test/**/test_*.rb"].exclude("test/rdoc/test_rdoc_rubygems_hook.rb")
41
- end
42
-
43
- Rake::TestTask.new(:rubygems_test) do |t|
44
- t.libs << "test/rdoc"
45
- t.verbose = true
46
- t.deps = :generate
47
- t.pattern = "test/rdoc/test_rdoc_rubygems_hook.rb"
48
- end
49
-
50
- path = "pkg/#{Bundler::GemHelper.gemspec.full_name}"
51
-
52
- package_parser_files = PARSER_FILES.map do |parser_file|
53
- name = File.basename(parser_file, File.extname(parser_file))
54
- _path = File.dirname(parser_file)
55
- package_parser_file = "#{path}/#{name}.rb"
56
- parsed_file = "#{_path}/#{name}.rb"
57
-
58
- file package_parser_file => parsed_file # ensure copy runs before racc
59
-
60
- package_parser_file
61
- end
62
-
63
- parsed_files = PARSER_FILES.map do |parser_file|
64
- ext = File.extname(parser_file)
65
- parsed_file = "#{parser_file.chomp(ext)}.rb"
66
-
67
- file parsed_file => parser_file do |t|
68
- puts "Generating #{parsed_file}..."
69
- case ext
70
- when '.ry' # need racc
71
- racc = Gem.bin_path 'racc', 'racc'
72
- rb_file = parser_file.gsub(/\.ry\z/, ".rb")
73
- ruby "#{racc} -l -o #{rb_file} #{parser_file}"
74
- open(rb_file, 'r+') do |f|
75
- newtext = "# frozen_string_literal: true\n#{f.read}"
76
- f.rewind
77
- f.write newtext
78
- end
79
- when '.kpeg' # need kpeg
80
- kpeg = Gem.bin_path 'kpeg', 'kpeg'
81
- rb_file = parser_file.gsub(/\.kpeg\z/, ".rb")
82
- ruby "#{kpeg} -fsv -o #{rb_file} #{parser_file}"
83
- end
84
- end
85
-
86
- parsed_file
87
- end
88
-
89
- task "#{path}.gem" => package_parser_files
90
- desc "Generate all files used racc and kpeg"
91
- task :generate => parsed_files
92
-
93
- task :clean do
94
- parsed_files.each do |path|
95
- File.delete(path) if File.exist?(path)
96
- end
97
- end
98
-
99
- begin
100
- require 'rubocop/rake_task'
101
- rescue LoadError
102
- else
103
- RuboCop::RakeTask.new(:rubocop) do |t|
104
- t.options = [*parsed_files]
105
- end
106
- task :build => [:generate, "rubocop:auto_correct"]
107
- end
data/bin/console DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "rdoc"
5
-
6
- require "irb"
7
- IRB.start
data/bin/setup DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install