rdoc 5.0.0.beta1 → 5.0.0.beta2

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12e7945df27788a186bd484968a02b2199aa4058
4
- data.tar.gz: a62e96aef00f62f479aab475122d33e1c7b1fdf4
3
+ metadata.gz: d7611b4b4856c7640b0eb67a7e763fedb026fe08
4
+ data.tar.gz: c9c575242299083f619e13e9008481e8f3756060
5
5
  SHA512:
6
- metadata.gz: 9ea9a293ed18ad8dfef1ef0843549a4926d1958845009c40ae96f83a589cfe16d93a57155116496e76e787a3b77284bcb59ad1c5aad9965014027b6302ec2ecb
7
- data.tar.gz: 52858148b32546332cf5250eca62a8fbab68fc70e4292dade6e0d576b0ef27fd247277a2264071cda563184dc8f3f1b192e754087dfca056879dbf8b420745b0
6
+ metadata.gz: 1fc205f98ec74b52a0126addc2607aeecfbd23736cc20b72b05e553cd26d32c912e57d4cbfa2ac3d56c6384df9953e410e10005bf3a5e4d1889d0f819a27bd96
7
+ data.tar.gz: f58ba3bd7aea7714789abc2137c634a4e1086c80ad58a9676fbe3dff581a676f038cdd2af05f87fa6dba438ef3bc7d2527931a9a53f05bfdb1487a3183342d90
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  Gem.load_yaml
3
2
  require 'rdoc'
4
3
  require 'gauntlet'
@@ -81,4 +80,3 @@ filter = ARGV.shift
81
80
  filter = /#{filter}/ if filter
82
81
 
83
82
  RDoc::Gauntlet.new.run_the_gauntlet type, filter
84
-
@@ -65,7 +65,7 @@ module RDoc
65
65
  ##
66
66
  # RDoc version you are using
67
67
 
68
- VERSION = '5.0.0.beta1'
68
+ VERSION = '5.0.0.beta2'
69
69
 
70
70
  ##
71
71
  # Method visibilities
@@ -150,8 +150,7 @@ class RDoc::CodeObject
150
150
  else
151
151
  # HACK correct fix is to have #initialize create @comment
152
152
  # with the correct encoding
153
- if String === @comment and
154
- Object.const_defined? :Encoding and @comment.empty? then
153
+ if String === @comment and @comment.empty? then
155
154
  @comment.force_encoding comment.encoding
156
155
  end
157
156
  @comment
@@ -427,4 +426,3 @@ class RDoc::CodeObject
427
426
  end
428
427
 
429
428
  end
430
-
@@ -200,7 +200,7 @@ class RDoc::Comment
200
200
  def remove_private
201
201
  # Workaround for gsub encoding for Ruby 1.9.2 and earlier
202
202
  empty = ''
203
- empty.force_encoding @text.encoding if Object.const_defined? :Encoding
203
+ empty.force_encoding @text.encoding
204
204
 
205
205
  @text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty)
206
206
  @text = @text.sub(%r%^\s*[#*]?--.*%m, '')
@@ -227,4 +227,3 @@ class RDoc::Comment
227
227
  end
228
228
 
229
229
  end
230
-
@@ -25,43 +25,41 @@ module RDoc::Encoding
25
25
 
26
26
  RDoc::Encoding.set_encoding content
27
27
 
28
- if Object.const_defined? :Encoding then
29
- begin
30
- encoding ||= Encoding.default_external
31
- orig_encoding = content.encoding
32
-
33
- if not orig_encoding.ascii_compatible? then
34
- content.encode! encoding
35
- elsif utf8 then
36
- content.force_encoding Encoding::UTF_8
37
- content.encode! encoding
38
- else
39
- # assume the content is in our output encoding
40
- content.force_encoding encoding
41
- end
42
-
43
- unless content.valid_encoding? then
44
- # revert and try to transcode
45
- content.force_encoding orig_encoding
46
- content.encode! encoding
47
- end
48
-
49
- unless content.valid_encoding? then
50
- warn "unable to convert #{filename} to #{encoding}, skipping"
51
- content = nil
52
- end
53
- rescue Encoding::InvalidByteSequenceError,
54
- Encoding::UndefinedConversionError => e
55
- if force_transcode then
56
- content.force_encoding orig_encoding
57
- content.encode!(encoding,
58
- :invalid => :replace, :undef => :replace,
59
- :replace => '?')
60
- return content
61
- else
62
- warn "unable to convert #{e.message} for #{filename}, skipping"
63
- return nil
64
- end
28
+ begin
29
+ encoding ||= Encoding.default_external
30
+ orig_encoding = content.encoding
31
+
32
+ if not orig_encoding.ascii_compatible? then
33
+ content.encode! encoding
34
+ elsif utf8 then
35
+ content.force_encoding Encoding::UTF_8
36
+ content.encode! encoding
37
+ else
38
+ # assume the content is in our output encoding
39
+ content.force_encoding encoding
40
+ end
41
+
42
+ unless content.valid_encoding? then
43
+ # revert and try to transcode
44
+ content.force_encoding orig_encoding
45
+ content.encode! encoding
46
+ end
47
+
48
+ unless content.valid_encoding? then
49
+ warn "unable to convert #{filename} to #{encoding}, skipping"
50
+ content = nil
51
+ end
52
+ rescue Encoding::InvalidByteSequenceError,
53
+ Encoding::UndefinedConversionError => e
54
+ if force_transcode then
55
+ content.force_encoding orig_encoding
56
+ content.encode!(encoding,
57
+ :invalid => :replace, :undef => :replace,
58
+ :replace => '?')
59
+ return content
60
+ else
61
+ warn "unable to convert #{e.message} for #{filename}, skipping"
62
+ return nil
65
63
  end
66
64
  end
67
65
 
@@ -103,11 +101,8 @@ module RDoc::Encoding
103
101
 
104
102
  remove_frozen_string_literal string
105
103
 
106
- return unless Object.const_defined? :Encoding
107
-
108
104
  enc = Encoding.find name
109
105
  string.force_encoding enc if enc
110
106
  end
111
107
 
112
108
  end
113
-
@@ -698,7 +698,7 @@ class RDoc::Generator::Darkfish
698
698
 
699
699
  out_file.dirname.mkpath
700
700
  out_file.open 'w', 0644 do |io|
701
- io.set_encoding @options.encoding if Object.const_defined? :Encoding
701
+ io.set_encoding @options.encoding
702
702
 
703
703
  @context = yield io
704
704
 
@@ -744,8 +744,7 @@ class RDoc::Generator::Darkfish
744
744
  erbout = 'io'
745
745
  else
746
746
  template = file.read
747
- template = template.encode @options.encoding if
748
- Object.const_defined? :Encoding
747
+ template = template.encode @options.encoding
749
748
 
750
749
  file_var = File.basename(file).sub(/\..*/, '')
751
750
 
@@ -758,4 +757,3 @@ class RDoc::Generator::Darkfish
758
757
  end
759
758
 
760
759
  end
761
-
@@ -142,7 +142,7 @@ class RDoc::Generator::JsonIndex
142
142
  FileUtils.mkdir_p index_file.dirname, :verbose => $DEBUG_RDOC
143
143
 
144
144
  index_file.open 'w', 0644 do |io|
145
- io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
145
+ io.set_encoding Encoding::UTF_8
146
146
  io.write 'var search_data = '
147
147
 
148
148
  JSON.dump data, io, 0
@@ -295,4 +295,3 @@ class RDoc::Generator::JsonIndex
295
295
  end
296
296
 
297
297
  end
298
-
@@ -174,7 +174,6 @@
174
174
 
175
175
  %% {
176
176
 
177
- require 'rubygems'
178
177
  require 'rdoc'
179
178
  require 'rdoc/markup/to_joined_paragraph'
180
179
  require 'rdoc/markdown/entities'
@@ -79,8 +79,6 @@ class RDoc::Markup::Parser
79
79
  @binary_input = nil
80
80
  @current_token = nil
81
81
  @debug = false
82
- @have_encoding = Object.const_defined? :Encoding
83
- @have_byteslice = ''.respond_to? :byteslice
84
82
  @input = nil
85
83
  @input_encoding = nil
86
84
  @line = 0
@@ -324,15 +322,7 @@ class RDoc::Markup::Parser
324
322
  # The character offset for the input string at the given +byte_offset+
325
323
 
326
324
  def char_pos byte_offset
327
- if @have_byteslice then
328
- @input.byteslice(0, byte_offset).length
329
- elsif @have_encoding then
330
- matched = @binary_input[0, byte_offset]
331
- matched.force_encoding @input_encoding
332
- matched.length
333
- else
334
- byte_offset
335
- end
325
+ @input.byteslice(0, byte_offset).length
336
326
  end
337
327
 
338
328
  ##
@@ -430,11 +420,6 @@ class RDoc::Markup::Parser
430
420
  @line_pos = 0
431
421
  @input = input.dup
432
422
 
433
- if @have_encoding and not @have_byteslice then
434
- @input_encoding = @input.encoding
435
- @binary_input = @input.force_encoding Encoding::BINARY
436
- end
437
-
438
423
  @s = StringScanner.new input
439
424
  end
440
425
 
@@ -556,4 +541,3 @@ class RDoc::Markup::Parser
556
541
  end
557
542
 
558
543
  end
559
-
@@ -379,23 +379,15 @@ class RDoc::Options
379
379
  @visibility = :protected
380
380
  @webcvs = nil
381
381
  @write_options = false
382
-
383
- if Object.const_defined? :Encoding then
384
- @encoding = Encoding::UTF_8
385
- @charset = @encoding.name
386
- else
387
- @encoding = nil
388
- @charset = 'UTF-8'
389
- end
382
+ @encoding = Encoding::UTF_8
383
+ @charset = @encoding.name
390
384
  end
391
385
 
392
386
  def init_with map # :nodoc:
393
387
  init_ivars
394
388
 
395
389
  encoding = map['encoding']
396
- @encoding = if Object.const_defined? :Encoding then
397
- encoding ? Encoding.find(encoding) : encoding
398
- end
390
+ @encoding = encoding ? Encoding.find(encoding) : encoding
399
391
 
400
392
  @charset = map['charset']
401
393
  @exclude = map['exclude']
@@ -689,19 +681,16 @@ Usage: #{opt.program_name} [options] [names...]
689
681
  opt.separator "Parsing options:"
690
682
  opt.separator nil
691
683
 
692
- if Object.const_defined? :Encoding then
693
- opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
694
- "Specifies the output encoding. All files",
695
- "read will be converted to this encoding.",
696
- "The default encoding is UTF-8.",
697
- "--encoding is preferred over --charset") do |value|
698
- @encoding = Encoding.find value
699
- @charset = @encoding.name # may not be valid value
700
- end
701
-
702
- opt.separator nil
703
- end
684
+ opt.on("--encoding=ENCODING", "-e", Encoding.list.map { |e| e.name },
685
+ "Specifies the output encoding. All files",
686
+ "read will be converted to this encoding.",
687
+ "The default encoding is UTF-8.",
688
+ "--encoding is preferred over --charset") do |value|
689
+ @encoding = Encoding.find value
690
+ @charset = @encoding.name # may not be valid value
691
+ end
704
692
 
693
+ opt.separator nil
705
694
 
706
695
  opt.on("--locale=NAME",
707
696
  "Specifies the output locale.") do |value|
@@ -1242,11 +1231,10 @@ Usage: #{opt.program_name} [options] [names...]
1242
1231
  RDoc.load_yaml
1243
1232
 
1244
1233
  open '.rdoc_options', 'w' do |io|
1245
- io.set_encoding Encoding::UTF_8 if Object.const_defined? :Encoding
1234
+ io.set_encoding Encoding::UTF_8
1246
1235
 
1247
1236
  YAML.dump self, io
1248
1237
  end
1249
1238
  end
1250
1239
 
1251
1240
  end
1252
-
@@ -170,9 +170,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
170
170
  @prev_seek = nil
171
171
  @markup = @options.markup
172
172
  @track_visibility = :nodoc != @options.visibility
173
-
174
- @encoding = nil
175
- @encoding = @options.encoding if Object.const_defined? :Encoding
173
+ @encoding = @options.encoding
176
174
 
177
175
  reset
178
176
  end
@@ -2158,4 +2156,3 @@ class RDoc::Parser::Ruby < RDoc::Parser
2158
2156
  end
2159
2157
 
2160
2158
  end
2161
-
@@ -52,11 +52,10 @@ class RDoc::Parser::Simple < RDoc::Parser
52
52
  def remove_private_comment comment
53
53
  # Workaround for gsub encoding for Ruby 1.9.2 and earlier
54
54
  empty = ''
55
- empty.force_encoding comment.encoding if Object.const_defined? :Encoding
55
+ empty.force_encoding comment.encoding
56
56
 
57
57
  comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty)
58
58
  comment.sub(%r%^--\n.*%m, empty)
59
59
  end
60
60
 
61
61
  end
62
-
@@ -340,10 +340,8 @@ option)
340
340
  # Parses +filename+ and returns an RDoc::TopLevel
341
341
 
342
342
  def parse_file filename
343
- if Object.const_defined? :Encoding then
344
- encoding = @options.encoding
345
- filename = filename.encode encoding
346
- end
343
+ encoding = @options.encoding
344
+ filename = filename.encode encoding
347
345
 
348
346
  @stats.add_file filename
349
347
 
@@ -551,18 +549,14 @@ The internal error was:
551
549
  end
552
550
 
553
551
  begin
554
- require 'rubygems'
555
-
556
- if Gem.respond_to? :find_files then
557
- rdoc_extensions = Gem.find_files 'rdoc/discover'
552
+ rdoc_extensions = Gem.find_files 'rdoc/discover'
558
553
 
559
- rdoc_extensions.each do |extension|
560
- begin
561
- load extension
562
- rescue => e
563
- warn "error loading #{extension.inspect}: #{e.message} (#{e.class})"
564
- warn "\t#{e.backtrace.join "\n\t"}" if $DEBUG
565
- end
554
+ rdoc_extensions.each do |extension|
555
+ begin
556
+ load extension
557
+ rescue => e
558
+ warn "error loading #{extension.inspect}: #{e.message} (#{e.class})"
559
+ warn "\t#{e.backtrace.join "\n\t"}" if $DEBUG
566
560
  end
567
561
  end
568
562
  rescue LoadError
@@ -572,4 +566,3 @@ end
572
566
  require 'rdoc/generator/darkfish'
573
567
  require 'rdoc/generator/ri'
574
568
  require 'rdoc/generator/pot'
575
-
@@ -908,7 +908,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
908
908
 
909
909
  def expand_class klass
910
910
  ary = classes.keys.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
911
- raise NotFoundError, klass if ary.length != 1
911
+ raise NotFoundError, klass if ary.length != 1 && ary.first != klass
912
912
  ary.first
913
913
  end
914
914
 
@@ -1480,4 +1480,3 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
1480
1480
  end
1481
1481
 
1482
1482
  end
1483
-
@@ -82,8 +82,6 @@ module RDoc::RI::Paths
82
82
  # ri documentation.
83
83
 
84
84
  def self.gemdirs filter = :latest
85
- require 'rubygems' unless defined?(Gem)
86
-
87
85
  ri_paths = {}
88
86
 
89
87
  all = Gem::Specification.map do |spec|
@@ -185,4 +183,3 @@ module RDoc::RI::Paths
185
183
  end
186
184
 
187
185
  end
188
-
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: false
2
- require 'rubygems'
3
2
  begin
4
3
  gem 'rdoc'
5
4
  rescue Gem::LoadError
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: false
2
- require 'rubygems'
3
2
  require 'rubygems/user_interaction'
4
3
  require 'fileutils'
5
4
  require 'rdoc'
@@ -251,4 +250,3 @@ class RDoc::RubygemsHook
251
250
  end
252
251
 
253
252
  end
254
-
@@ -22,7 +22,6 @@
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
  #++
24
24
 
25
- require 'rubygems'
26
25
  begin
27
26
  gem 'rdoc'
28
27
  rescue Gem::LoadError
@@ -328,4 +327,3 @@ module Rake
328
327
 
329
328
  end
330
329
  # :startdoc:
331
-
@@ -1,6 +1,4 @@
1
1
  # frozen_string_literal: false
2
- require 'rubygems'
3
-
4
2
  begin
5
3
  gem 'minitest', '~> 4.0' unless defined?(Test::Unit)
6
4
  rescue NoMethodError, Gem::LoadError
@@ -41,8 +39,6 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
41
39
 
42
40
  @top_level = nil
43
41
 
44
- @have_encoding = Object.const_defined? :Encoding
45
-
46
42
  @RM = RDoc::Markup
47
43
 
48
44
  RDoc::Markup::PreProcess.reset
@@ -52,7 +52,7 @@ module RDoc::Text
52
52
  :open_squote => encode_fallback('‘', encoding, '\''),
53
53
  :trademark => encode_fallback('®', encoding, '(r)'),
54
54
  }
55
- end if Object.const_defined? :Encoding
55
+ end
56
56
 
57
57
  ##
58
58
  # Transcodes +character+ to +encoding+ with a +fallback+ character.
@@ -71,7 +71,7 @@ module RDoc::Text
71
71
  text.each_line do |line|
72
72
  nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do
73
73
  r = "#{$1}#{$2}#{' ' * (8 - $2.size)}"
74
- r.force_encoding text.encoding if Object.const_defined? :Encoding
74
+ r.force_encoding text.encoding
75
75
  r
76
76
  end
77
77
 
@@ -93,7 +93,7 @@ module RDoc::Text
93
93
  end
94
94
 
95
95
  empty = ''
96
- empty.force_encoding text.encoding if Object.const_defined? :Encoding
96
+ empty.force_encoding text.encoding
97
97
 
98
98
  text.gsub(/^ {0,#{indent}}/, empty)
99
99
  end
@@ -160,7 +160,7 @@ module RDoc::Text
160
160
  return text if text =~ /^(?>\s*)[^\#]/
161
161
 
162
162
  empty = ''
163
- empty.force_encoding text.encoding if Object.const_defined? :Encoding
163
+ empty.force_encoding text.encoding
164
164
 
165
165
  text.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\s+$/, empty)
166
166
  end
@@ -178,7 +178,7 @@ module RDoc::Text
178
178
  def strip_stars text
179
179
  return text unless text =~ %r%/\*.*\*/%m
180
180
 
181
- encoding = text.encoding if Object.const_defined? :Encoding
181
+ encoding = text.encoding
182
182
 
183
183
  text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, ''
184
184
 
@@ -199,24 +199,9 @@ module RDoc::Text
199
199
  # trademark symbols in +text+ to properly encoded characters.
200
200
 
201
201
  def to_html text
202
- if Object.const_defined? :Encoding then
203
- html = ''.encode text.encoding
202
+ html = ''.encode text.encoding
204
203
 
205
- encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
206
- else
207
- html = ''
208
- encoded = {
209
- :close_dquote => '”',
210
- :close_squote => '’',
211
- :copyright => '©',
212
- :ellipsis => '…',
213
- :em_dash => '—',
214
- :en_dash => '–',
215
- :open_dquote => '“',
216
- :open_squote => '‘',
217
- :trademark => '®',
218
- }
219
- end
204
+ encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
220
205
 
221
206
  s = StringScanner.new text
222
207
  insquotes = false
@@ -6,8 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "rdoc"
7
7
  s.version = RDoc::VERSION
8
8
 
9
- s.required_rubygems_version = Gem::Requirement.new(">= 1.3") if
10
- s.respond_to? :required_rubygems_version=
9
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3")
11
10
 
12
11
  s.require_paths = ["lib"]
13
12
  s.authors = [
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: 5.0.0.beta1
4
+ version: 5.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel