bitclust-core 1.2.6 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/bitclust/template.offline/class +3 -3
- data/lib/bitclust.rb +1 -0
- data/lib/bitclust/app.rb +1 -0
- data/lib/bitclust/classentry.rb +1 -0
- data/lib/bitclust/compat.rb +1 -0
- data/lib/bitclust/completion.rb +1 -0
- data/lib/bitclust/crossrubyutils.rb +1 -0
- data/lib/bitclust/database.rb +1 -0
- data/lib/bitclust/docentry.rb +1 -0
- data/lib/bitclust/entry.rb +1 -0
- data/lib/bitclust/exception.rb +1 -0
- data/lib/bitclust/functiondatabase.rb +1 -0
- data/lib/bitclust/functionentry.rb +1 -0
- data/lib/bitclust/functionreferenceparser.rb +1 -0
- data/lib/bitclust/generators/epub.rb +1 -0
- data/lib/bitclust/htmlutils.rb +1 -0
- data/lib/bitclust/interface.rb +1 -0
- data/lib/bitclust/libraryentry.rb +1 -0
- data/lib/bitclust/lineinput.rb +1 -0
- data/lib/bitclust/messagecatalog.rb +1 -0
- data/lib/bitclust/methoddatabase.rb +1 -0
- data/lib/bitclust/methodentry.rb +5 -0
- data/lib/bitclust/methodid.rb +1 -0
- data/lib/bitclust/methodsignature.rb +1 -0
- data/lib/bitclust/nameutils.rb +1 -0
- data/lib/bitclust/parseutils.rb +1 -0
- data/lib/bitclust/preprocessor.rb +4 -3
- data/lib/bitclust/progress_bar.rb +1 -0
- data/lib/bitclust/rdcompiler.rb +2 -1
- data/lib/bitclust/refsdatabase.rb +1 -0
- data/lib/bitclust/requesthandler.rb +1 -0
- data/lib/bitclust/ridatabase.rb +1 -0
- data/lib/bitclust/rrdparser.rb +1 -0
- data/lib/bitclust/runner.rb +1 -0
- data/lib/bitclust/screen.rb +1 -0
- data/lib/bitclust/searcher.rb +3 -2
- data/lib/bitclust/server.rb +6 -1
- data/lib/bitclust/silent_progress_bar.rb +1 -0
- data/lib/bitclust/simplesearcher.rb +1 -0
- data/lib/bitclust/subcommand.rb +1 -0
- data/lib/bitclust/subcommands/ancestors_command.rb +1 -0
- data/lib/bitclust/subcommands/chm_command.rb +1 -0
- data/lib/bitclust/subcommands/classes_command.rb +1 -0
- data/lib/bitclust/subcommands/epub_command.rb +1 -0
- data/lib/bitclust/subcommands/extract_command.rb +1 -0
- data/lib/bitclust/subcommands/htmlfile_command.rb +1 -0
- data/lib/bitclust/subcommands/init_command.rb +1 -0
- data/lib/bitclust/subcommands/list_command.rb +1 -0
- data/lib/bitclust/subcommands/lookup_command.rb +1 -0
- data/lib/bitclust/subcommands/methods_command.rb +1 -0
- data/lib/bitclust/subcommands/preproc_command.rb +1 -0
- data/lib/bitclust/subcommands/property_command.rb +1 -0
- data/lib/bitclust/subcommands/query_command.rb +1 -0
- data/lib/bitclust/subcommands/server_command.rb +6 -2
- data/lib/bitclust/subcommands/setup_command.rb +1 -0
- data/lib/bitclust/subcommands/statichtml_command.rb +3 -0
- data/lib/bitclust/subcommands/update_command.rb +1 -0
- data/lib/bitclust/syntax_highlighter.rb +4 -1
- data/lib/bitclust/textutils.rb +1 -0
- data/lib/bitclust/version.rb +2 -1
- data/test/test_rdcompiler.rb +31 -0
- data/test/test_searcher.rb +21 -0
- metadata +29 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31e60901f080112247e8bb929f914fdb65133ab75299a7a2c131439b51834a8b
|
4
|
+
data.tar.gz: 06cc3117a5652403207d78d42c40ee90e392a609887ffd0c2bc0dd5b77042ff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1d6c5f6848e7aabc1f6c953f81eebca321985ca76db32af3dd8d054d3d4ae801a7741d2060bc70e9756354ea2cf94d9cd2fbea938aa9b00c631816da623b837
|
7
|
+
data.tar.gz: 60c1147eb9a1b64084518fd16244ac2561236c3d3a61f5de23c437744a6955af7b3c36d83e01092f7c4700a9adce238925154653af7d2795199b0b7cc1093303
|
@@ -146,18 +146,18 @@
|
|
146
146
|
|
147
147
|
<%
|
148
148
|
_myself, *ancestors = @entry.ancestors.reject { |c| %w[Object Kernel BasicObject].include?(c.name) }
|
149
|
-
displayed_methods = Set.new(ents.instance_methods.
|
149
|
+
displayed_methods = Set.new(ents.instance_methods.flat_map(&:names))
|
150
150
|
%>
|
151
151
|
|
152
152
|
<% unless ancestors.empty? %>
|
153
153
|
<%= headline(_("Ancestor Methods")) %>
|
154
154
|
<dl>
|
155
155
|
<% ancestors.each do |c|
|
156
|
-
|
156
|
+
undefined_instance_methods = @entry.partitioned_entries.undefined.select(&:instance_method?)
|
157
157
|
methods = c.partitioned_entries(@alevel).instance_methods
|
158
158
|
.flat_map { |m| m.names.map { |n| [n, m] } }
|
159
159
|
.reject { |name,| displayed_methods.include?(name) }
|
160
|
-
.reject { |name,|
|
160
|
+
.reject { |name,| undefined_instance_methods.any? { |m| m.names.include?(name) } }
|
161
161
|
.sort
|
162
162
|
next if methods.empty? %>
|
163
163
|
<dt><%= _('Ancestor Methods %s', c.name) %></dt>
|
data/lib/bitclust.rb
CHANGED
data/lib/bitclust/app.rb
CHANGED
data/lib/bitclust/classentry.rb
CHANGED
data/lib/bitclust/compat.rb
CHANGED
data/lib/bitclust/completion.rb
CHANGED
data/lib/bitclust/database.rb
CHANGED
data/lib/bitclust/docentry.rb
CHANGED
data/lib/bitclust/entry.rb
CHANGED
data/lib/bitclust/exception.rb
CHANGED
data/lib/bitclust/htmlutils.rb
CHANGED
data/lib/bitclust/interface.rb
CHANGED
data/lib/bitclust/lineinput.rb
CHANGED
data/lib/bitclust/methodentry.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# bitclust/methodentry.rb
|
3
4
|
#
|
@@ -204,6 +205,10 @@ module BitClust
|
|
204
205
|
kind() == :redefined
|
205
206
|
end
|
206
207
|
|
208
|
+
def undefined?
|
209
|
+
kind() == :undefined
|
210
|
+
end
|
211
|
+
|
207
212
|
def description
|
208
213
|
source.split(/\n\n+/, 3)[1]
|
209
214
|
end
|
data/lib/bitclust/methodid.rb
CHANGED
data/lib/bitclust/nameutils.rb
CHANGED
data/lib/bitclust/parseutils.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# bitclust/preprocessor.rb
|
3
4
|
#
|
@@ -47,7 +48,7 @@ module BitClust
|
|
47
48
|
else
|
48
49
|
io = wrap(fopen(path, 'r:UTF-8'), params)
|
49
50
|
end
|
50
|
-
ret = ""
|
51
|
+
ret = +""
|
51
52
|
while s = io.gets
|
52
53
|
ret << s
|
53
54
|
end
|
@@ -247,13 +248,13 @@ module BitClust
|
|
247
248
|
description = description.strip
|
248
249
|
samplecode_push(description)
|
249
250
|
return unless current_cond.processing?
|
250
|
-
@buf.push("//emlist[#{description}][ruby]{\n")
|
251
|
+
@buf.push(+"//emlist[#{description}][ruby]{\n")
|
251
252
|
end
|
252
253
|
|
253
254
|
def samplecode_end
|
254
255
|
samplecode_pop
|
255
256
|
return unless current_cond.processing?
|
256
|
-
@buf.push("//}\n")
|
257
|
+
@buf.push(+"//}\n")
|
257
258
|
end
|
258
259
|
|
259
260
|
def samplecode_push(description)
|
data/lib/bitclust/rdcompiler.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# bitclust/rdcompiler.rb
|
3
4
|
#
|
@@ -271,7 +272,7 @@ module BitClust
|
|
271
272
|
line "<pre class=\"highlight #{lang}\">"
|
272
273
|
line "<span class=\"caption\">#{escape_html(caption)}</span>" if caption
|
273
274
|
line "<code>"
|
274
|
-
src = ""
|
275
|
+
src = +""
|
275
276
|
@f.until_terminator(%r<\A//\}>) do |line|
|
276
277
|
src << line
|
277
278
|
end
|
data/lib/bitclust/ridatabase.rb
CHANGED
data/lib/bitclust/rrdparser.rb
CHANGED
data/lib/bitclust/runner.rb
CHANGED
data/lib/bitclust/screen.rb
CHANGED
data/lib/bitclust/searcher.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# bitclust/searcher.rb
|
3
4
|
#
|
@@ -402,7 +403,7 @@ module BitClust
|
|
402
403
|
|
403
404
|
def print_packed_names(names)
|
404
405
|
max = terminal_column()
|
405
|
-
buf = ''
|
406
|
+
buf = +''
|
406
407
|
names.each do |name|
|
407
408
|
if buf.size + name.size + 1 > max
|
408
409
|
if buf.empty?
|
@@ -410,7 +411,7 @@ module BitClust
|
|
410
411
|
next
|
411
412
|
end
|
412
413
|
puts buf
|
413
|
-
buf = ''
|
414
|
+
buf = +''
|
414
415
|
end
|
415
416
|
buf << name << ' '
|
416
417
|
end
|
data/lib/bitclust/server.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# bitclust/server.rb
|
3
4
|
#
|
@@ -14,7 +15,6 @@ require 'bitclust/classentry'
|
|
14
15
|
require 'bitclust/methodentry'
|
15
16
|
require 'bitclust/docentry'
|
16
17
|
require 'drb'
|
17
|
-
require 'webrick/server'
|
18
18
|
|
19
19
|
module BitClust
|
20
20
|
|
@@ -26,6 +26,11 @@ module BitClust
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def listen(url, foreground = false)
|
29
|
+
begin
|
30
|
+
require 'webrick/server'
|
31
|
+
rescue LoadError
|
32
|
+
abort "webrick is not found. You may need to `gem install webrick` to install webrick."
|
33
|
+
end
|
29
34
|
WEBrick::Daemon.start unless foreground
|
30
35
|
DRb.start_service url, @db
|
31
36
|
DRb.thread.join
|
data/lib/bitclust/subcommand.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'pathname'
|
2
3
|
require 'erb'
|
3
4
|
require 'find'
|
4
5
|
require 'pp'
|
5
6
|
require 'optparse'
|
6
7
|
require 'yaml'
|
7
|
-
require 'webrick'
|
8
8
|
require 'uri'
|
9
9
|
|
10
10
|
require 'bitclust'
|
@@ -15,7 +15,6 @@ module BitClust
|
|
15
15
|
class ServerCommand < Subcommand
|
16
16
|
def initialize
|
17
17
|
super
|
18
|
-
require 'webrick'
|
19
18
|
require 'uri'
|
20
19
|
|
21
20
|
@params = {
|
@@ -117,6 +116,11 @@ module BitClust
|
|
117
116
|
end
|
118
117
|
|
119
118
|
def exec(argv, options)
|
119
|
+
begin
|
120
|
+
require 'webrick'
|
121
|
+
rescue LoadError
|
122
|
+
abort "webrick is not found. You may need to `gem install webrick` to install webrick."
|
123
|
+
end
|
120
124
|
require 'bitclust/app'
|
121
125
|
if @debugp
|
122
126
|
@params[:Logger] = WEBrick::Log.new($stderr, WEBrick::Log::DEBUG)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Copyright (c) 2006-2007 Minero Aoki
|
2
3
|
#
|
3
4
|
# This program is free software.
|
@@ -174,6 +175,8 @@ module BitClust
|
|
174
175
|
db.transaction do
|
175
176
|
methods = {}
|
176
177
|
db.methods.each_with_index do |entry, i|
|
178
|
+
next if entry.undefined?
|
179
|
+
|
177
180
|
entry.names.each do |name|
|
178
181
|
method_name = entry.klass.name + entry.typemark + name
|
179
182
|
(methods[method_name] ||= []) << entry
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "ripper"
|
2
3
|
require "bitclust/htmlutils"
|
3
4
|
|
@@ -164,6 +165,8 @@ module BitClust
|
|
164
165
|
when @stack.last == :method_call
|
165
166
|
data << "<span class=\"nf\">#{token}</span>"
|
166
167
|
@stack.pop
|
168
|
+
when @stack.last == :class
|
169
|
+
@name_buffer << token
|
167
170
|
when BUILTINS_G.include?(token)
|
168
171
|
data << "<span class=\"nb\">#{token}</span>"
|
169
172
|
else
|
@@ -365,7 +368,7 @@ module BitClust
|
|
365
368
|
end
|
366
369
|
|
367
370
|
def highlight
|
368
|
-
parse("")
|
371
|
+
parse(+"")
|
369
372
|
end
|
370
373
|
end
|
371
374
|
end
|
data/lib/bitclust/textutils.rb
CHANGED
data/lib/bitclust/version.rb
CHANGED
data/test/test_rdcompiler.rb
CHANGED
@@ -421,6 +421,37 @@ HERE
|
|
421
421
|
assert_compiled_method_source(expected, src)
|
422
422
|
end
|
423
423
|
|
424
|
+
def test_method_with_samplecode_singleton_class
|
425
|
+
src = <<'HERE'
|
426
|
+
--- singleton_method(name) -> Method
|
427
|
+
//emlist[][ruby]{
|
428
|
+
class <<obj
|
429
|
+
def foo
|
430
|
+
end
|
431
|
+
end
|
432
|
+
p Foo.singleton_method(:foo)
|
433
|
+
//}
|
434
|
+
end
|
435
|
+
HERE
|
436
|
+
expected = <<'HERE'
|
437
|
+
<dt class="method-heading" id="dummy"><code>singleton_method(name) -> Method</code><span class="permalink">[<a href="dummy/method/String/i/index">permalink</a>][<a href="https://docs.ruby-lang.org/en/2.0.0/String.html#method-i-index">rdoc</a>]</span></dt>
|
438
|
+
<dd class="method-description">
|
439
|
+
<pre class="highlight ruby">
|
440
|
+
<code>
|
441
|
+
<span class="k">class</span> <span class="o"><<</span><span class="nn"></span><span class="o"></span><span class="nc">obj</span>
|
442
|
+
<span class="k">def</span> <span class="nf">foo</span>
|
443
|
+
<span class="k">end</span>
|
444
|
+
<span class="k">end</span>
|
445
|
+
<span class="nb">p</span> <span class="no">Foo</span><span class="p">.</span><span class="nf">singleton_method</span><span class="p">(</span><span class="ss">:foo</span><span class="p">)</span>
|
446
|
+
</code></pre>
|
447
|
+
<p>
|
448
|
+
end
|
449
|
+
</p>
|
450
|
+
</dd>
|
451
|
+
HERE
|
452
|
+
assert_compiled_method_source(expected, src)
|
453
|
+
end
|
454
|
+
|
424
455
|
def test_method2
|
425
456
|
@c = BitClust::RDCompiler.new(@u, 1, {:database => @db, :force => true})
|
426
457
|
src = <<'HERE'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "bitclust"
|
3
|
+
require "bitclust/searcher"
|
4
|
+
|
5
|
+
class TestTerminalView < Test::Unit::TestCase
|
6
|
+
include BitClust
|
7
|
+
|
8
|
+
def test_show_class
|
9
|
+
view = TerminalView.new(Plain.new, {})
|
10
|
+
db = Database.dummy
|
11
|
+
foo = ClassEntry.new(db, "Foo")
|
12
|
+
bar = ClassEntry.new(db, "Bar")
|
13
|
+
out, err = capture_output do
|
14
|
+
assert_nothing_raised do
|
15
|
+
view.show_class([foo, bar])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
assert_equal %w[Bar Foo], out.split
|
19
|
+
assert_empty err
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitclust-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/rurema
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - "<"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '2.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: webrick
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
89
103
|
description: |
|
90
104
|
Rurema is a Japanese ruby documentation project, and
|
91
105
|
bitclust is a rurema document processor.
|
@@ -218,6 +232,7 @@ files:
|
|
218
232
|
- test/test_refsdatabase.rb
|
219
233
|
- test/test_rrdparser.rb
|
220
234
|
- test/test_runner.rb
|
235
|
+
- test/test_searcher.rb
|
221
236
|
- test/test_simplesearcher.rb
|
222
237
|
- test/test_syntax_highlighter.rb
|
223
238
|
- theme/default/images/external.png
|
@@ -254,24 +269,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
269
|
- !ruby/object:Gem::Version
|
255
270
|
version: '0'
|
256
271
|
requirements: []
|
257
|
-
rubygems_version: 3.1.
|
272
|
+
rubygems_version: 3.1.4
|
258
273
|
signing_key:
|
259
274
|
specification_version: 4
|
260
275
|
summary: BitClust is a rurema document processor.
|
261
276
|
test_files:
|
262
|
-
- test/test_syntax_highlighter.rb
|
263
|
-
- test/test_methodsignature.rb
|
264
|
-
- test/test_functiondatabase.rb
|
265
277
|
- test/test_preprocessor.rb
|
278
|
+
- test/test_functionreferenceparser.rb
|
279
|
+
- test/test_methoddatabase.rb
|
280
|
+
- test/test_searcher.rb
|
281
|
+
- test/test_bitclust.rb
|
266
282
|
- test/test_refsdatabase.rb
|
283
|
+
- test/test_functiondatabase.rb
|
284
|
+
- test/test_rrdparser.rb
|
285
|
+
- test/test_runner.rb
|
286
|
+
- test/test_syntax_highlighter.rb
|
287
|
+
- test/run_test.rb
|
267
288
|
- test/test_nameutils.rb
|
268
|
-
- test/test_bitclust.rb
|
269
|
-
- test/test_simplesearcher.rb
|
270
289
|
- test/test_rdcompiler.rb
|
271
290
|
- test/test_libraryentry.rb
|
272
|
-
- test/
|
273
|
-
- test/
|
274
|
-
- test/test_methoddatabase.rb
|
275
|
-
- test/test_functionreferenceparser.rb
|
276
|
-
- test/run_test.rb
|
291
|
+
- test/test_methodsignature.rb
|
292
|
+
- test/test_simplesearcher.rb
|
277
293
|
- test/test_entry.rb
|