rdoc 6.0.1.1 → 6.0.2

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec933eeb581c303748038cb9f82de18570dde50a582ac6915609294babc1104a
4
- data.tar.gz: aec53034d96ef156fa85b730d9d25802f47ed4a3e75216923005e66cea41054d
3
+ metadata.gz: 136b786cd5e93311d3c19248fb763401cad84e1c9b60f898c37d4a7aadea2cd5
4
+ data.tar.gz: d8eecce4cd75284596fb7680c58de2fe7277a4202a5b1dcef4c311906288209f
5
5
  SHA512:
6
- metadata.gz: c57a88f571a332485e19aac2c2fed33640484e4c139ce0692647cab8db296cfdc1a85cf9fccdfc1efb549f0849bdcd6715353ce1a23f4b586ccb7f0b36803bf9
7
- data.tar.gz: 1a0c790d84aca6c8813ae0054168905555c028f8acb10f47761f9b4e05d1e73ee79e7439444d69c82aca4148579be5c1e54f837a22b54a8ba62368cfe0b7ed04
6
+ metadata.gz: a87e8abc462df4ef4bf50932aba214bad8b1d0dc3d76699ecb49ef47a086e6fd6b44fa24ccb95f74313c0a2f6e0f8ac2c106a4e32b10cae7f7aa58365cb97e6b
7
+ data.tar.gz: f9f294853cf260b35482a717fb9cff10203c25fa9c31c62bf8c65f5cc0cf2fcb91d4e321ca9f4e61d50af9f999094f95eea8f47256991ca1ae0a0e7d62e984ff
@@ -1,14 +1,16 @@
1
1
  ---
2
2
  before_install:
3
- - gem install bundler --no-document
3
+ - gem update --system
4
+ - gem update bundler
4
5
  language: ruby
5
6
  rvm:
6
- - 2.2.8
7
- - 2.3.5
8
- - 2.4.2
7
+ - 2.2.9
8
+ - 2.3.6
9
+ - 2.4.3
10
+ - 2.5.0
9
11
  - ruby-head
10
- - jruby-9.1.15.0
12
+ - jruby-9.1.16.0
11
13
  env:
12
14
  global:
13
15
  NOBENCHMARK=1
14
- script: bundle exec rake
16
+ script: rake
data/Rakefile CHANGED
@@ -79,58 +79,8 @@ parsed_files = PARSER_FILES.map do |parser_file|
79
79
  end
80
80
 
81
81
  task "#{path}.gem" => package_parser_files
82
- task :check_manifest => :generate
83
82
 
84
83
  desc "Genrate all files used racc and kpeg"
85
84
  task :generate => parsed_files
86
85
 
87
- # These tasks expect to have the following directory structure:
88
- #
89
- # git/git.rubini.us/code # Rubinius git HEAD checkout
90
- # svn/ruby/trunk # ruby subversion HEAD checkout
91
- # svn/rdoc/trunk # RDoc subversion HEAD checkout
92
- #
93
- # If you don't have this directory structure, set RUBY_PATH and/or
94
- # RUBINIUS_PATH.
95
-
96
- diff_options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
97
- rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc' --exclude '*.rej' --exclude '*.orig' --exclude '*.kpeg' --exclude '*.ry' --exclude 'literals_1_8.rb' --exclude 'gauntlet_rdoc.rb'"
98
-
99
- rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
100
- ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk'
101
-
102
- desc "Updates Ruby HEAD with the currently checked-out copy of RDoc."
103
- task :update_ruby do
104
- sh "rsync #{rsync_options} bin/rdoc #{ruby_dir}/bin/rdoc"
105
- sh "rsync #{rsync_options} bin/ri #{ruby_dir}/bin/ri"
106
- sh "rsync #{rsync_options} lib/ #{ruby_dir}/lib"
107
- sh "rsync #{rsync_options} test/ #{ruby_dir}/test/rdoc"
108
- end
109
-
110
- desc "Diffs Ruby HEAD with the currently checked-out copy of RDoc."
111
- task :diff_ruby do
112
- sh "diff #{diff_options} bin/rdoc #{ruby_dir}/bin/rdoc; true"
113
- sh "diff #{diff_options} bin/ri #{ruby_dir}/bin/ri; true"
114
- sh "diff #{diff_options} lib/rdoc.rb #{ruby_dir}/lib/rdoc.rb; true"
115
- sh "diff #{diff_options} lib/rdoc #{ruby_dir}/lib/rdoc; true"
116
- sh "diff #{diff_options} test #{ruby_dir}/test/rdoc; true"
117
- end
118
-
119
- desc "Updates Rubinius HEAD with the currently checked-out copy of RDoc."
120
- task :update_rubinius do
121
- sh "rsync #{rsync_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb"
122
- sh "rsync #{rsync_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb"
123
- sh "rsync #{rsync_options} lib/ #{rubinius_dir}/lib"
124
- sh "rsync #{rsync_options} test/ #{rubinius_dir}/test/rdoc"
125
- end
126
-
127
- desc "Diffs Rubinius HEAD with the currently checked-out copy of RDoc."
128
- task :diff_rubinius do
129
- sh "diff #{diff_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb; true"
130
- sh "diff #{diff_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb; true"
131
- sh "diff #{diff_options} lib/rdoc.rb #{rubinius_dir}/lib/rdoc.rb; true"
132
- sh "diff #{diff_options} lib/rdoc #{rubinius_dir}/lib/rdoc; true"
133
- sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true"
134
- end
135
-
136
86
  task :build => [:generate]
@@ -65,7 +65,7 @@ module RDoc
65
65
  ##
66
66
  # RDoc version you are using
67
67
 
68
- VERSION = '6.0.1.1'
68
+ VERSION = '6.0.2'
69
69
 
70
70
  ##
71
71
  # Method visibilities
@@ -153,7 +153,7 @@ module RDoc
153
153
 
154
154
  autoload :Comment, 'rdoc/comment'
155
155
 
156
- autoload :I18n, 'rdoc/i18n'
156
+ require 'rdoc/i18n'
157
157
 
158
158
  # code objects
159
159
  #
@@ -407,6 +407,7 @@ class RDoc::Context < RDoc::CodeObject
407
407
  mod.section = current_section # TODO declaring context? something is
408
408
  # wrong here...
409
409
  mod.parent = self
410
+ mod.full_name = nil
410
411
  mod.store = @store
411
412
 
412
413
  unless @done_documenting then
@@ -414,6 +415,10 @@ class RDoc::Context < RDoc::CodeObject
414
415
  # this must be done AFTER adding mod to its parent, so that the full
415
416
  # name is correct:
416
417
  all_hash[mod.full_name] = mod
418
+ if @store.unmatched_constant_alias[mod.full_name] then
419
+ to, file = @store.unmatched_constant_alias[mod.full_name]
420
+ add_module_alias mod, mod.name, to, file
421
+ end
417
422
  end
418
423
 
419
424
  mod
@@ -510,41 +515,53 @@ class RDoc::Context < RDoc::CodeObject
510
515
  add_class_or_module mod, @modules, @store.modules_hash
511
516
  end
512
517
 
518
+ ##
519
+ # Adds a module by +RDoc::NormalModule+ instance. See also #add_module.
520
+
521
+ def add_module_by_normal_module(mod)
522
+ add_class_or_module mod, @modules, @store.modules_hash
523
+ end
524
+
513
525
  ##
514
526
  # Adds an alias from +from+ (a class or module) to +name+ which was defined
515
527
  # in +file+.
516
528
 
517
- def add_module_alias from, name, file
529
+ def add_module_alias from, from_name, to, file
518
530
  return from if @done_documenting
519
531
 
520
- to_name = child_name name
532
+ to_full_name = child_name to.name
521
533
 
522
534
  # if we already know this name, don't register an alias:
523
535
  # see the metaprogramming in lib/active_support/basic_object.rb,
524
536
  # where we already know BasicObject is a class when we find
525
537
  # BasicObject = BlankSlate
526
- return from if @store.find_class_or_module to_name
538
+ return from if @store.find_class_or_module to_full_name
539
+
540
+ unless from
541
+ @store.unmatched_constant_alias[child_name(from_name)] = [to, file]
542
+ return to
543
+ end
527
544
 
528
- to = from.dup
529
- to.name = name
530
- to.full_name = nil
545
+ new_to = from.dup
546
+ new_to.name = to.name
547
+ new_to.full_name = nil
531
548
 
532
- if to.module? then
533
- @store.modules_hash[to_name] = to
534
- @modules[name] = to
549
+ if new_to.module? then
550
+ @store.modules_hash[to_full_name] = new_to
551
+ @modules[to.name] = new_to
535
552
  else
536
- @store.classes_hash[to_name] = to
537
- @classes[name] = to
553
+ @store.classes_hash[to_full_name] = new_to
554
+ @classes[to.name] = new_to
538
555
  end
539
556
 
540
557
  # Registers a constant for this alias. The constant value and comment
541
558
  # will be updated later, when the Ruby parser adds the constant
542
- const = RDoc::Constant.new name, nil, to.comment
559
+ const = RDoc::Constant.new to.name, nil, new_to.comment
543
560
  const.record_location file
544
561
  const.is_alias_for = from
545
562
  add_constant const
546
563
 
547
- to
564
+ new_to
548
565
  end
549
566
 
550
567
  ##
@@ -863,7 +880,13 @@ class RDoc::Context < RDoc::CodeObject
863
880
  # Finds a method named +name+ with singleton value +singleton+.
864
881
 
865
882
  def find_method(name, singleton)
866
- @method_list.find { |m| m.name == name && m.singleton == singleton }
883
+ @method_list.find { |m|
884
+ if m.singleton
885
+ m.name == name && m.singleton == singleton
886
+ else
887
+ m.name == name && !m.singleton && !singleton
888
+ end
889
+ }
867
890
  end
868
891
 
869
892
  ##
@@ -7,6 +7,18 @@
7
7
 
8
8
  module RDoc::Encoding
9
9
 
10
+ HEADER_REGEXP = /^
11
+ (?:
12
+ \A\#!.*\n
13
+ |
14
+ ^\#\s+frozen[-_]string[-_]literal[=:].+\n
15
+ |
16
+ ^\#[^\n]+\b(?:en)?coding[=:]\s*(?<name>[^\s;]+).*\n
17
+ |
18
+ <\?xml[^?]*encoding=(?<quote>["'])(?<name>.*?)\k<quote>.*\n
19
+ )+
20
+ /xi # :nodoc:
21
+
10
22
  ##
11
23
  # Reads the contents of +filename+ and handles any encoding directives in
12
24
  # the file.
@@ -18,12 +30,13 @@ module RDoc::Encoding
18
30
  # unknown character in the target encoding will be replaced with '?'
19
31
 
20
32
  def self.read_file filename, encoding, force_transcode = false
21
- content = open filename, "rb" do |f| f.read end
33
+ content = File.open filename, "rb" do |f| f.read end
22
34
  content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
23
35
 
24
36
  utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
25
37
 
26
- content = RDoc::Encoding.set_encoding content
38
+ enc = RDoc::Encoding.detect_encoding content
39
+ content = RDoc::Encoding.change_encoding content, enc if enc
27
40
 
28
41
  begin
29
42
  encoding ||= Encoding.default_external
@@ -85,29 +98,22 @@ module RDoc::Encoding
85
98
  end
86
99
 
87
100
  ##
88
- # Sets the encoding of +string+ based on the magic comment
89
-
90
- def self.set_encoding string
91
- string = remove_frozen_string_literal string
92
-
93
- string =~ /\A(?:#!.*\n)?(.*\n)/
94
-
95
- first_line = $1
101
+ # Detects the encoding of +string+ based on the magic comment
96
102
 
97
- name = case first_line
98
- when /^<\?xml[^?]*encoding=(["'])(.*?)\1/ then $2
99
- when /\b(?:en)?coding[=:]\s*([^\s;]+)/i then $1
100
- else return string
101
- end
103
+ def self.detect_encoding string
104
+ result = HEADER_REGEXP.match string
105
+ name = result && result[:name]
102
106
 
103
- string = string.sub first_line, ''
104
-
105
- string = remove_frozen_string_literal string
107
+ name ? Encoding.find(name) : nil
108
+ end
106
109
 
107
- enc = Encoding.find name
108
- string = RDoc::Encoding.change_encoding string, enc if enc
110
+ ##
111
+ # Removes magic comments and shebang
109
112
 
110
- string
113
+ def self.remove_magic_comment string
114
+ string.sub HEADER_REGEXP do |s|
115
+ s.gsub(/[^\n]/, '')
116
+ end
111
117
  end
112
118
 
113
119
  ##
@@ -9,7 +9,7 @@ require 'erb'
9
9
  #
10
10
  # erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil
11
11
  #
12
- # open 'hello.txt', 'w' do |io|
12
+ # File.open 'hello.txt', 'w' do |io|
13
13
  # erbio.result binding
14
14
  # end
15
15
  #
@@ -147,12 +147,15 @@ class RDoc::Generator::JsonIndex
147
147
 
148
148
  JSON.dump data, io, 0
149
149
  end
150
+ unless ENV['SOURCE_DATE_EPOCH'].nil?
151
+ index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime
152
+ end
150
153
 
151
154
  Dir.chdir @template_dir do
152
155
  Dir['**/*.js'].each do |source|
153
156
  dest = File.join out_dir, source
154
157
 
155
- FileUtils.install source, dest, :mode => 0644, :verbose => $DEBUG_RDOC
158
+ FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC
156
159
  end
157
160
  end
158
161
  end
@@ -91,8 +91,8 @@ class RDoc::Generator::POT
91
91
  extractor.extract
92
92
  end
93
93
 
94
- autoload :MessageExtractor, 'rdoc/generator/pot/message_extractor'
95
- autoload :PO, 'rdoc/generator/pot/po'
96
- autoload :POEntry, 'rdoc/generator/pot/po_entry'
94
+ require 'rdoc/generator/pot/message_extractor'
95
+ require 'rdoc/generator/pot/po'
96
+ require 'rdoc/generator/pot/po_entry'
97
97
 
98
98
  end
@@ -7,11 +7,8 @@
7
7
  var index_rel_prefix = "<%= rel_prefix %>/";
8
8
  </script>
9
9
 
10
- <script src="<%= asset_rel_prefix %>/js/navigation.js" defer></script>
11
- <script src="<%= asset_rel_prefix %>/js/search.js" defer></script>
12
- <script src="<%= asset_rel_prefix %>/js/search_index.js" defer></script>
13
- <script src="<%= asset_rel_prefix %>/js/searcher.js" defer></script>
14
- <script src="<%= asset_rel_prefix %>/js/darkfish.js" defer></script>
10
+ <script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
11
+ <script src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
15
12
 
16
13
  <link href="<%= asset_rel_prefix %>/css/fonts.css" rel="stylesheet">
17
14
  <link href="<%= asset_rel_prefix %>/css/rdoc.css" rel="stylesheet">
@@ -9,8 +9,6 @@
9
9
  /* vim: ft=css et sw=2 ts=2 sts=2 */
10
10
  /* Base Green is: #6C8C22 */
11
11
 
12
- .hide { display: none !important; }
13
-
14
12
  * { padding: 0; margin: 0; }
15
13
 
16
14
  body {
@@ -50,16 +48,6 @@ h6:hover span {
50
48
  display: inline;
51
49
  }
52
50
 
53
- h1:target,
54
- h2:target,
55
- h3:target,
56
- h4:target,
57
- h5:target,
58
- h6:target {
59
- margin-left: -10px;
60
- border-left: 10px solid #f1edba;
61
- }
62
-
63
51
  :link,
64
52
  :visited {
65
53
  color: #6C8C22;
@@ -453,16 +441,7 @@ main header h3 {
453
441
  /* @group Method Details */
454
442
 
455
443
  main .method-source-code {
456
- max-height: 0;
457
- overflow: hidden;
458
- transition-duration: 200ms;
459
- transition-delay: 0ms;
460
- transition-property: all;
461
- transition-timing-function: ease-in-out;
462
- }
463
-
464
- main .method-source-code.active-menu {
465
- max-height: 100vh;
444
+ display: none;
466
445
  }
467
446
 
468
447
  main .method-description .method-calls-super {
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  /* Provide console simulation for firebug-less environments */
11
- /*
12
11
  if (!("console" in window) || !("firebug" in console)) {
13
12
  var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
14
13
  "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
@@ -17,35 +16,41 @@ if (!("console" in window) || !("firebug" in console)) {
17
16
  for (var i = 0; i < names.length; ++i)
18
17
  window.console[names[i]] = function() {};
19
18
  };
19
+
20
+
21
+ /**
22
+ * Unwrap the first element that matches the given @expr@ from the targets and return them.
20
23
  */
24
+ $.fn.unwrap = function( expr ) {
25
+ return this.each( function() {
26
+ $(this).parents( expr ).eq( 0 ).after( this ).remove();
27
+ });
28
+ };
21
29
 
22
30
 
23
31
  function showSource( e ) {
24
32
  var target = e.target;
25
- while (!target.classList.contains('method-detail')) {
26
- target = target.parentNode;
27
- }
28
- if (typeof target !== "undefined" && target !== null) {
29
- target = target.querySelector('.method-source-code');
30
- }
31
- if (typeof target !== "undefined" && target !== null) {
32
- target.classList.toggle('active-menu')
33
- }
33
+ var codeSections = $(target).
34
+ parents('.method-detail').
35
+ find('.method-source-code');
36
+
37
+ $(target).
38
+ parents('.method-detail').
39
+ find('.method-source-code').
40
+ slideToggle();
34
41
  };
35
42
 
36
43
  function hookSourceViews() {
37
- document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
- codeObject.addEventListener('click', showSource);
39
- });
44
+ $('.method-heading').click( showSource );
40
45
  };
41
46
 
42
47
  function hookSearch() {
43
- var input = document.querySelector('#search-field');
44
- var result = document.querySelector('#search-results');
45
- result.classList.remove("initially-hidden");
48
+ var input = $('#search-field').eq(0);
49
+ var result = $('#search-results').eq(0);
50
+ $(result).show();
46
51
 
47
- var search_section = document.querySelector('#search-section');
48
- search_section.classList.remove("initially-hidden");
52
+ var search_section = $('#search-section').get(0);
53
+ $(search_section).show();
49
54
 
50
55
  var search = new Search(search_data, input, result);
51
56
 
@@ -72,14 +77,85 @@ function hookSearch() {
72
77
  }
73
78
 
74
79
  search.select = function(result) {
75
- console.log(result);
76
- window.location.href = result.firstChild.firstChild.href;
80
+ var result_element = result.get(0);
81
+ window.location.href = result_element.firstChild.firstChild.href;
77
82
  }
78
83
 
79
84
  search.scrollIntoView = search.scrollInWindow;
80
85
  };
81
86
 
82
- document.addEventListener('DOMContentLoaded', function() {
87
+ function highlightTarget( anchor ) {
88
+ console.debug( "Highlighting target '%s'.", anchor );
89
+
90
+ $("a[name]").each( function() {
91
+ if ( $(this).attr("name") == anchor ) {
92
+ if ( !$(this).parent().parent().hasClass('target-section') ) {
93
+ console.debug( "Wrapping the target-section" );
94
+ $('div.method-detail').unwrap( 'div.target-section' );
95
+ $(this).parent().wrap( '<div class="target-section"></div>' );
96
+ } else {
97
+ console.debug( "Already wrapped." );
98
+ }
99
+ }
100
+ });
101
+ };
102
+
103
+ function highlightLocationTarget() {
104
+ console.debug( "Location hash: %s", window.location.hash );
105
+ if ( ! window.location.hash || window.location.hash.length == 0 ) return;
106
+
107
+ var anchor = window.location.hash.substring(1);
108
+ console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" );
109
+
110
+ highlightTarget( anchor );
111
+ };
112
+
113
+ function highlightClickTarget( event ) {
114
+ console.debug( "Highlighting click target for event %o", event.target );
115
+ try {
116
+ var anchor = $(event.target).attr( 'href' ).substring(1);
117
+ console.debug( "Found target anchor: %s", anchor );
118
+ highlightTarget( anchor );
119
+ } catch ( err ) {
120
+ console.error( "Exception while highlighting: %o", err );
121
+ };
122
+ };
123
+
124
+ function loadAsync(path, success, prefix) {
125
+ $.ajax({
126
+ url: prefix + path,
127
+ dataType: 'script',
128
+ success: success,
129
+ cache: true
130
+ });
131
+ };
132
+
133
+ $(document).ready( function() {
83
134
  hookSourceViews();
135
+ highlightLocationTarget();
136
+ $('ul.link-list a').bind( "click", highlightClickTarget );
137
+
138
+ var search_scripts_loaded = {
139
+ navigation_loaded: false,
140
+ search_loaded: false,
141
+ search_index_loaded: false,
142
+ searcher_loaded: false,
143
+ }
144
+
145
+ var search_success_function = function(variable) {
146
+ return (function (data, status, xhr) {
147
+ search_scripts_loaded[variable] = true;
148
+
149
+ if (search_scripts_loaded['navigation_loaded'] == true &&
150
+ search_scripts_loaded['search_loaded'] == true &&
151
+ search_scripts_loaded['search_index_loaded'] == true &&
152
+ search_scripts_loaded['searcher_loaded'] == true)
84
153
  hookSearch();
85
154
  });
155
+ }
156
+
157
+ loadAsync('js/navigation.js', search_success_function('navigation_loaded'), rdoc_rel_prefix);
158
+ loadAsync('js/search.js', search_success_function('search_loaded'), rdoc_rel_prefix);
159
+ loadAsync('js/search_index.js', search_success_function('search_index_loaded'), index_rel_prefix);
160
+ loadAsync('js/searcher.js', search_success_function('searcher_loaded'), rdoc_rel_prefix);
161
+ });