voloko-sdoc 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/VERSION.yml +4 -0
- data/lib/sdoc/generator/shtml.rb +1 -4
- data/lib/sdoc.rb +0 -1
- metadata +32 -101
- data/rdoc/History.txt +0 -254
- data/rdoc/Manifest.txt +0 -126
- data/rdoc/README.txt +0 -47
- data/rdoc/RI.txt +0 -58
- data/rdoc/Rakefile +0 -70
- data/rdoc/bin/rdoc +0 -35
- data/rdoc/bin/ri +0 -5
- data/rdoc/lib/rdoc/alias.rb +0 -54
- data/rdoc/lib/rdoc/anon_class.rb +0 -10
- data/rdoc/lib/rdoc/any_method.rb +0 -190
- data/rdoc/lib/rdoc/attr.rb +0 -79
- data/rdoc/lib/rdoc/cache.rb +0 -41
- data/rdoc/lib/rdoc/class_module.rb +0 -87
- data/rdoc/lib/rdoc/code_object.rb +0 -152
- data/rdoc/lib/rdoc/code_objects.rb +0 -23
- data/rdoc/lib/rdoc/constant.rb +0 -36
- data/rdoc/lib/rdoc/context.rb +0 -712
- data/rdoc/lib/rdoc/diagram.rb +0 -340
- data/rdoc/lib/rdoc/dot.rb +0 -249
- data/rdoc/lib/rdoc/generator/darkfish.rb +0 -455
- data/rdoc/lib/rdoc/generator/markup.rb +0 -194
- data/rdoc/lib/rdoc/generator/ri.rb +0 -230
- data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -281
- data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -112
- data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
- data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +0 -64
- data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -116
- data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +0 -32
- data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
- data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
- data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +0 -696
- data/rdoc/lib/rdoc/generator.rb +0 -8
- data/rdoc/lib/rdoc/ghost_method.rb +0 -8
- data/rdoc/lib/rdoc/include.rb +0 -39
- data/rdoc/lib/rdoc/known_classes.rb +0 -68
- data/rdoc/lib/rdoc/markup/attribute_manager.rb +0 -311
- data/rdoc/lib/rdoc/markup/formatter.rb +0 -25
- data/rdoc/lib/rdoc/markup/fragments.rb +0 -377
- data/rdoc/lib/rdoc/markup/inline.rb +0 -126
- data/rdoc/lib/rdoc/markup/lines.rb +0 -156
- data/rdoc/lib/rdoc/markup/preprocess.rb +0 -80
- data/rdoc/lib/rdoc/markup/to_flow.rb +0 -211
- data/rdoc/lib/rdoc/markup/to_html.rb +0 -406
- data/rdoc/lib/rdoc/markup/to_html_crossref.rb +0 -140
- data/rdoc/lib/rdoc/markup/to_latex.rb +0 -328
- data/rdoc/lib/rdoc/markup/to_test.rb +0 -53
- data/rdoc/lib/rdoc/markup/to_texinfo.rb +0 -73
- data/rdoc/lib/rdoc/markup.rb +0 -378
- data/rdoc/lib/rdoc/meta_method.rb +0 -8
- data/rdoc/lib/rdoc/normal_class.rb +0 -18
- data/rdoc/lib/rdoc/normal_module.rb +0 -34
- data/rdoc/lib/rdoc/options.rb +0 -542
- data/rdoc/lib/rdoc/parser/c.rb +0 -678
- data/rdoc/lib/rdoc/parser/perl.rb +0 -165
- data/rdoc/lib/rdoc/parser/ruby.rb +0 -2904
- data/rdoc/lib/rdoc/parser/simple.rb +0 -39
- data/rdoc/lib/rdoc/parser.rb +0 -138
- data/rdoc/lib/rdoc/rdoc.rb +0 -375
- data/rdoc/lib/rdoc/require.rb +0 -32
- data/rdoc/lib/rdoc/ri/cache.rb +0 -187
- data/rdoc/lib/rdoc/ri/descriptions.rb +0 -156
- data/rdoc/lib/rdoc/ri/display.rb +0 -340
- data/rdoc/lib/rdoc/ri/driver.rb +0 -828
- data/rdoc/lib/rdoc/ri/formatter.rb +0 -654
- data/rdoc/lib/rdoc/ri/paths.rb +0 -93
- data/rdoc/lib/rdoc/ri/reader.rb +0 -106
- data/rdoc/lib/rdoc/ri/util.rb +0 -79
- data/rdoc/lib/rdoc/ri/writer.rb +0 -68
- data/rdoc/lib/rdoc/ri.rb +0 -8
- data/rdoc/lib/rdoc/single_class.rb +0 -8
- data/rdoc/lib/rdoc/stats.rb +0 -178
- data/rdoc/lib/rdoc/task.rb +0 -276
- data/rdoc/lib/rdoc/tokenstream.rb +0 -33
- data/rdoc/lib/rdoc/top_level.rb +0 -242
- data/rdoc/lib/rdoc.rb +0 -398
data/rdoc/lib/rdoc/ri/paths.rb
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
require 'rdoc/ri'
|
2
|
-
|
3
|
-
##
|
4
|
-
# Encapsulate all the strangeness to do with finding out where to find RDoc
|
5
|
-
# files
|
6
|
-
#
|
7
|
-
# We basically deal with three directories:
|
8
|
-
#
|
9
|
-
# 1. The 'system' documentation directory, which holds the documentation
|
10
|
-
# distributed with Ruby, and which is managed by the Ruby install process
|
11
|
-
# 2. The 'site' directory, which contains site-wide documentation added
|
12
|
-
# locally.
|
13
|
-
# 3. The 'user' documentation directory, stored under the user's own home
|
14
|
-
# directory.
|
15
|
-
#
|
16
|
-
# There's contention about all this, but for now:
|
17
|
-
#
|
18
|
-
# system:: $datadir/ri/<ver>/system/...
|
19
|
-
# site:: $datadir/ri/<ver>/site/...
|
20
|
-
# user:: ~/.rdoc
|
21
|
-
|
22
|
-
module RDoc::RI::Paths
|
23
|
-
|
24
|
-
#:stopdoc:
|
25
|
-
require 'rbconfig'
|
26
|
-
|
27
|
-
DOC_DIR = "doc/rdoc"
|
28
|
-
|
29
|
-
VERSION = RbConfig::CONFIG['ruby_version']
|
30
|
-
|
31
|
-
base = File.join(RbConfig::CONFIG['datadir'], "ri", VERSION)
|
32
|
-
SYSDIR = File.join(base, "system")
|
33
|
-
SITEDIR = File.join(base, "site")
|
34
|
-
homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH']
|
35
|
-
|
36
|
-
if homedir then
|
37
|
-
HOMEDIR = File.join(homedir, ".rdoc")
|
38
|
-
else
|
39
|
-
HOMEDIR = nil
|
40
|
-
end
|
41
|
-
|
42
|
-
begin
|
43
|
-
require 'rubygems' unless defined?(Gem) and defined?(Gem::Enable) and
|
44
|
-
Gem::Enable
|
45
|
-
|
46
|
-
# HACK dup'd from Gem.latest_partials and friends
|
47
|
-
all_paths = []
|
48
|
-
|
49
|
-
all_paths = Gem.path.map do |dir|
|
50
|
-
Dir[File.join(dir, 'doc', '*', 'ri')]
|
51
|
-
end.flatten
|
52
|
-
|
53
|
-
ri_paths = {}
|
54
|
-
|
55
|
-
all_paths.each do |dir|
|
56
|
-
base = File.basename File.dirname(dir)
|
57
|
-
if base =~ /(.*)-((\d+\.)*\d+)/ then
|
58
|
-
name, version = $1, $2
|
59
|
-
ver = Gem::Version.new version
|
60
|
-
if ri_paths[name].nil? or ver > ri_paths[name][0] then
|
61
|
-
ri_paths[name] = [ver, dir]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
GEMDIRS = ri_paths.map { |k,v| v.last }.sort
|
67
|
-
rescue LoadError
|
68
|
-
GEMDIRS = []
|
69
|
-
end
|
70
|
-
|
71
|
-
# Returns the selected documentation directories as an Array, or PATH if no
|
72
|
-
# overriding directories were given.
|
73
|
-
|
74
|
-
def self.path(use_system, use_site, use_home, use_gems, *extra_dirs)
|
75
|
-
path = raw_path(use_system, use_site, use_home, use_gems, *extra_dirs)
|
76
|
-
return path.select { |directory| File.directory? directory }
|
77
|
-
end
|
78
|
-
|
79
|
-
# Returns the selected documentation directories including nonexistent
|
80
|
-
# directories. Used to print out what paths were searched if no ri was
|
81
|
-
# found.
|
82
|
-
|
83
|
-
def self.raw_path(use_system, use_site, use_home, use_gems, *extra_dirs)
|
84
|
-
path = []
|
85
|
-
path << extra_dirs unless extra_dirs.empty?
|
86
|
-
path << SYSDIR if use_system
|
87
|
-
path << SITEDIR if use_site
|
88
|
-
path << HOMEDIR if use_home
|
89
|
-
path << GEMDIRS if use_gems
|
90
|
-
|
91
|
-
return path.flatten.compact
|
92
|
-
end
|
93
|
-
end
|
data/rdoc/lib/rdoc/ri/reader.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
require 'rdoc/ri'
|
2
|
-
require 'rdoc/ri/descriptions'
|
3
|
-
require 'rdoc/ri/writer'
|
4
|
-
require 'rdoc/markup/to_flow'
|
5
|
-
|
6
|
-
class RDoc::RI::Reader
|
7
|
-
|
8
|
-
def initialize(ri_cache)
|
9
|
-
@cache = ri_cache
|
10
|
-
end
|
11
|
-
|
12
|
-
def top_level_namespace
|
13
|
-
[ @cache.toplevel ]
|
14
|
-
end
|
15
|
-
|
16
|
-
def lookup_namespace_in(target, namespaces)
|
17
|
-
result = []
|
18
|
-
for n in namespaces
|
19
|
-
result.concat(n.contained_modules_matching(target))
|
20
|
-
end
|
21
|
-
result
|
22
|
-
end
|
23
|
-
|
24
|
-
def find_class_by_name(full_name)
|
25
|
-
names = full_name.split(/::/)
|
26
|
-
ns = @cache.toplevel
|
27
|
-
for name in names
|
28
|
-
ns = ns.contained_class_named(name)
|
29
|
-
return nil if ns.nil?
|
30
|
-
end
|
31
|
-
get_class(ns)
|
32
|
-
end
|
33
|
-
|
34
|
-
def find_methods(name, is_class_method, namespaces)
|
35
|
-
result = []
|
36
|
-
namespaces.each do |ns|
|
37
|
-
result.concat ns.methods_matching(name, is_class_method)
|
38
|
-
end
|
39
|
-
result
|
40
|
-
end
|
41
|
-
|
42
|
-
##
|
43
|
-
# Return the MethodDescription for a given MethodEntry by deserializing the
|
44
|
-
# YAML
|
45
|
-
|
46
|
-
def get_method(method_entry)
|
47
|
-
path = method_entry.path_name
|
48
|
-
File.open(path) { |f| RDoc::RI::Description.deserialize(f) }
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# Return a class description
|
53
|
-
|
54
|
-
def get_class(class_entry)
|
55
|
-
result = nil
|
56
|
-
for path in class_entry.path_names
|
57
|
-
path = RDoc::RI::Writer.class_desc_path(path, class_entry)
|
58
|
-
desc = File.open(path) {|f| RDoc::RI::Description.deserialize(f) }
|
59
|
-
if result
|
60
|
-
result.merge_in(desc)
|
61
|
-
else
|
62
|
-
result = desc
|
63
|
-
end
|
64
|
-
end
|
65
|
-
result
|
66
|
-
end
|
67
|
-
|
68
|
-
##
|
69
|
-
# Return the names of all classes and modules
|
70
|
-
|
71
|
-
def full_class_names
|
72
|
-
res = []
|
73
|
-
find_classes_in(res, @cache.toplevel)
|
74
|
-
end
|
75
|
-
|
76
|
-
##
|
77
|
-
# Return a list of all classes, modules, and methods
|
78
|
-
|
79
|
-
def all_names
|
80
|
-
res = []
|
81
|
-
find_names_in(res, @cache.toplevel)
|
82
|
-
end
|
83
|
-
|
84
|
-
private
|
85
|
-
|
86
|
-
def find_classes_in(res, klass)
|
87
|
-
classes = klass.classes_and_modules
|
88
|
-
for c in classes
|
89
|
-
res << c.full_name
|
90
|
-
find_classes_in(res, c)
|
91
|
-
end
|
92
|
-
res
|
93
|
-
end
|
94
|
-
|
95
|
-
def find_names_in(res, klass)
|
96
|
-
classes = klass.classes_and_modules
|
97
|
-
for c in classes
|
98
|
-
res << c.full_name
|
99
|
-
res.concat c.all_method_names
|
100
|
-
find_names_in(res, c)
|
101
|
-
end
|
102
|
-
res
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
|
data/rdoc/lib/rdoc/ri/util.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'rdoc/ri'
|
2
|
-
|
3
|
-
##
|
4
|
-
# Break argument into its constituent class or module names, an
|
5
|
-
# optional method type, and a method name
|
6
|
-
|
7
|
-
class RDoc::RI::NameDescriptor
|
8
|
-
|
9
|
-
attr_reader :class_names
|
10
|
-
attr_reader :method_name
|
11
|
-
|
12
|
-
##
|
13
|
-
# true and false have the obvious meaning. nil means we don't care
|
14
|
-
|
15
|
-
attr_reader :is_class_method
|
16
|
-
|
17
|
-
##
|
18
|
-
# +arg+ may be
|
19
|
-
#
|
20
|
-
# 1. A class or module name (optionally qualified with other class or module
|
21
|
-
# names (Kernel, File::Stat etc)
|
22
|
-
# 2. A method name
|
23
|
-
# 3. A method name qualified by a optionally fully qualified class or module
|
24
|
-
# name
|
25
|
-
#
|
26
|
-
# We're fairly casual about delimiters: folks can say Kernel::puts,
|
27
|
-
# Kernel.puts, or Kernel\#puts for example. There's one exception: if you
|
28
|
-
# say IO::read, we look for a class method, but if you say IO.read, we look
|
29
|
-
# for an instance method
|
30
|
-
|
31
|
-
def initialize(arg)
|
32
|
-
@class_names = []
|
33
|
-
separator = nil
|
34
|
-
|
35
|
-
tokens = arg.split(/(\.|::|#)/)
|
36
|
-
|
37
|
-
# Skip leading '::', '#' or '.', but remember it might
|
38
|
-
# be a method name qualifier
|
39
|
-
separator = tokens.shift if tokens[0] =~ /^(\.|::|#)/
|
40
|
-
|
41
|
-
# Skip leading '::', but remember we potentially have an inst
|
42
|
-
|
43
|
-
# leading stuff must be class names
|
44
|
-
|
45
|
-
while tokens[0] =~ /^[A-Z]/
|
46
|
-
@class_names << tokens.shift
|
47
|
-
unless tokens.empty?
|
48
|
-
separator = tokens.shift
|
49
|
-
break unless separator == "::"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# Now must have a single token, the method name, or an empty array
|
54
|
-
unless tokens.empty?
|
55
|
-
@method_name = tokens.shift
|
56
|
-
# We may now have a trailing !, ?, or = to roll into
|
57
|
-
# the method name
|
58
|
-
if !tokens.empty? && tokens[0] =~ /^[!?=]$/
|
59
|
-
@method_name << tokens.shift
|
60
|
-
end
|
61
|
-
|
62
|
-
if @method_name =~ /::|\.|#/ or !tokens.empty?
|
63
|
-
raise RDoc::RI::Error.new("Bad argument: #{arg}")
|
64
|
-
end
|
65
|
-
if separator && separator != '.'
|
66
|
-
@is_class_method = separator == "::"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
# Return the full class name (with '::' between the components) or "" if
|
72
|
-
# there's no class name
|
73
|
-
|
74
|
-
def full_class_name
|
75
|
-
@class_names.join("::")
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
|
data/rdoc/lib/rdoc/ri/writer.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'rdoc/ri'
|
3
|
-
|
4
|
-
class RDoc::RI::Writer
|
5
|
-
|
6
|
-
def self.class_desc_path(dir, class_desc)
|
7
|
-
File.join(dir, "cdesc-" + class_desc.name + ".yaml")
|
8
|
-
end
|
9
|
-
|
10
|
-
##
|
11
|
-
# Convert a name from internal form (containing punctuation) to an external
|
12
|
-
# form (where punctuation is replaced by %xx)
|
13
|
-
|
14
|
-
def self.internal_to_external(name)
|
15
|
-
if ''.respond_to? :ord then
|
16
|
-
name.gsub(/\W/) { "%%%02x" % $&[0].ord }
|
17
|
-
else
|
18
|
-
name.gsub(/\W/) { "%%%02x" % $&[0] }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
##
|
23
|
-
# And the reverse operation
|
24
|
-
|
25
|
-
def self.external_to_internal(name)
|
26
|
-
name.gsub(/%([0-9a-f]{2,2})/) { $1.to_i(16).chr }
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize(base_dir)
|
30
|
-
@base_dir = base_dir
|
31
|
-
end
|
32
|
-
|
33
|
-
def remove_class(class_desc)
|
34
|
-
FileUtils.rm_rf(path_to_dir(class_desc.full_name))
|
35
|
-
end
|
36
|
-
|
37
|
-
def add_class(class_desc)
|
38
|
-
dir = path_to_dir(class_desc.full_name)
|
39
|
-
FileUtils.mkdir_p(dir)
|
40
|
-
class_file_name = self.class.class_desc_path(dir, class_desc)
|
41
|
-
File.open(class_file_name, "w") do |f|
|
42
|
-
f.write(class_desc.serialize)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def add_method(class_desc, method_desc)
|
47
|
-
dir = path_to_dir(class_desc.full_name)
|
48
|
-
file_name = self.class.internal_to_external(method_desc.name)
|
49
|
-
meth_file_name = File.join(dir, file_name)
|
50
|
-
if method_desc.is_singleton
|
51
|
-
meth_file_name += "-c.yaml"
|
52
|
-
else
|
53
|
-
meth_file_name += "-i.yaml"
|
54
|
-
end
|
55
|
-
|
56
|
-
File.open(meth_file_name, "w") do |f|
|
57
|
-
f.write(method_desc.serialize)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def path_to_dir(class_name)
|
64
|
-
File.join(@base_dir, *class_name.split('::'))
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
data/rdoc/lib/rdoc/ri.rb
DELETED
data/rdoc/lib/rdoc/stats.rb
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
require 'rdoc'
|
2
|
-
require 'thread'
|
3
|
-
|
4
|
-
##
|
5
|
-
# Simple stats collector
|
6
|
-
|
7
|
-
class RDoc::Stats
|
8
|
-
|
9
|
-
attr_reader :num_classes
|
10
|
-
attr_reader :num_files
|
11
|
-
attr_reader :num_methods
|
12
|
-
attr_reader :num_modules
|
13
|
-
attr_reader :total_files
|
14
|
-
|
15
|
-
def initialize(total_files, verbosity = 1)
|
16
|
-
@lock = Mutex.new
|
17
|
-
|
18
|
-
@num_classes = 0
|
19
|
-
@num_files = 0
|
20
|
-
@num_methods = 0
|
21
|
-
@num_modules = 0
|
22
|
-
@total_files = total_files
|
23
|
-
|
24
|
-
@start = Time.now
|
25
|
-
|
26
|
-
@display = case verbosity
|
27
|
-
when 0 then Quiet.new
|
28
|
-
when 1 then Normal.new(total_files)
|
29
|
-
else Verbose.new
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def begin_adding(number_of_workers)
|
34
|
-
@display.begin_adding(number_of_workers)
|
35
|
-
end
|
36
|
-
|
37
|
-
def add_alias(as)
|
38
|
-
@lock.synchronize do
|
39
|
-
@display.print_alias as
|
40
|
-
@num_methods += 1
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def add_class(klass)
|
45
|
-
@lock.synchronize do
|
46
|
-
@display.print_class klass
|
47
|
-
@num_classes += 1
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def add_file(file)
|
52
|
-
@lock.synchronize do
|
53
|
-
@display.print_file @num_files, file
|
54
|
-
@num_files += 1
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def add_method(method)
|
59
|
-
@lock.synchronize do
|
60
|
-
@display.print_method method
|
61
|
-
@num_methods += 1
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def add_module(mod)
|
66
|
-
@lock.synchronize do
|
67
|
-
@display.print_module mod
|
68
|
-
@num_modules += 1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def done_adding
|
73
|
-
@lock.synchronize do
|
74
|
-
@display.done_adding
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def print
|
79
|
-
puts "Files: #@num_files"
|
80
|
-
puts "Classes: #@num_classes"
|
81
|
-
puts "Modules: #@num_modules"
|
82
|
-
puts "Methods: #@num_methods"
|
83
|
-
puts "Elapsed: " + sprintf("%0.1fs", Time.now - @start)
|
84
|
-
end
|
85
|
-
|
86
|
-
class Quiet
|
87
|
-
def begin_adding(*) end
|
88
|
-
def print_alias(*) end
|
89
|
-
def print_class(*) end
|
90
|
-
def print_file(*) end
|
91
|
-
def print_method(*) end
|
92
|
-
def print_module(*) end
|
93
|
-
def done_adding(*) end
|
94
|
-
end
|
95
|
-
|
96
|
-
class Normal
|
97
|
-
def initialize(total_files)
|
98
|
-
@total_files = total_files
|
99
|
-
end
|
100
|
-
|
101
|
-
def begin_adding(number_of_workers)
|
102
|
-
puts "Parsing sources with #{number_of_workers} thread(s)..."
|
103
|
-
end
|
104
|
-
|
105
|
-
def print_file(files_so_far, filename)
|
106
|
-
progress_bar = sprintf("%3d%% [%2d/%2d] ",
|
107
|
-
100 * (files_so_far + 1) / @total_files,
|
108
|
-
files_so_far + 1,
|
109
|
-
@total_files)
|
110
|
-
|
111
|
-
if $stdout.tty?
|
112
|
-
# Print a progress bar, but make sure it fits on a single line. Filename
|
113
|
-
# will be truncated if necessary.
|
114
|
-
terminal_width = (ENV['COLUMNS'] || 80).to_i
|
115
|
-
max_filename_size = terminal_width - progress_bar.size
|
116
|
-
if filename.size > max_filename_size
|
117
|
-
# Turn "some_long_filename.rb" to "...ong_filename.rb"
|
118
|
-
filename = filename[(filename.size - max_filename_size) .. -1]
|
119
|
-
filename[0..2] = "..."
|
120
|
-
end
|
121
|
-
|
122
|
-
# Pad the line with whitespaces so that leftover output from the
|
123
|
-
# previous line doesn't show up.
|
124
|
-
line = "#{progress_bar}#{filename}"
|
125
|
-
padding = terminal_width - line.size
|
126
|
-
if padding > 0
|
127
|
-
line << (" " * padding)
|
128
|
-
end
|
129
|
-
|
130
|
-
$stdout.print("#{line}\r")
|
131
|
-
$stdout.flush
|
132
|
-
else
|
133
|
-
puts "#{progress_bar} #{filename}"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def done_adding
|
138
|
-
puts "\n"
|
139
|
-
end
|
140
|
-
|
141
|
-
def print_alias(*) end
|
142
|
-
def print_class(*) end
|
143
|
-
def print_method(*) end
|
144
|
-
def print_module(*) end
|
145
|
-
end
|
146
|
-
|
147
|
-
class Verbose
|
148
|
-
def begin_adding(number_of_workers)
|
149
|
-
puts "Parsing sources with #{number_of_workers} thread(s)..."
|
150
|
-
end
|
151
|
-
|
152
|
-
def print_alias(as)
|
153
|
-
puts "\t\talias #{as.new_name} #{as.old_name}"
|
154
|
-
end
|
155
|
-
|
156
|
-
def print_class(klass)
|
157
|
-
puts "\tclass #{klass.full_name}"
|
158
|
-
end
|
159
|
-
|
160
|
-
def print_file(files_so_far, file)
|
161
|
-
puts file
|
162
|
-
end
|
163
|
-
|
164
|
-
def print_method(method)
|
165
|
-
puts "\t\t#{method.singleton ? '::' : '#'}#{method.name}"
|
166
|
-
end
|
167
|
-
|
168
|
-
def print_module(mod)
|
169
|
-
puts "\tmodule #{mod.full_name}"
|
170
|
-
end
|
171
|
-
|
172
|
-
def done_adding
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
|