bitclust-dev 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- metadata +27 -62
- data/tools/bc-ancestors.rb +0 -153
- data/tools/bc-classes.rb +0 -80
- data/tools/bc-list.rb +0 -63
- data/tools/bc-methods.rb +0 -171
- data/tools/bc-preproc.rb +0 -42
- data/tools/bc-tochm.rb +0 -301
- data/tools/bc-tohtml.rb +0 -125
- data/tools/bc-tohtmlpackage.rb +0 -247
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 64de78dba91ef0131462b61f9b0a94184b224883
|
|
4
|
+
data.tar.gz: dba918642eeabca7e8b356ea1fb353823548e67b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e7ee421a6b18041c0e6996d692e04da261f7cfb3d1c30f3310c985c65abf4d78d9fd50329bab815fdff9a0771f7c5c47d7375ce866d6f034c6f3d9f7179d4fd5
|
|
7
|
+
data.tar.gz: 9576244d6879781eaef8a64c9f52acaa5b17e7688cf9a65a88d8682b4ea9865321dfb4f5d8646b71ea057988c904769250a4f905a4a61ead0c57cf658c69ae13
|
metadata
CHANGED
|
@@ -1,156 +1,121 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bitclust-dev
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.7.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- http://bugs.ruby-lang.org/projects/rurema
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: tools
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
11
|
+
date: 2013-05-12 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: bitclust-core
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
17
|
- - '='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 0.
|
|
19
|
+
version: 0.7.0
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
24
|
- - '='
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.
|
|
26
|
+
version: 0.7.0
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: test-unit
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: 2.3.0
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: 2.3.0
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: test-unit-notify
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- -
|
|
45
|
+
- - '>='
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
47
|
version: '0'
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- -
|
|
52
|
+
- - '>='
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
54
|
version: '0'
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: test-unit-rr
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- -
|
|
59
|
+
- - '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
61
|
version: '0'
|
|
70
62
|
type: :development
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- -
|
|
66
|
+
- - '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
68
|
version: '0'
|
|
78
|
-
description:
|
|
79
|
-
|
|
69
|
+
description: |
|
|
70
|
+
Rurema is a Japanese ruby documentation project, and
|
|
80
71
|
bitclust is a rurema document processor.
|
|
81
|
-
|
|
82
72
|
This is tools for Rurema developpers.
|
|
83
|
-
|
|
84
|
-
'
|
|
85
73
|
email:
|
|
86
74
|
- ''
|
|
87
75
|
executables:
|
|
88
|
-
- bc-tochm.rb
|
|
89
|
-
- bc-methods.rb
|
|
90
76
|
- bc-checkparams.rb
|
|
91
|
-
- bc-ancestors.rb
|
|
92
|
-
- bc-list.rb
|
|
93
|
-
- stattodo.rb
|
|
94
|
-
- statrefm.rb
|
|
95
|
-
- bc-classes.rb
|
|
96
|
-
- bc-tohtml.rb
|
|
97
|
-
- forall-ruby.rb
|
|
98
|
-
- gencatalog.rb
|
|
99
77
|
- bc-convert.rb
|
|
100
78
|
- bc-rdoc.rb
|
|
101
|
-
- bc-preproc.rb
|
|
102
|
-
- update-database.rb
|
|
103
|
-
- bc-tohtmlpackage.rb
|
|
104
79
|
- check-signature.rb
|
|
80
|
+
- forall-ruby.rb
|
|
81
|
+
- gencatalog.rb
|
|
82
|
+
- statrefm.rb
|
|
83
|
+
- stattodo.rb
|
|
84
|
+
- update-database.rb
|
|
105
85
|
extensions: []
|
|
106
86
|
extra_rdoc_files: []
|
|
107
87
|
files:
|
|
108
|
-
- tools/bc-tochm.rb
|
|
109
|
-
- tools/bc-methods.rb
|
|
110
88
|
- tools/bc-checkparams.rb
|
|
111
|
-
- tools/bc-ancestors.rb
|
|
112
|
-
- tools/bc-list.rb
|
|
113
|
-
- tools/stattodo.rb
|
|
114
|
-
- tools/statrefm.rb
|
|
115
|
-
- tools/bc-classes.rb
|
|
116
|
-
- tools/bc-tohtml.rb
|
|
117
|
-
- tools/forall-ruby.rb
|
|
118
|
-
- tools/gencatalog.rb
|
|
119
89
|
- tools/bc-convert.rb
|
|
120
90
|
- tools/bc-rdoc.rb
|
|
121
|
-
- tools/bc-preproc.rb
|
|
122
|
-
- tools/update-database.rb
|
|
123
|
-
- tools/bc-tohtmlpackage.rb
|
|
124
91
|
- tools/check-signature.rb
|
|
92
|
+
- tools/forall-ruby.rb
|
|
93
|
+
- tools/gencatalog.rb
|
|
94
|
+
- tools/statrefm.rb
|
|
95
|
+
- tools/stattodo.rb
|
|
96
|
+
- tools/update-database.rb
|
|
125
97
|
- lib/bitclust.rb
|
|
126
98
|
homepage: http://doc.ruby-lang.org/ja/
|
|
127
99
|
licenses: []
|
|
100
|
+
metadata: {}
|
|
128
101
|
post_install_message:
|
|
129
102
|
rdoc_options: []
|
|
130
103
|
require_paths:
|
|
131
104
|
- lib
|
|
132
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
|
-
none: false
|
|
134
106
|
requirements:
|
|
135
|
-
- -
|
|
107
|
+
- - '>='
|
|
136
108
|
- !ruby/object:Gem::Version
|
|
137
109
|
version: '0'
|
|
138
|
-
segments:
|
|
139
|
-
- 0
|
|
140
|
-
hash: 4246355290174863682
|
|
141
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
|
-
none: false
|
|
143
111
|
requirements:
|
|
144
|
-
- -
|
|
112
|
+
- - '>='
|
|
145
113
|
- !ruby/object:Gem::Version
|
|
146
114
|
version: '0'
|
|
147
|
-
segments:
|
|
148
|
-
- 0
|
|
149
|
-
hash: 4246355290174863682
|
|
150
115
|
requirements: []
|
|
151
116
|
rubyforge_project: ''
|
|
152
|
-
rubygems_version:
|
|
117
|
+
rubygems_version: 2.0.0
|
|
153
118
|
signing_key:
|
|
154
|
-
specification_version:
|
|
119
|
+
specification_version: 4
|
|
155
120
|
summary: BitClust is a rurema document processor.
|
|
156
121
|
test_files: []
|
data/tools/bc-ancestors.rb
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'pathname'
|
|
4
|
-
|
|
5
|
-
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
6
|
-
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
7
|
-
|
|
8
|
-
require 'bitclust'
|
|
9
|
-
require 'bitclust/crossrubyutils'
|
|
10
|
-
require 'optparse'
|
|
11
|
-
require 'set'
|
|
12
|
-
|
|
13
|
-
include BitClust::CrossRubyUtils
|
|
14
|
-
|
|
15
|
-
def main
|
|
16
|
-
prefix = nil
|
|
17
|
-
requires = []
|
|
18
|
-
ver = RUBY_VERSION
|
|
19
|
-
@verbose = false
|
|
20
|
-
all = false
|
|
21
|
-
parser = OptionParser.new
|
|
22
|
-
parser.banner =<<BANNER
|
|
23
|
-
Usage: #{File.basename($0, '.*')} [-r<lib>] [--ruby=<VER>] --db=PATH <classname>
|
|
24
|
-
#{File.basename($0, '.*')} [-r<lib>] [--ruby=<VER>] --db=PATH --all
|
|
25
|
-
NG Sample:
|
|
26
|
-
$ #{File.basename($0, '.*')} -rfoo --ruby=1.9.1 --db=./db Foo
|
|
27
|
-
NG : Foo
|
|
28
|
-
+ FooModule (The Ruby have this class/module in ancestors of the class)
|
|
29
|
-
- BarModule (The Database have this class/module in ancestors of the class)
|
|
30
|
-
Options:
|
|
31
|
-
BANNER
|
|
32
|
-
parser.on('-d', '--database=PATH', 'Database prefix.') {|path|
|
|
33
|
-
prefix = path
|
|
34
|
-
}
|
|
35
|
-
parser.on('-r LIB', 'Requires library LIB') {|lib|
|
|
36
|
-
requires.push lib
|
|
37
|
-
}
|
|
38
|
-
parser.on('--ruby=[VER]', "The version of Ruby interpreter"){|ver|
|
|
39
|
-
ver = ver
|
|
40
|
-
}
|
|
41
|
-
parser.on('-v', '--verbose', 'Show differences'){
|
|
42
|
-
@verbose = true
|
|
43
|
-
}
|
|
44
|
-
parser.on('--all', 'Check anccestors for all classes'){
|
|
45
|
-
all = true
|
|
46
|
-
}
|
|
47
|
-
parser.on('--help', 'Prints this message and quit.') {
|
|
48
|
-
puts parser.help
|
|
49
|
-
exit 0
|
|
50
|
-
}
|
|
51
|
-
begin
|
|
52
|
-
parser.parse!
|
|
53
|
-
rescue OptionParser::ParseError => err
|
|
54
|
-
$stderr.puts err.message
|
|
55
|
-
$stderr.puts parser.help
|
|
56
|
-
exit 1
|
|
57
|
-
end
|
|
58
|
-
unless ARGV.size == 1 || all
|
|
59
|
-
$stderr.puts "wrong number of arguments"
|
|
60
|
-
$stderr.puts parser.help
|
|
61
|
-
exit 1
|
|
62
|
-
end
|
|
63
|
-
classname = ARGV[0]
|
|
64
|
-
db = BitClust::MethodDatabase.new(prefix)
|
|
65
|
-
ruby = get_ruby(ver)
|
|
66
|
-
if classname && !all
|
|
67
|
-
check_ancestors(db, ruby, requires, classname)
|
|
68
|
-
else
|
|
69
|
-
$stderr.puts 'check all...'
|
|
70
|
-
check_all_ancestors(db, ruby, requires)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def ancestors(ruby, requires, classname)
|
|
75
|
-
req = requires.map{|lib|
|
|
76
|
-
unless '_builtin' == lib
|
|
77
|
-
"-r#{lib}"
|
|
78
|
-
else
|
|
79
|
-
''
|
|
80
|
-
end
|
|
81
|
-
}.join(" ")
|
|
82
|
-
script =<<-SRC
|
|
83
|
-
c = #{classname}
|
|
84
|
-
puts c.ancestors.join("\n")
|
|
85
|
-
SRC
|
|
86
|
-
`#{ruby} #{req} -e '#{script}'`.split
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
def check_ancestors(db, ruby, requires, classname)
|
|
90
|
-
a = ancestors(ruby, requires, classname)
|
|
91
|
-
begin
|
|
92
|
-
b = db.fetch_class(classname).ancestors.map(&:name)
|
|
93
|
-
rescue BitClust::ClassNotFound => ex
|
|
94
|
-
$stderr.puts "class not found in database : #{classname}"
|
|
95
|
-
b = []
|
|
96
|
-
end
|
|
97
|
-
unless a.to_set == b.to_set
|
|
98
|
-
puts "NG : #{classname}"
|
|
99
|
-
puts (a-b).map{|c| "+ #{c}" }.join("\n")
|
|
100
|
-
puts (b-a).map{|c| "- #{c}" }.join("\n")
|
|
101
|
-
else
|
|
102
|
-
puts "OK : #{classname}" if @verbose
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def check_all_ancestors(db, ruby, requires)
|
|
107
|
-
classnames = []
|
|
108
|
-
requires.each do |lib|
|
|
109
|
-
classnames.push(*defined_classes(ruby, lib, []))
|
|
110
|
-
end
|
|
111
|
-
classnames.each do |classname|
|
|
112
|
-
check_ancestors(db, ruby, requires, classname)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def defined_classes(ruby, lib, rejects)
|
|
117
|
-
output = `#{ruby} -e '
|
|
118
|
-
def class_extent
|
|
119
|
-
result = []
|
|
120
|
-
ObjectSpace.each_object(Module) do |c|
|
|
121
|
-
result.push c
|
|
122
|
-
end
|
|
123
|
-
result
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
%w(#{rejects.join(" ")}).each do |lib|
|
|
127
|
-
begin
|
|
128
|
-
require lib
|
|
129
|
-
rescue LoadError
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
if "#{lib}" == "_builtin"
|
|
133
|
-
class_extent().each do |c|
|
|
134
|
-
puts c
|
|
135
|
-
end
|
|
136
|
-
else
|
|
137
|
-
before = class_extent()
|
|
138
|
-
begin
|
|
139
|
-
require "#{lib}"
|
|
140
|
-
rescue LoadError
|
|
141
|
-
$stderr.puts "\#{RUBY_VERSION} (\#{RUBY_RELEASE_DATE}): library not exist: #{lib}"
|
|
142
|
-
exit
|
|
143
|
-
end
|
|
144
|
-
after = class_extent()
|
|
145
|
-
(after - before).each do |c|
|
|
146
|
-
puts c
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
'`
|
|
150
|
-
output.split
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
main
|
data/tools/bc-classes.rb
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'pathname'
|
|
4
|
-
|
|
5
|
-
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
6
|
-
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
7
|
-
|
|
8
|
-
require 'bitclust/crossrubyutils'
|
|
9
|
-
require 'optparse'
|
|
10
|
-
|
|
11
|
-
include BitClust::CrossRubyUtils
|
|
12
|
-
|
|
13
|
-
def main
|
|
14
|
-
rejects = []
|
|
15
|
-
@verbose = false
|
|
16
|
-
opts = OptionParser.new
|
|
17
|
-
opts.banner = "Usage: #{File.basename($0, '.*')} [-r<lib>] <lib>"
|
|
18
|
-
opts.on('-r', '--reject=LIB', 'Reject library LIB') {|lib|
|
|
19
|
-
rejects.concat lib.split(',')
|
|
20
|
-
}
|
|
21
|
-
opts.on('-v', '--verbose', 'Show all ruby version.') {
|
|
22
|
-
@verbose = true
|
|
23
|
-
}
|
|
24
|
-
opts.on('--help', 'Prints this message and quit.') {
|
|
25
|
-
puts opts.help
|
|
26
|
-
exit 0
|
|
27
|
-
}
|
|
28
|
-
begin
|
|
29
|
-
opts.parse!(ARGV)
|
|
30
|
-
rescue OptionParser::ParseError => err
|
|
31
|
-
$stderr.puts err.message
|
|
32
|
-
exit 1
|
|
33
|
-
end
|
|
34
|
-
unless ARGV.size == 1
|
|
35
|
-
$stderr.puts 'wrong number of arguments'
|
|
36
|
-
$stderr.puts opts.help
|
|
37
|
-
exit 1
|
|
38
|
-
end
|
|
39
|
-
lib = ARGV[0]
|
|
40
|
-
print_crossruby_table {|ruby| defined_classes(ruby, lib, rejects) }
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def defined_classes(ruby, lib, rejects)
|
|
44
|
-
output = `#{ruby} -e '
|
|
45
|
-
def class_extent
|
|
46
|
-
result = []
|
|
47
|
-
ObjectSpace.each_object(Module) do |c|
|
|
48
|
-
result.push c
|
|
49
|
-
end
|
|
50
|
-
result
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
%w(#{rejects.join(" ")}).each do |lib|
|
|
54
|
-
begin
|
|
55
|
-
require lib
|
|
56
|
-
rescue LoadError
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
if "#{lib}" == "_builtin"
|
|
60
|
-
class_extent().each do |c|
|
|
61
|
-
puts c
|
|
62
|
-
end
|
|
63
|
-
else
|
|
64
|
-
before = class_extent()
|
|
65
|
-
begin
|
|
66
|
-
require "#{lib}"
|
|
67
|
-
rescue LoadError
|
|
68
|
-
$stderr.puts "\#{RUBY_VERSION} (\#{RUBY_RELEASE_DATE}): library not exist: #{lib}"
|
|
69
|
-
exit
|
|
70
|
-
end
|
|
71
|
-
after = class_extent()
|
|
72
|
-
(after - before).each do |c|
|
|
73
|
-
puts c
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
'`
|
|
77
|
-
output.split
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
main
|
data/tools/bc-list.rb
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'pathname'
|
|
4
|
-
|
|
5
|
-
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
6
|
-
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
7
|
-
|
|
8
|
-
require 'bitclust'
|
|
9
|
-
require 'optparse'
|
|
10
|
-
|
|
11
|
-
def main
|
|
12
|
-
check_only = false
|
|
13
|
-
parser = OptionParser.new
|
|
14
|
-
parser.banner = "Usage: #{File.basename($0, '.*')} <file>..."
|
|
15
|
-
parser.on('-c', '--check-only', 'Check syntax and output status.') {
|
|
16
|
-
check_only = true
|
|
17
|
-
}
|
|
18
|
-
parser.on('--help', 'Prints this message and quit.') {
|
|
19
|
-
puts parser.help
|
|
20
|
-
exit
|
|
21
|
-
}
|
|
22
|
-
begin
|
|
23
|
-
parser.parse!
|
|
24
|
-
rescue OptionParser::ParseError => err
|
|
25
|
-
$stderr.puts err.message
|
|
26
|
-
exit 1
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
success = true
|
|
30
|
-
ARGV.each do |path|
|
|
31
|
-
begin
|
|
32
|
-
lib = BitClust::RRDParser.parse_stdlib_file(path)
|
|
33
|
-
if check_only
|
|
34
|
-
$stderr.puts "#{path}: OK"
|
|
35
|
-
else
|
|
36
|
-
show_library lib
|
|
37
|
-
end
|
|
38
|
-
rescue BitClust::WriterError => err
|
|
39
|
-
raise if $DEBUG
|
|
40
|
-
$stderr.puts "#{File.basename($0, '.*')}: FAIL: #{err.message}"
|
|
41
|
-
success = false
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
exit success
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def show_library(lib)
|
|
48
|
-
puts "= Library #{lib.name}"
|
|
49
|
-
lib.classes.each do |c|
|
|
50
|
-
puts "#{c.type} #{c.name}"
|
|
51
|
-
c.each do |m|
|
|
52
|
-
puts "\t* #{m.klass.name}#{m.typemark}#{m.names.join(',')}"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
unless lib.methods.empty?
|
|
56
|
-
puts "Additional Methods:"
|
|
57
|
-
lib.methods.each do |m|
|
|
58
|
-
puts "\t* #{m.klass.name}#{m.typemark}#{m.names.join(',')}"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
main
|
data/tools/bc-methods.rb
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
#
|
|
3
|
-
# bc-methods.rb -- list all methods of existing rubys.
|
|
4
|
-
#
|
|
5
|
-
# This program is derived from bc-vdtb.rb, posted in
|
|
6
|
-
# [ruby-reference-manual:160] by sheepman.
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
require 'pathname'
|
|
10
|
-
|
|
11
|
-
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
12
|
-
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
13
|
-
|
|
14
|
-
require 'bitclust'
|
|
15
|
-
require 'bitclust/crossrubyutils'
|
|
16
|
-
require 'optparse'
|
|
17
|
-
|
|
18
|
-
include BitClust::CrossRubyUtils
|
|
19
|
-
|
|
20
|
-
def main
|
|
21
|
-
@requires = []
|
|
22
|
-
@verbose = false
|
|
23
|
-
@ver = RUBY_VERSION
|
|
24
|
-
mode = :list
|
|
25
|
-
target = nil
|
|
26
|
-
opts = OptionParser.new
|
|
27
|
-
opts.banner = "Usage: #{File.basename($0, '.*')} [-r<lib>] <classname>"
|
|
28
|
-
opts.on('-r LIB', 'Requires library LIB') {|lib|
|
|
29
|
-
@requires.push lib
|
|
30
|
-
}
|
|
31
|
-
opts.on('-v', '--verbose', "Prints each ruby's version") {
|
|
32
|
-
@verbose = true
|
|
33
|
-
}
|
|
34
|
-
opts.on('--diff=RDFILE', 'RD file name') {|path|
|
|
35
|
-
mode = :diff
|
|
36
|
-
target = path
|
|
37
|
-
}
|
|
38
|
-
opts.on('-c', '') {
|
|
39
|
-
@content = true
|
|
40
|
-
require 'bitclust/ridatabase'
|
|
41
|
-
}
|
|
42
|
-
opts.on('--ruby=[VER]', "The version of Ruby interpreter"){|ver|
|
|
43
|
-
@ver = ver
|
|
44
|
-
}
|
|
45
|
-
opts.on('--ri-database', 'The path of ri database'){|path|
|
|
46
|
-
@ri_path = path
|
|
47
|
-
}
|
|
48
|
-
opts.on('--help', 'Prints this message and quit.') {
|
|
49
|
-
puts opts.help
|
|
50
|
-
exit 0
|
|
51
|
-
}
|
|
52
|
-
begin
|
|
53
|
-
opts.parse!(ARGV)
|
|
54
|
-
rescue OptionParser::ParseError => err
|
|
55
|
-
$stderr.puts err.message
|
|
56
|
-
exit 1
|
|
57
|
-
end
|
|
58
|
-
unless ARGV.size == 1
|
|
59
|
-
$stderr.puts "wrong number of arguments"
|
|
60
|
-
$stderr.puts opts.help
|
|
61
|
-
exit 1
|
|
62
|
-
end
|
|
63
|
-
classname = ARGV[0]
|
|
64
|
-
|
|
65
|
-
case mode
|
|
66
|
-
when :list
|
|
67
|
-
print_crossruby_table {|ruby| defined_methods(ruby, classname) }
|
|
68
|
-
when :diff
|
|
69
|
-
unless ruby = get_ruby(@ver)
|
|
70
|
-
raise "Not found Ruby interpreter of the given version"
|
|
71
|
-
end
|
|
72
|
-
keys = defined_methods(ruby, classname)
|
|
73
|
-
lib = BitClust::RRDParser.parse_stdlib_file(target, { 'version' => @ver })
|
|
74
|
-
c = lib.fetch_class(classname)
|
|
75
|
-
list0 = lib.classes.find_all{|c0| /\A#{classname}\b/o =~ c0.name }
|
|
76
|
-
list0 = c.entries + list0
|
|
77
|
-
list = list0.map {|ent| ent.labels.map {|n| expand_mf(n) } }.flatten
|
|
78
|
-
if @content
|
|
79
|
-
ri = @ri_path ? RiDatabase.open(@ri_path, nil) : RiDatabase.open_system_db
|
|
80
|
-
ri.current_class = c.name
|
|
81
|
-
mthds = ( ri.singleton_methods + ri.instance_methods )
|
|
82
|
-
fmt = Formatter.new
|
|
83
|
-
(keys - list).sort.each do |name|
|
|
84
|
-
mthd = mthds.find{|m| name == m.fullname }
|
|
85
|
-
if mthd
|
|
86
|
-
puts fmt.method_info(mthd.entry)
|
|
87
|
-
else
|
|
88
|
-
name = name.sub(/\A\w+#/, '')
|
|
89
|
-
puts "--- #{name}\n\#@todo\n\n"
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
else
|
|
93
|
-
(keys - list).sort.each do |name|
|
|
94
|
-
puts "-#{name}"
|
|
95
|
-
end
|
|
96
|
-
(list - keys).sort.each do |name|
|
|
97
|
-
puts "+#{name}"
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
else
|
|
101
|
-
raise "must not happen: #{mode.inspect}"
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def expand_mf(n)
|
|
106
|
-
if /\.\#/ =~ n
|
|
107
|
-
[n.sub(/\.\#/, '.'), n.sub(/\.\#/, '#')]
|
|
108
|
-
else
|
|
109
|
-
n
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def crossrubyutils_sort_entries(ents)
|
|
114
|
-
ents.sort_by {|m| m_order(m) }
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
ORDER = { '.' => 1, '#' => 2, '::' => 3 }
|
|
118
|
-
|
|
119
|
-
def m_order(m)
|
|
120
|
-
m, t, c = *m.reverse.split(/(\#|\.|::)/, 2)
|
|
121
|
-
[ORDER[t] || 0, m.reverse]
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def defined_methods(ruby, classname)
|
|
125
|
-
req = @requires.map {|lib| "-r#{lib}" }.join(' ')
|
|
126
|
-
avoid_tracer = ""
|
|
127
|
-
avoid_tracer = "Tracer.off" if @requires.include?("tracer")
|
|
128
|
-
if classname == 'Object'
|
|
129
|
-
`#{ruby} #{req} -e '
|
|
130
|
-
c = #{classname}
|
|
131
|
-
c.singleton_methods(false).each do |m|
|
|
132
|
-
puts "#{classname}.\#{m}"
|
|
133
|
-
end
|
|
134
|
-
c.instance_methods(true).each do |m|
|
|
135
|
-
puts "#{classname}\\#\#{m}"
|
|
136
|
-
end
|
|
137
|
-
'`.split
|
|
138
|
-
elsif classname == 'Kernel'
|
|
139
|
-
`#{ruby} #{req} -e '
|
|
140
|
-
c = #{classname}
|
|
141
|
-
c.singleton_methods(true).each do |m|
|
|
142
|
-
puts "#{classname}.\#{m}"
|
|
143
|
-
end
|
|
144
|
-
( c.private_instance_methods(false) && c.methods(false) ).each do |m|
|
|
145
|
-
puts "#{classname}\\#\#{m}"
|
|
146
|
-
end
|
|
147
|
-
Object::constants.delete_if{|c| cl = Object.const_get(c).class; cl == Class or cl == Module }.each do |m|
|
|
148
|
-
puts "#{classname}::\#{m}"
|
|
149
|
-
end
|
|
150
|
-
global_variables.each do |m|
|
|
151
|
-
puts "#{classname}\#{m}"
|
|
152
|
-
end
|
|
153
|
-
'`.split
|
|
154
|
-
else
|
|
155
|
-
`#{ruby} #{req} -e '
|
|
156
|
-
#{avoid_tracer}
|
|
157
|
-
c = #{classname}
|
|
158
|
-
c.singleton_methods(false).each do |m|
|
|
159
|
-
puts "#{classname}.\#{m}"
|
|
160
|
-
end
|
|
161
|
-
c.instance_methods(false).each do |m|
|
|
162
|
-
puts "#{classname}\\#\#{m}"
|
|
163
|
-
end
|
|
164
|
-
c.ancestors.map {|mod| mod.constants }.inject {|r,n| r-n }.each do |m|
|
|
165
|
-
puts "#{classname}::\#{m}"
|
|
166
|
-
end
|
|
167
|
-
'`.split
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
main
|
data/tools/bc-preproc.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'pathname'
|
|
4
|
-
|
|
5
|
-
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
6
|
-
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
7
|
-
|
|
8
|
-
require 'bitclust/rrdparser'
|
|
9
|
-
require 'optparse'
|
|
10
|
-
|
|
11
|
-
def main
|
|
12
|
-
params = {"version" => "1.9.0"}
|
|
13
|
-
parser = OptionParser.new
|
|
14
|
-
parser.banner = "Usage: #{File.basename($0, '.*')} <file>..."
|
|
15
|
-
parser.on('--param=KVPAIR', 'Set parameter by key/value pair.') {|kv|
|
|
16
|
-
k, v = kv.split('=', 2)
|
|
17
|
-
params[k] = v
|
|
18
|
-
}
|
|
19
|
-
parser.on('--help', 'Prints this message and quit.') {
|
|
20
|
-
puts parser.help
|
|
21
|
-
exit
|
|
22
|
-
}
|
|
23
|
-
begin
|
|
24
|
-
parser.parse!
|
|
25
|
-
rescue OptionParser::ParseError => err
|
|
26
|
-
$stderr.puts err.message
|
|
27
|
-
exit 1
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
ARGV.each do |path|
|
|
31
|
-
File.open(path) {|f|
|
|
32
|
-
BitClust::Preprocessor.wrap(f, params).each do |line|
|
|
33
|
-
puts line
|
|
34
|
-
end
|
|
35
|
-
}
|
|
36
|
-
end
|
|
37
|
-
rescue BitClust::WriterError => err
|
|
38
|
-
$stderr.puts err.message
|
|
39
|
-
exit 1
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
main
|
data/tools/bc-tochm.rb
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
require 'pathname'
|
|
4
|
-
def srcdir_root
|
|
5
|
-
(Pathname.new(__FILE__).realpath.dirname + '..').cleanpath
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
$LOAD_PATH.unshift srcdir_root() + 'lib'
|
|
9
|
-
|
|
10
|
-
#def srcdir_root
|
|
11
|
-
# #Pathname.new(__FILE__).realpath.dirname.parent.cleanpath
|
|
12
|
-
# Pathname.new(__FILE__).dirname.parent.cleanpath
|
|
13
|
-
#end
|
|
14
|
-
#$LOAD_PATH.unshift srcdir_root + 'lib'
|
|
15
|
-
|
|
16
|
-
require 'bitclust'
|
|
17
|
-
require 'erb'
|
|
18
|
-
require 'fileutils'
|
|
19
|
-
require 'kconv'
|
|
20
|
-
require 'optparse'
|
|
21
|
-
begin
|
|
22
|
-
require 'progressbar'
|
|
23
|
-
rescue LoadError
|
|
24
|
-
class ProgressBar
|
|
25
|
-
def initialize(title, total, out = STDERR)
|
|
26
|
-
@title, @total, @out = title, total, out
|
|
27
|
-
end
|
|
28
|
-
attr_reader :title
|
|
29
|
-
|
|
30
|
-
def inc(step = 1)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def finish
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
HHP_SKEL = <<EOS
|
|
39
|
-
[OPTIONS]
|
|
40
|
-
Compatibility=1.1 or later
|
|
41
|
-
Compiled file=refm.chm
|
|
42
|
-
Contents file=refm.hhc
|
|
43
|
-
Default Window=titlewindow
|
|
44
|
-
Default topic=doc/index.html
|
|
45
|
-
Display compile progress=No
|
|
46
|
-
Error log file=refm.log
|
|
47
|
-
Full-text search=Yes
|
|
48
|
-
Index file=refm.hhk
|
|
49
|
-
Language=0x411 日本語 (日本)
|
|
50
|
-
Title=Rubyリファレンスマニュアル
|
|
51
|
-
|
|
52
|
-
[WINDOWS]
|
|
53
|
-
titlewindow="Rubyリファレンスマニュアル","refm.hhc","refm.hhk","doc/index.html","doc/index.html",,,,,0x21420,,0x387e,,,,,,,,0
|
|
54
|
-
|
|
55
|
-
[FILES]
|
|
56
|
-
<%= @html_files.join("\n") %>
|
|
57
|
-
EOS
|
|
58
|
-
|
|
59
|
-
HHC_SKEL = <<EOS
|
|
60
|
-
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
61
|
-
<HTML>
|
|
62
|
-
<HEAD>
|
|
63
|
-
</HEAD>
|
|
64
|
-
<BODY>
|
|
65
|
-
<UL><% [:library].each do |k| %>
|
|
66
|
-
<%= @sitemap[k].to_html %>
|
|
67
|
-
<% end %></UL>
|
|
68
|
-
</BODY>
|
|
69
|
-
</HTML>
|
|
70
|
-
EOS
|
|
71
|
-
|
|
72
|
-
HHK_SKEL = <<EOS
|
|
73
|
-
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
74
|
-
<HTML>
|
|
75
|
-
<HEAD>
|
|
76
|
-
</HEAD>
|
|
77
|
-
<BODY>
|
|
78
|
-
<UL><% @index_contents.sort.each do |content| %>
|
|
79
|
-
<%= content.to_html %>
|
|
80
|
-
<% end %></UL>
|
|
81
|
-
</BODY>
|
|
82
|
-
</HTML>
|
|
83
|
-
EOS
|
|
84
|
-
|
|
85
|
-
class Sitemap
|
|
86
|
-
def initialize(name, local = nil)
|
|
87
|
-
@name = name
|
|
88
|
-
@contents = Content.new(name, local)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def method_missing(name, *args, &block)
|
|
92
|
-
@contents.send(name, *args, &block)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
class Content
|
|
96
|
-
include Enumerable
|
|
97
|
-
include ERB::Util
|
|
98
|
-
|
|
99
|
-
def initialize(name, local = nil)
|
|
100
|
-
@name = name
|
|
101
|
-
@local = local
|
|
102
|
-
@contents = []
|
|
103
|
-
end
|
|
104
|
-
attr_reader :name, :local, :contents
|
|
105
|
-
|
|
106
|
-
def [](index)
|
|
107
|
-
@contents[index]
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def <<(content)
|
|
111
|
-
@contents << content
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def <=>(other)
|
|
115
|
-
@name <=> other.name
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def each
|
|
119
|
-
@contents.each do |content|
|
|
120
|
-
yield content
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def to_html
|
|
125
|
-
str = "<LI> <OBJECT type=\"text/sitemap\">\n"
|
|
126
|
-
str << " <param name=\"Name\" value=\"<%=h @name%>\">\n"
|
|
127
|
-
if @local
|
|
128
|
-
str << " <param name=\"Local\" value=\"<%=@local%>\">\n"
|
|
129
|
-
end
|
|
130
|
-
str << " </OBJECT>\n"
|
|
131
|
-
unless contents.empty?
|
|
132
|
-
str << "<UL>\n"
|
|
133
|
-
@contents.each do |content|
|
|
134
|
-
str << content.to_html
|
|
135
|
-
end
|
|
136
|
-
str << "</UL>\n"
|
|
137
|
-
end
|
|
138
|
-
ERB.new(str).result(binding)
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
module BitClust
|
|
144
|
-
|
|
145
|
-
class URLMapperEx < URLMapper
|
|
146
|
-
def library_url(name)
|
|
147
|
-
if name == '/'
|
|
148
|
-
"/library/index.html"
|
|
149
|
-
else
|
|
150
|
-
"/library/#{encodename_fs(name)}.html"
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
def class_url(name)
|
|
155
|
-
"/class/#{encodename_fs(name)}.html"
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
def method_url(spec)
|
|
159
|
-
cname, tmark, mname = *split_method_spec(spec)
|
|
160
|
-
"/method/#{encodename_fs(cname)}/#{typemark2char(tmark)}/#{encodename_fs(mname)}.html"
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def document_url(name)
|
|
164
|
-
"/doc/#{encodename_fs(name)}.html"
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
def main
|
|
170
|
-
@sitemap = {
|
|
171
|
-
:library => Sitemap.new('ライブラリ', 'library/index.html'),
|
|
172
|
-
}
|
|
173
|
-
@sitemap[:library] << Sitemap::Content.new('標準ライブラリ', 'library/_builtin.html')
|
|
174
|
-
@sitemap[:library] << Sitemap::Content.new('添付ライブラリ')
|
|
175
|
-
@stdlibs = {}
|
|
176
|
-
@index_contents = []
|
|
177
|
-
prefix = Pathname.new('./db')
|
|
178
|
-
outputdir = Pathname.new('./chm')
|
|
179
|
-
manager_config = {
|
|
180
|
-
:baseurl => 'http://example.com/',
|
|
181
|
-
:suffix => '.html',
|
|
182
|
-
:templatedir => srcdir_root + 'data'+ 'bitclust' + 'template',
|
|
183
|
-
:themedir => srcdir_root + 'theme' + 'default',
|
|
184
|
-
:css_url => 'style.css',
|
|
185
|
-
:cgi_url => '',
|
|
186
|
-
:tochm_mode => true
|
|
187
|
-
}
|
|
188
|
-
manager_config[:urlmapper] = BitClust::URLMapperEx.new(manager_config)
|
|
189
|
-
|
|
190
|
-
parser = OptionParser.new
|
|
191
|
-
parser.on('-d', '--database=PATH', 'Database prefix') do |path|
|
|
192
|
-
prefix = Pathname.new(path).realpath
|
|
193
|
-
end
|
|
194
|
-
parser.on('-o', '--outputdir=PATH', 'Output directory') do |path|
|
|
195
|
-
begin
|
|
196
|
-
outputdir = Pathname.new(path).realpath
|
|
197
|
-
rescue Errno::ENOENT
|
|
198
|
-
FileUtils.mkdir_p(path, :verbose => true)
|
|
199
|
-
retry
|
|
200
|
-
end
|
|
201
|
-
end
|
|
202
|
-
parser.on('--help', 'Prints this message and quit') do
|
|
203
|
-
puts(parser.help)
|
|
204
|
-
exit(0)
|
|
205
|
-
end
|
|
206
|
-
begin
|
|
207
|
-
parser.parse!
|
|
208
|
-
rescue OptionParser::ParseError => err
|
|
209
|
-
STDERR.puts(err.message)
|
|
210
|
-
STDERR.puts(parser.help)
|
|
211
|
-
exit(1)
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
db = BitClust::MethodDatabase.new(prefix.to_s)
|
|
215
|
-
manager = BitClust::ScreenManager.new(manager_config)
|
|
216
|
-
@html_files = []
|
|
217
|
-
db.transaction do
|
|
218
|
-
methods = {}
|
|
219
|
-
pb = ProgressBar.new('method', db.methods.size)
|
|
220
|
-
db.methods.each_with_index do |entry, i|
|
|
221
|
-
method_name = entry.klass.name + entry.typemark + entry.name
|
|
222
|
-
(methods[method_name] ||= []) << entry
|
|
223
|
-
pb.inc
|
|
224
|
-
end
|
|
225
|
-
pb.finish
|
|
226
|
-
entries = db.docs + db.libraries.sort + db.classes.sort + methods.values.sort
|
|
227
|
-
pb = ProgressBar.new('entry', entries.size)
|
|
228
|
-
entries.each_with_index do |c, i|
|
|
229
|
-
filename = create_html_file(c, manager, outputdir, db)
|
|
230
|
-
@html_files << filename
|
|
231
|
-
e = c.is_a?(Array) ? c.sort.first : c
|
|
232
|
-
case e.type_id
|
|
233
|
-
when :library
|
|
234
|
-
content = Sitemap::Content.new(e.name.to_s, filename)
|
|
235
|
-
if e.name.to_s != '_builtin'
|
|
236
|
-
@sitemap[:library][1] << content
|
|
237
|
-
@stdlibs[e.name.to_s] = content
|
|
238
|
-
end
|
|
239
|
-
@index_contents << Sitemap::Content.new(e.name.to_s, filename)
|
|
240
|
-
when :class
|
|
241
|
-
content = Sitemap::Content.new(e.name.to_s, filename)
|
|
242
|
-
if e.library.name.to_s == '_builtin'
|
|
243
|
-
@sitemap[:library][0] << content
|
|
244
|
-
else
|
|
245
|
-
@stdlibs[e.library.name.to_s] << content
|
|
246
|
-
end
|
|
247
|
-
@index_contents << Sitemap::Content.new("#{e.name} (#{e.library.name})", filename)
|
|
248
|
-
when :method
|
|
249
|
-
e.names.each do |e_name|
|
|
250
|
-
name = e.typename == :special_variable ? "$#{e_name}" : e_name
|
|
251
|
-
@index_contents <<
|
|
252
|
-
Sitemap::Content.new("#{name} (#{e.library.name} - #{e.klass.name})", filename)
|
|
253
|
-
@index_contents <<
|
|
254
|
-
Sitemap::Content.new("#{e.klass.name}#{e.typemark}#{name} (#{e.library.name})", filename)
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
pb.title.replace(e.name)
|
|
258
|
-
pb.inc
|
|
259
|
-
end
|
|
260
|
-
pb.finish
|
|
261
|
-
end
|
|
262
|
-
@html_files.sort!
|
|
263
|
-
create_file(outputdir + 'refm.hhp', HHP_SKEL, true)
|
|
264
|
-
create_file(outputdir + 'refm.hhc', HHC_SKEL, true)
|
|
265
|
-
create_file(outputdir + 'refm.hhk', HHK_SKEL, true)
|
|
266
|
-
create_file(outputdir + 'library/index.html', manager.library_index_screen(db.libraries.sort, {:database => db}).body)
|
|
267
|
-
create_file(outputdir + 'class/index.html', manager.class_index_screen(db.classes.sort, {:database => db}).body)
|
|
268
|
-
FileUtils.cp(manager_config[:themedir] + manager_config[:css_url],
|
|
269
|
-
outputdir.to_s, {:verbose => true, :preserve => true})
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
def create_html_file(entry, manager, outputdir, db)
|
|
273
|
-
html = manager.entry_screen(entry, {:database => db}).body
|
|
274
|
-
e = entry.is_a?(Array) ? entry.sort.first : entry
|
|
275
|
-
path = case e.type_id
|
|
276
|
-
when :library, :class, :doc
|
|
277
|
-
outputdir + e.type_id.to_s + (BitClust::NameUtils.encodename_fs(e.name) + '.html')
|
|
278
|
-
when :method
|
|
279
|
-
outputdir + e.type_id.to_s + BitClust::NameUtils.encodename_fs(e.klass.name) +
|
|
280
|
-
e.typechar + (BitClust::NameUtils.encodename_fs(e.name) + '.html')
|
|
281
|
-
else
|
|
282
|
-
raise
|
|
283
|
-
end
|
|
284
|
-
FileUtils.mkdir_p(path.dirname) unless path.dirname.directory?
|
|
285
|
-
path.open('w') do |f|
|
|
286
|
-
f.write(html)
|
|
287
|
-
end
|
|
288
|
-
path.relative_path_from(outputdir).to_s
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
def create_file(path, skel, sjis_flag = false)
|
|
292
|
-
STDERR.print("creating #{path} ...")
|
|
293
|
-
str = ERB.new(skel).result(binding)
|
|
294
|
-
str = str.tosjis if sjis_flag
|
|
295
|
-
path.open('w') do |f|
|
|
296
|
-
f.write(str)
|
|
297
|
-
end
|
|
298
|
-
STDERR.puts(" done.")
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
main
|
data/tools/bc-tohtml.rb
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
#
|
|
3
|
-
# bc-tohtml.rb
|
|
4
|
-
#
|
|
5
|
-
# Copyright (c) 2006-2007 Minero Aoki
|
|
6
|
-
#
|
|
7
|
-
# This program is free software.
|
|
8
|
-
# You can distribute/modify this program under the Ruby License.
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
require 'pathname'
|
|
12
|
-
|
|
13
|
-
def srcdir_root
|
|
14
|
-
(Pathname.new(__FILE__).realpath.dirname + '..').cleanpath
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
$LOAD_PATH.unshift srcdir_root() + 'lib'
|
|
18
|
-
|
|
19
|
-
$KCODE = 'UTF-8' unless Object.const_defined?(:Encoding)
|
|
20
|
-
|
|
21
|
-
require 'bitclust'
|
|
22
|
-
require 'optparse'
|
|
23
|
-
|
|
24
|
-
def main
|
|
25
|
-
templatedir = srcdir_root() + 'data' + 'bitclust' + 'template.offline'
|
|
26
|
-
target = nil
|
|
27
|
-
baseurl = 'file://' + srcdir_root.to_s
|
|
28
|
-
ver = '1.9.0'
|
|
29
|
-
db = BitClust::MethodDatabase.dummy({'version' => ver})
|
|
30
|
-
parser = OptionParser.new
|
|
31
|
-
parser.banner = "Usage: #{File.basename($0, '.*')} rdfile"
|
|
32
|
-
parser.on('--target=NAME', 'Compile NAME to HTML.') {|name|
|
|
33
|
-
target = name
|
|
34
|
-
}
|
|
35
|
-
parser.on('--force', '-f', 'Force to use rd_file template.') {|name|
|
|
36
|
-
@rd_file = true
|
|
37
|
-
}
|
|
38
|
-
parser.on('--ruby_version=VER', '--ruby=VER', 'Set Ruby version') {|v|
|
|
39
|
-
ver = v
|
|
40
|
-
}
|
|
41
|
-
parser.on('--db=DB', '--database=DB', 'Set database path') {|path|
|
|
42
|
-
db = BitClust::MethodDatabase.new(path)
|
|
43
|
-
}
|
|
44
|
-
parser.on('--baseurl=URL', 'Base URL of generated HTML') {|url|
|
|
45
|
-
baseurl = url
|
|
46
|
-
}
|
|
47
|
-
parser.on('--templatedir=PATH', 'Template directory') {|path|
|
|
48
|
-
templatedir = path
|
|
49
|
-
}
|
|
50
|
-
parser.on('--help', 'Prints this message and quit.') {
|
|
51
|
-
puts parser.help
|
|
52
|
-
exit 0
|
|
53
|
-
}
|
|
54
|
-
parser.on('--capi', 'C API mode.') {
|
|
55
|
-
@capi = true
|
|
56
|
-
}
|
|
57
|
-
begin
|
|
58
|
-
parser.parse!
|
|
59
|
-
rescue OptionParser::ParseError => err
|
|
60
|
-
$stderr.puts err.message
|
|
61
|
-
$stderr.puts parser.help
|
|
62
|
-
exit 1
|
|
63
|
-
end
|
|
64
|
-
if ARGV.size > 1
|
|
65
|
-
$stderr.puts "too many arguments (expected 1)"
|
|
66
|
-
exit 1
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
manager = BitClust::ScreenManager.new(
|
|
70
|
-
:templatedir => templatedir,
|
|
71
|
-
:base_url => baseurl,
|
|
72
|
-
:cgi_url => baseurl,
|
|
73
|
-
:default_encoding => 'utf-8')
|
|
74
|
-
unless @rd_file
|
|
75
|
-
begin
|
|
76
|
-
if @capi
|
|
77
|
-
lib = BitClust::FunctionReferenceParser.parse_file(ARGV[0], {'version' => ver})
|
|
78
|
-
unless target
|
|
79
|
-
raise NotImplementedError, "generating a C API html without --target=NAME is not implemented yet."
|
|
80
|
-
end
|
|
81
|
-
else
|
|
82
|
-
lib = BitClust::RRDParser.parse_stdlib_file(ARGV[0], {'version' => ver})
|
|
83
|
-
end
|
|
84
|
-
entry = target ? lookup(lib, target) : lib
|
|
85
|
-
puts manager.entry_screen(entry, {:database => db}).body
|
|
86
|
-
return
|
|
87
|
-
rescue BitClust::ParseError => ex
|
|
88
|
-
$stderr.puts ex.message
|
|
89
|
-
$stderr.puts ex.backtrace[0], ex.backtrace[1..-1].map{|s| "\tfrom " + s}
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
ent = BitClust::DocEntry.new(db, ARGV[0])
|
|
94
|
-
ret = BitClust::Preprocessor.read(ARGV[0], {'version' => ver})
|
|
95
|
-
ent.source = ret
|
|
96
|
-
puts manager.doc_screen(ent, {:database => db} ).body
|
|
97
|
-
return
|
|
98
|
-
rescue BitClust::WriterError => err
|
|
99
|
-
$stderr.puts err.message
|
|
100
|
-
exit 1
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def lookup(lib, key)
|
|
104
|
-
case
|
|
105
|
-
when @capi && BitClust::NameUtils.functionname?(key)
|
|
106
|
-
lib.find {|func| func.name == key}
|
|
107
|
-
when BitClust::NameUtils.method_spec?(key)
|
|
108
|
-
spec = BitClust::MethodSpec.parse(key)
|
|
109
|
-
if spec.constant?
|
|
110
|
-
begin
|
|
111
|
-
lib.fetch_class(key)
|
|
112
|
-
rescue BitClust::UserError
|
|
113
|
-
lib.fetch_methods(spec)
|
|
114
|
-
end
|
|
115
|
-
else
|
|
116
|
-
lib.fetch_methods(spec)
|
|
117
|
-
end
|
|
118
|
-
when BitClust::NameUtils.classname?(key)
|
|
119
|
-
lib.fetch_class(key)
|
|
120
|
-
else
|
|
121
|
-
raise BitClust::InvalidKey, "wrong search key: #{key.inspect}"
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
main
|
data/tools/bc-tohtmlpackage.rb
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
require 'pathname'
|
|
4
|
-
|
|
5
|
-
def srcdir_root
|
|
6
|
-
(Pathname.new(__FILE__).realpath.dirname + '..').cleanpath
|
|
7
|
-
end
|
|
8
|
-
$LOAD_PATH.unshift srcdir_root() + 'lib'
|
|
9
|
-
|
|
10
|
-
require 'bitclust'
|
|
11
|
-
require 'fileutils'
|
|
12
|
-
require 'optparse'
|
|
13
|
-
|
|
14
|
-
if Object.const_defined?(:Encoding)
|
|
15
|
-
Encoding.default_external = 'utf-8'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
module BitClust
|
|
19
|
-
|
|
20
|
-
class URLMapperEx < URLMapper
|
|
21
|
-
def library_url(name)
|
|
22
|
-
if name == '/'
|
|
23
|
-
$bitclust_html_base + "/library/index.html"
|
|
24
|
-
else
|
|
25
|
-
$bitclust_html_base + "/library/#{encodename_package(name)}.html"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def class_url(name)
|
|
30
|
-
$bitclust_html_base + "/class/#{encodename_package(name)}.html"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def method_url(spec)
|
|
34
|
-
cname, tmark, mname = *split_method_spec(spec)
|
|
35
|
-
$bitclust_html_base +
|
|
36
|
-
"/method/#{encodename_package(cname)}/#{typemark2char(tmark)}/#{encodename_package(mname)}.html"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def function_url(name)
|
|
40
|
-
$bitclust_html_base + "/function/#{name.empty? ? 'index' : name}.html"
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def document_url(name)
|
|
44
|
-
$bitclust_html_base + "/doc/#{encodename_package(name)}.html"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def css_url
|
|
48
|
-
$bitclust_html_base + "/" + @css_url
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def favicon_url
|
|
52
|
-
$bitclust_html_base + "/" + @favicon_url
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def library_index_url
|
|
56
|
-
$bitclust_html_base + "/library/index.html"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def function_index_url
|
|
60
|
-
$bitclust_html_base + "/function/index.html"
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def main
|
|
67
|
-
prefix = Pathname.new('./db')
|
|
68
|
-
outputdir = Pathname.new('./doc')
|
|
69
|
-
templatedir = srcdir_root + 'data'+ 'bitclust' + 'template'
|
|
70
|
-
catalogdir = nil
|
|
71
|
-
verbose = true
|
|
72
|
-
parser = OptionParser.new
|
|
73
|
-
parser.on('-d', '--database=PATH', 'Database prefix') do |path|
|
|
74
|
-
prefix = Pathname.new(path).realpath
|
|
75
|
-
end
|
|
76
|
-
parser.on('-o', '--outputdir=PATH', 'Output directory') do |path|
|
|
77
|
-
begin
|
|
78
|
-
outputdir = Pathname.new(path).realpath
|
|
79
|
-
rescue Errno::ENOENT
|
|
80
|
-
FileUtils.mkdir_p(path, :verbose => verbose)
|
|
81
|
-
retry
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
parser.on('--catalog=PATH', 'Catalog directory') do |path|
|
|
85
|
-
catalogdir = Pathname.new(path).realpath
|
|
86
|
-
end
|
|
87
|
-
parser.on('--templatedir=PATH', 'Template directory') do |path|
|
|
88
|
-
templatedir = Pathname.new(path).realpath
|
|
89
|
-
end
|
|
90
|
-
parser.on('--fs-casesensitive', 'Filesystem is case-sensitive') do
|
|
91
|
-
$fs_casesensitive = true
|
|
92
|
-
end
|
|
93
|
-
parser.on('--[no-]quiet', 'Be quiet') do |quiet|
|
|
94
|
-
verbose = !quiet
|
|
95
|
-
end
|
|
96
|
-
parser.on('--help', 'Prints this message and quit') do
|
|
97
|
-
puts(parser.help)
|
|
98
|
-
exit(0)
|
|
99
|
-
end
|
|
100
|
-
begin
|
|
101
|
-
parser.parse!
|
|
102
|
-
rescue OptionParser::ParseError => err
|
|
103
|
-
STDERR.puts(err.message)
|
|
104
|
-
STDERR.puts(parser.help)
|
|
105
|
-
exit(1)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
manager_config = {
|
|
109
|
-
:catalogdir => catalogdir,
|
|
110
|
-
:suffix => '.html',
|
|
111
|
-
:templatedir => templatedir,
|
|
112
|
-
:themedir => srcdir_root + 'theme' + 'default',
|
|
113
|
-
:css_url => 'style.css',
|
|
114
|
-
:favicon_url => 'rurema.png',
|
|
115
|
-
:cgi_url => '',
|
|
116
|
-
:tochm_mode => true
|
|
117
|
-
}
|
|
118
|
-
manager_config[:urlmapper] = BitClust::URLMapperEx.new(manager_config)
|
|
119
|
-
|
|
120
|
-
db = BitClust::MethodDatabase.new(prefix.to_s)
|
|
121
|
-
fdb = BitClust::FunctionDatabase.new(prefix.to_s)
|
|
122
|
-
manager = BitClust::ScreenManager.new(manager_config)
|
|
123
|
-
db.transaction do
|
|
124
|
-
methods = {}
|
|
125
|
-
db.methods.each_with_index do |entry, i|
|
|
126
|
-
entry.names.each do |name|
|
|
127
|
-
method_name = entry.klass.name + entry.typemark + name
|
|
128
|
-
(methods[method_name] ||= []) << entry
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
entries = db.docs + db.libraries.sort + db.classes.sort
|
|
132
|
-
n = entries.length + methods.length
|
|
133
|
-
entries.each_with_index do |c, i|
|
|
134
|
-
create_html_file(c, manager, outputdir, db)
|
|
135
|
-
$stderr.puts("#{i}/#{n} done") if i % 100 == 0 and verbose
|
|
136
|
-
end
|
|
137
|
-
i = entries.length
|
|
138
|
-
methods.each do |s, ents|
|
|
139
|
-
create_html_method_file(s, ents, manager, outputdir, db)
|
|
140
|
-
$stderr.puts("#{i}/#{n} done") if i % 100 == 0 and verbose
|
|
141
|
-
i += 1
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
fdb.transaction do
|
|
145
|
-
functions = {}
|
|
146
|
-
fdb.functions.each_with_index do |entry, i|
|
|
147
|
-
create_html_file(entry, manager, outputdir, fdb)
|
|
148
|
-
$stderr.puts("#{i} done") if i % 100 == 0 and verbose
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
$bitclust_html_base = '..'
|
|
152
|
-
create_file(outputdir + 'library/index.html',
|
|
153
|
-
manager.library_index_screen(db.libraries.sort, {:database => db}).body,
|
|
154
|
-
:verbose => verbose)
|
|
155
|
-
create_file(outputdir + 'class/index.html',
|
|
156
|
-
manager.class_index_screen(db.classes.sort, {:database => db}).body,
|
|
157
|
-
:verbose => verbose)
|
|
158
|
-
create_file(outputdir + 'function/index.html',
|
|
159
|
-
manager.function_index_screen(fdb.functions.sort, { :database => fdb }).body,
|
|
160
|
-
:verbose => verbose)
|
|
161
|
-
create_index_html(outputdir)
|
|
162
|
-
FileUtils.cp(manager_config[:themedir] + manager_config[:css_url],
|
|
163
|
-
outputdir.to_s, {:verbose => verbose, :preserve => true})
|
|
164
|
-
FileUtils.cp(manager_config[:themedir] + manager_config[:favicon_url],
|
|
165
|
-
outputdir.to_s, {:verbose => verbose, :preserve => true})
|
|
166
|
-
Dir.mktmpdir do |tmpdir|
|
|
167
|
-
FileUtils.cp_r(manager_config[:themedir] + 'images', tmpdir,
|
|
168
|
-
{:verbose => verbose, :preserve => true})
|
|
169
|
-
Dir.glob(File.join(tmpdir, 'images', '/**/.svn')).each do |d|
|
|
170
|
-
FileUtils.rm_r(d, {:verbose => verbose})
|
|
171
|
-
end
|
|
172
|
-
FileUtils.cp_r(File.join(tmpdir, 'images'), outputdir.to_s,
|
|
173
|
-
{:verbose => verbose, :preserve => true})
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
def encodename_package(str)
|
|
178
|
-
if $fs_casesensitive
|
|
179
|
-
BitClust::NameUtils.encodename_url(str)
|
|
180
|
-
else
|
|
181
|
-
BitClust::NameUtils.encodename_fs(str)
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
|
|
185
|
-
def create_index_html(outputdir)
|
|
186
|
-
path = outputdir + 'index.html'
|
|
187
|
-
File.open(path, 'w'){|io|
|
|
188
|
-
io.write <<HERE
|
|
189
|
-
<meta http-equiv="refresh" content="0; URL=doc/index.html">
|
|
190
|
-
<a href="doc/index.html">Go</a>
|
|
191
|
-
HERE
|
|
192
|
-
}
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
def create_html_file(entry, manager, outputdir, db)
|
|
196
|
-
e = entry.is_a?(Array) ? entry.sort.first : entry
|
|
197
|
-
case e.type_id
|
|
198
|
-
when :library, :class, :doc
|
|
199
|
-
$bitclust_html_base = '..'
|
|
200
|
-
path = outputdir + e.type_id.to_s + (encodename_package(e.name) + '.html')
|
|
201
|
-
create_html_file_p(entry, manager, path, db)
|
|
202
|
-
path.relative_path_from(outputdir).to_s
|
|
203
|
-
when :function
|
|
204
|
-
create_html_function_file(entry, manager, outputdir, db)
|
|
205
|
-
else
|
|
206
|
-
raise
|
|
207
|
-
end
|
|
208
|
-
e.unload
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
def create_html_method_file(method_name, entries, manager, outputdir, db)
|
|
212
|
-
path = nil
|
|
213
|
-
$bitclust_html_base = '../../..'
|
|
214
|
-
e = entries.sort.first
|
|
215
|
-
name = method_name.sub(e.klass.name + e.typemark, "")
|
|
216
|
-
path = outputdir + e.type_id.to_s + encodename_package(e.klass.name) +
|
|
217
|
-
e.typechar + (encodename_package(name) + '.html')
|
|
218
|
-
create_html_file_p(entries, manager, path, db)
|
|
219
|
-
path.relative_path_from(outputdir).to_s
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
def create_html_function_file(entry, manager, outputdir, db)
|
|
223
|
-
path = nil
|
|
224
|
-
$bitclust_html_base = '..'
|
|
225
|
-
path = outputdir + entry.type_id.to_s + (entry.name + '.html')
|
|
226
|
-
create_html_file_p(entry, manager, path, db)
|
|
227
|
-
path.relative_path_from(outputdir).to_s
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
def create_html_file_p(entry, manager, path, db)
|
|
231
|
-
FileUtils.mkdir_p(path.dirname) unless path.dirname.directory?
|
|
232
|
-
html = manager.entry_screen(entry, {:database => db}).body
|
|
233
|
-
path.open('w') do |f|
|
|
234
|
-
f.write(html)
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def create_file(path, str, options={})
|
|
239
|
-
verbose = options[:verbose]
|
|
240
|
-
STDERR.print("creating #{path} ...") if verbose
|
|
241
|
-
path.open('w') do |f|
|
|
242
|
-
f.write(str)
|
|
243
|
-
end
|
|
244
|
-
STDERR.puts(" done.") if verbose
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
main
|