bitclust-core 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/ChangeLog +2907 -0
  2. data/Gemfile +7 -0
  3. data/README +21 -0
  4. data/Rakefile +20 -0
  5. data/bin/bitclust +14 -0
  6. data/bin/refe +36 -0
  7. data/bitclust-dev.gemspec +33 -0
  8. data/bitclust.gemspec +30 -0
  9. data/config.in +23 -0
  10. data/config.ru +48 -0
  11. data/config.ru.sample +31 -0
  12. data/data/bitclust/catalog/ja_JP.EUC-JP +78 -0
  13. data/data/bitclust/catalog/ja_JP.UTF-8 +78 -0
  14. data/data/bitclust/template.lillia/class +98 -0
  15. data/data/bitclust/template.lillia/class-index +28 -0
  16. data/data/bitclust/template.lillia/doc +48 -0
  17. data/data/bitclust/template.lillia/layout +19 -0
  18. data/data/bitclust/template.lillia/library +129 -0
  19. data/data/bitclust/template.lillia/library-index +32 -0
  20. data/data/bitclust/template.lillia/method +20 -0
  21. data/data/bitclust/template.lillia/rd_file +6 -0
  22. data/data/bitclust/template.offline/class +67 -0
  23. data/data/bitclust/template.offline/class-index +28 -0
  24. data/data/bitclust/template.offline/doc +13 -0
  25. data/data/bitclust/template.offline/function +22 -0
  26. data/data/bitclust/template.offline/function-index +24 -0
  27. data/data/bitclust/template.offline/layout +18 -0
  28. data/data/bitclust/template.offline/library +87 -0
  29. data/data/bitclust/template.offline/library-index +32 -0
  30. data/data/bitclust/template.offline/method +21 -0
  31. data/data/bitclust/template.offline/rd_file +6 -0
  32. data/data/bitclust/template/class +133 -0
  33. data/data/bitclust/template/class-index +30 -0
  34. data/data/bitclust/template/doc +14 -0
  35. data/data/bitclust/template/function +21 -0
  36. data/data/bitclust/template/function-index +25 -0
  37. data/data/bitclust/template/layout +19 -0
  38. data/data/bitclust/template/library +89 -0
  39. data/data/bitclust/template/library-index +35 -0
  40. data/data/bitclust/template/method +24 -0
  41. data/data/bitclust/template/opensearchdescription +10 -0
  42. data/data/bitclust/template/search +57 -0
  43. data/lib/bitclust.rb +9 -0
  44. data/lib/bitclust/app.rb +129 -0
  45. data/lib/bitclust/classentry.rb +425 -0
  46. data/lib/bitclust/compat.rb +39 -0
  47. data/lib/bitclust/completion.rb +531 -0
  48. data/lib/bitclust/crossrubyutils.rb +91 -0
  49. data/lib/bitclust/database.rb +181 -0
  50. data/lib/bitclust/docentry.rb +83 -0
  51. data/lib/bitclust/entry.rb +223 -0
  52. data/lib/bitclust/exception.rb +38 -0
  53. data/lib/bitclust/functiondatabase.rb +115 -0
  54. data/lib/bitclust/functionentry.rb +81 -0
  55. data/lib/bitclust/functionreferenceparser.rb +76 -0
  56. data/lib/bitclust/htmlutils.rb +80 -0
  57. data/lib/bitclust/interface.rb +87 -0
  58. data/lib/bitclust/libraryentry.rb +211 -0
  59. data/lib/bitclust/lineinput.rb +165 -0
  60. data/lib/bitclust/messagecatalog.rb +95 -0
  61. data/lib/bitclust/methoddatabase.rb +401 -0
  62. data/lib/bitclust/methodentry.rb +202 -0
  63. data/lib/bitclust/methodid.rb +209 -0
  64. data/lib/bitclust/methodsignature.rb +82 -0
  65. data/lib/bitclust/nameutils.rb +236 -0
  66. data/lib/bitclust/parseutils.rb +60 -0
  67. data/lib/bitclust/preprocessor.rb +273 -0
  68. data/lib/bitclust/rdcompiler.rb +507 -0
  69. data/lib/bitclust/refsdatabase.rb +66 -0
  70. data/lib/bitclust/requesthandler.rb +330 -0
  71. data/lib/bitclust/ridatabase.rb +349 -0
  72. data/lib/bitclust/rrdparser.rb +522 -0
  73. data/lib/bitclust/runner.rb +143 -0
  74. data/lib/bitclust/screen.rb +554 -0
  75. data/lib/bitclust/searcher.rb +518 -0
  76. data/lib/bitclust/server.rb +59 -0
  77. data/lib/bitclust/simplesearcher.rb +84 -0
  78. data/lib/bitclust/subcommand.rb +746 -0
  79. data/lib/bitclust/textutils.rb +51 -0
  80. data/lib/bitclust/version.rb +3 -0
  81. data/packer.rb +224 -0
  82. data/refe2.gemspec +29 -0
  83. data/server.exe +0 -0
  84. data/server.exy +159 -0
  85. data/server.rb +10 -0
  86. data/setup.rb +1596 -0
  87. data/standalone.rb +193 -0
  88. data/test/run_test.rb +15 -0
  89. data/test/test_bitclust.rb +81 -0
  90. data/test/test_entry.rb +39 -0
  91. data/test/test_functiondatabase.rb +55 -0
  92. data/test/test_libraryentry.rb +31 -0
  93. data/test/test_methoddatabase.rb +81 -0
  94. data/test/test_methodsignature.rb +14 -0
  95. data/test/test_nameutils.rb +324 -0
  96. data/test/test_preprocessor.rb +84 -0
  97. data/test/test_rdcompiler.rb +534 -0
  98. data/test/test_refsdatabase.rb +76 -0
  99. data/test/test_rrdparser.rb +26 -0
  100. data/test/test_runner.rb +102 -0
  101. data/test/test_simplesearcher.rb +48 -0
  102. data/theme/default/images/external.png +0 -0
  103. data/theme/default/rurema.png +0 -0
  104. data/theme/default/style.css +288 -0
  105. data/theme/default/test.css +254 -0
  106. data/theme/lillia/rurema.png +0 -0
  107. data/theme/lillia/style.css +331 -0
  108. data/theme/lillia/test.css +254 -0
  109. data/tools/bc-ancestors.rb +153 -0
  110. data/tools/bc-checkparams.rb +246 -0
  111. data/tools/bc-classes.rb +80 -0
  112. data/tools/bc-convert.rb +165 -0
  113. data/tools/bc-list.rb +63 -0
  114. data/tools/bc-methods.rb +171 -0
  115. data/tools/bc-preproc.rb +42 -0
  116. data/tools/bc-rdoc.rb +343 -0
  117. data/tools/bc-tochm.rb +301 -0
  118. data/tools/bc-tohtml.rb +125 -0
  119. data/tools/bc-tohtmlpackage.rb +241 -0
  120. data/tools/check-signature.rb +19 -0
  121. data/tools/forall-ruby.rb +20 -0
  122. data/tools/gencatalog.rb +69 -0
  123. data/tools/statrefm.rb +98 -0
  124. data/tools/stattodo.rb +150 -0
  125. data/tools/update-database.rb +146 -0
  126. data/view.cgi +6 -0
  127. metadata +222 -0
@@ -0,0 +1,76 @@
1
+ require 'test/unit'
2
+ require 'bitclust/database'
3
+ require 'bitclust/refsdatabase'
4
+ require 'bitclust/rrdparser'
5
+ require 'stringio'
6
+
7
+ class Test_RefsDatabase < Test::Unit::TestCase
8
+
9
+ S1 = <<HERE
10
+ ===[a:a3] A3
11
+ ====[a:a4] A4
12
+ =====[a:a5] A5
13
+ ======[a:a6] A6
14
+
15
+ = class Hoge
16
+ ===[a:b3] B3
17
+ a a a a
18
+
19
+ ===[a:c3] C3
20
+ ====[a:c4] C4
21
+ =====[a:c5] C5
22
+ ======[a:c6] C6
23
+
24
+ == Class Methods
25
+ --- hoge
26
+ = class Hoge::Bar
27
+ == Class Methods
28
+ --- bar
29
+ ===[a:d3] D3
30
+ ====[a:d4] D4
31
+ =====[a:d5] D5
32
+ ======[a:d6] D6
33
+ = reopen Kernel
34
+ == Special Variables
35
+ --- $spespe
36
+ ===[a:e3] E3
37
+ ====[a:e4] E4
38
+ =====[a:e5] E5
39
+ ======[a:e6] E6
40
+ HERE
41
+
42
+ S2 = <<HERE
43
+ class,klass,linkid,description
44
+ method,method,linkid,description
45
+ method,method,linkid2,des\\,cription
46
+ HERE
47
+
48
+ def test_refs
49
+ refs = BitClust::RefsDatabase.load(StringIO.new(S2))
50
+ assert refs["class", "klass", "linkid"]
51
+ refs["class", "klass", "linkid3"] = "hoge"
52
+ assert_equal( "hoge", refs["class", "klass", "linkid3"] )
53
+ sio = StringIO.new
54
+ assert_nothing_raised do
55
+ refs.save(sio)
56
+ end
57
+ assert_match(/des\\,cription/, sio.string)
58
+ end
59
+
60
+ def test_make_refs
61
+ _, db = BitClust::RRDParser.parse(S1, 'dummy')
62
+ db.make_refs
63
+ ['a3', 'a4', 'a5', 'a6'].each do |s|
64
+ assert_equal(s.upcase, db.refs['library', 'dummy', s])
65
+ end
66
+ ['c3', 'c4', 'c5', 'c6'].each do |s|
67
+ assert_equal(s.upcase, db.refs['class', 'Hoge', s])
68
+ end
69
+ ['d3', 'd4', 'd5', 'd6'].each do |s|
70
+ assert_equal(s.upcase, db.refs['method', 'Hoge::Bar.bar', s])
71
+ end
72
+ ['e3', 'e4', 'e5', 'e6'].each do |s|
73
+ assert_equal(s.upcase, db.refs['method', 'Kernel$spespe', s])
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,26 @@
1
+ require 'bitclust/rrdparser'
2
+ require 'test/unit'
3
+
4
+ class TestRRDParser < Test::Unit::TestCase
5
+ def test_title
6
+ result = BitClust::RRDParser.split_doc <<HERE
7
+ = hoge
8
+ a
9
+ HERE
10
+ assert_equal(["hoge", "a\n"], result)
11
+
12
+ result = BitClust::RRDParser.split_doc <<HERE
13
+ ==foo
14
+ a
15
+ =hoge
16
+ HERE
17
+ assert_equal(["hoge", ""], result)
18
+
19
+
20
+ result = BitClust::RRDParser.split_doc <<HERE
21
+ ==[a:hoge]hoge
22
+ a
23
+ HERE
24
+ assert_equal(["", "==[a:hoge]hoge\na\n"], result)
25
+ end
26
+ end
@@ -0,0 +1,102 @@
1
+ require 'bitclust'
2
+ require 'bitclust/runner'
3
+
4
+ class TestRunner < Test::Unit::TestCase
5
+ def setup
6
+ @runner = BitClust::Runner.new
7
+ home_directory = Pathname(ENV['HOME'])
8
+ @config_path = home_directory + ".bitclust/config"
9
+ @config = {
10
+ :default_version => "1.9.3",
11
+ :database_prefix => "/home/user/.bitclust/db"
12
+ }
13
+ @prefix = "/home/user/.bitclust/db-1.9.3"
14
+ @db = Object.new
15
+ end
16
+
17
+ def test_run_setup
18
+ command = mock(Object.new)
19
+ mock(::BitClust::SetupCommand).new.returns(command)
20
+ command.parse([])
21
+ command.exec(nil, []).returns(nil)
22
+ @runner.run(["setup"])
23
+ end
24
+
25
+ def test_run_server
26
+ command = mock(Object.new)
27
+ mock(::BitClust::ServerCommand).new.returns(command)
28
+ command.parse([])
29
+ command.exec(nil, []).returns(nil)
30
+ @runner.run(["server"])
31
+ end
32
+
33
+ def test_run_init
34
+ command = mock(Object.new)
35
+ mock(::BitClust::InitCommand).new.returns(command)
36
+ mock(@runner).load_config.returns(@config)
37
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
38
+ command.parse(["version=1.9.3", "encoding=utf-8"])
39
+ command.exec(@db, ["version=1.9.3", "encoding=utf-8"]).returns(nil)
40
+ @runner.run(["init", "version=1.9.3", "encoding=utf-8"])
41
+ end
42
+
43
+ def test_run_list
44
+ command = mock(Object.new)
45
+ mock(::BitClust::ListCommand).new.returns(command)
46
+ mock(@runner).load_config.returns(@config)
47
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
48
+ command.parse(["--library"])
49
+ command.exec(@db, ["--library"])
50
+ @runner.run(["list", "--library"])
51
+ end
52
+
53
+ def test_run_lookup
54
+ command = mock(Object.new)
55
+ mock(::BitClust::ListCommand).new.returns(command)
56
+ mock(@runner).load_config.returns(@config)
57
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
58
+ command.parse(["--library=optparse"])
59
+ command.exec(@db, ["--library=optparse"])
60
+ @runner.run(["list", "--library=optparse"])
61
+ end
62
+
63
+ def test_run_searcher
64
+ command = mock(Object.new)
65
+ mock(::BitClust::Searcher).new.returns(command)
66
+ mock(@runner).load_config.returns(@config)
67
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
68
+ command.parse(["String#gsub"])
69
+ command.exec(@db, ["String#gsub"])
70
+ @runner.run(["search", "String#gsub"])
71
+ end
72
+
73
+ def test_run_query
74
+ command = mock(Object.new)
75
+ mock(::BitClust::QueryCommand).new.returns(command)
76
+ mock(@runner).load_config.returns(@config)
77
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
78
+ command.parse(["db.properties"])
79
+ command.exec(@db, ["db.properties"])
80
+ @runner.run(["query", "db.properties"])
81
+ end
82
+
83
+ def test_run_update
84
+ command = mock(Object.new)
85
+ mock(::BitClust::UpdateCommand).new.returns(command)
86
+ mock(@runner).load_config.returns(@config)
87
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
88
+ command.parse(["_builtin/String"])
89
+ command.exec(@db, ["_builtin/String"])
90
+ @runner.run(["update", "_builtin/String"])
91
+ end
92
+
93
+ def test_run_property
94
+ command = mock(Object.new)
95
+ mock(::BitClust::PropertyCommand).new.returns(command)
96
+ mock(@runner).load_config.returns(@config)
97
+ mock(BitClust::MethodDatabase).new(@prefix).returns(@db)
98
+ command.parse(["--list"])
99
+ command.exec(@db, ["--list"])
100
+ @runner.run(["property", "--list"])
101
+ end
102
+ end
@@ -0,0 +1,48 @@
1
+ require 'test/unit'
2
+ require 'bitclust'
3
+ require 'bitclust/simplesearcher'
4
+ require 'optparse'
5
+
6
+
7
+ class TestSearcher < Test::Unit::TestCase
8
+
9
+ def setup
10
+ s = <<HERE
11
+ = class Hoge
12
+ == Class Methods
13
+ --- hoge
14
+ = class Hoge::Bar
15
+ == Class Methods
16
+ --- bar
17
+ = reopen Kernel
18
+ == Special Variables
19
+ --- $spespe
20
+
21
+ --- $/
22
+
23
+ --- $$
24
+ HERE
25
+ _, @db = BitClust::RRDParser.parse(s, 'hoge')
26
+ end
27
+
28
+ include BitClust::SimpleSearcher
29
+ def test_simple_search
30
+ [['Ho', 'Hoge'],
31
+ ['Hoge.h', 'hoge'],
32
+ ['$sp', 'spespe'],
33
+ ['$/', '/'],
34
+ ['$$', '$'],
35
+ ['B.b', 'bar'],
36
+ ['Hoge::B','Hoge::Bar'],
37
+ ['B b', 'bar'],
38
+ [' B b c ','bar'],
39
+ ['b B', 'bar'],
40
+ ].each{|q, expected|
41
+ ret = search_pattern(@db, q)
42
+ assert_not_equal([], ret, q)
43
+ assert_equal(expected, ret[0].name, q)
44
+ }
45
+ assert_equal([], search_pattern(@db, " "), 'space')
46
+ assert_equal([], search_pattern(@db, ""), 'blank')
47
+ end
48
+ end
Binary file
Binary file
@@ -0,0 +1,288 @@
1
+ /*
2
+ default.css
3
+ */
4
+
5
+ body {
6
+ background-color: white;
7
+ color: black;
8
+ font-family: Meiryo, "Hiragino Kaku Gothic Pro", "MS Gothic", Osaka, sans-serif;
9
+ text-align: left;
10
+ margin-top: 20px;
11
+ margin-left: 2%;
12
+ margin-right: 2%;
13
+ line-height: 1.3;
14
+ }
15
+
16
+ /*
17
+ span.menuitem {
18
+ width: 3.9em;
19
+ text-align: center;
20
+ padding: 0px 2px;
21
+ margin: 0px;
22
+ color: white;
23
+ background-color: #ddd;
24
+ margin-right: 2px;
25
+ }
26
+ div.menu a:link,
27
+ div.menu a:visited {
28
+ width: 3.9em;
29
+ padding: 0px 2px;
30
+ margin: 0px;
31
+ color: #33a;
32
+ background-color: #ddd;
33
+ text-decoration: none;
34
+ }
35
+ div.menu a:active,
36
+ div.menu a:focus,
37
+ div.menu a:hover {
38
+ width: 3.9em;
39
+ padding: 0px 2px;
40
+ margin: 0px;
41
+ color: #fff;
42
+ background-color: #33a;
43
+ text-decoration: none;
44
+ }
45
+ span.menuseparator {
46
+ width: 1em;
47
+ padding: 0px;
48
+ margin: 0px;
49
+ }
50
+ */
51
+
52
+ address {
53
+ text-align: right;
54
+ font-size: x-small;
55
+ }
56
+
57
+ h1 {
58
+ font-size: 200%;
59
+ text-align: left;
60
+ color: white;
61
+ background-color: #33a;
62
+ padding: 0.4em;
63
+ margin: 0.2em 0em 0.5em 0em;
64
+ }
65
+
66
+ img.sitelogo {
67
+ vertical-align: middle;
68
+ }
69
+
70
+ h2 {
71
+ font-size: 150%;
72
+ text-align: left;
73
+ border-left: 10px solid #33a;
74
+ padding-left: 0.5em;
75
+ margin-top: 1.5em;
76
+ margin-bottom: 0.5em;
77
+ }
78
+
79
+ h3 {
80
+ font-size: 150%;
81
+ text-align: left;
82
+ margin-top: 0.5em;
83
+ margin-bottom: 0.5em;
84
+ }
85
+
86
+ /* tmp */
87
+ h4 {
88
+ font-size: 120%;
89
+ text-align: left;
90
+ margin-top: 0.5em;
91
+ margin-bottom: 0.5em;
92
+ }
93
+
94
+ /* never use */
95
+ h5, h6 {
96
+ background-color: red;
97
+ }
98
+
99
+ p {
100
+ line-height: 1.4;
101
+ margin-top: 0.5em;
102
+ margin-bottom: 0.5em;
103
+ margin-left: 0px;
104
+ }
105
+
106
+ span.kindinfo {
107
+ text-align: right;
108
+ margin-left: 8em;
109
+ }
110
+
111
+ span.compileerror {
112
+ color: red;
113
+ font-weight: bold;
114
+ }
115
+
116
+ pre {
117
+ line-height: 1.1;
118
+ background-color: #eee;
119
+ padding: 10px;
120
+ font-weight: normal;
121
+ }
122
+
123
+ blockquote {
124
+ background-color: transparent;
125
+ padding: 4px;
126
+ margin-left: 3em;
127
+ font-weight: normal;
128
+ }
129
+
130
+ ul {
131
+ margin-left: 0px;
132
+ padding-left: 2em;
133
+ }
134
+
135
+ li {
136
+ margin-left: 0px;
137
+ padding-left: 0px;
138
+ }
139
+
140
+ ol li {
141
+ margin-bottom: 10px;
142
+ }
143
+
144
+ dl {
145
+ margin-left: 0em;
146
+ }
147
+
148
+ dt {
149
+ font-weight: bold;
150
+ }
151
+
152
+ dl.methodlist dt {
153
+ font-family: sans-serif;
154
+ }
155
+
156
+ dd {
157
+ margin: 0.3em 0em 1em 4em;
158
+ }
159
+
160
+ table {
161
+ border-collapse: collapse;
162
+ }
163
+
164
+ th {
165
+ text-align: left;
166
+ vertical-align: top;
167
+ background-color: #AAC;
168
+ border: 3px solid white;
169
+ padding: 0.3em;
170
+ }
171
+
172
+ td {
173
+ text-align: left;
174
+ vertical-align: top;
175
+ }
176
+
177
+ table.entries {
178
+ width: 100%;
179
+ }
180
+
181
+ table.entries tr {
182
+ /* border: 1px solid gray; */
183
+ text-align: left;
184
+ vertical-align: top;
185
+ }
186
+
187
+ td.signature {
188
+ padding: 0;
189
+ margin: 0;
190
+ background-color: #DDD;
191
+ border: 3px solid white;
192
+ width: 30%;
193
+ height: 100%;
194
+ }
195
+
196
+ td.signature a {
197
+ display: block;
198
+ padding: 0.3em;
199
+ }
200
+
201
+ td.description {
202
+ padding: 0.3em;
203
+ background-color: #EEE;
204
+ border: 3px solid white;
205
+ }
206
+
207
+ td.library {
208
+ width: 6em;
209
+ padding: 0.5em;
210
+ background-color: #DDD;
211
+ border: 3px solid white;
212
+ }
213
+
214
+ code {
215
+ font-family: monospace;
216
+ }
217
+
218
+ a {
219
+ font-weight: bold;
220
+ text-decoration: none;
221
+ }
222
+ a:link {
223
+ color: #33a;
224
+ background-color: transparent;
225
+ }
226
+ a:visited {
227
+ /* color: #666666; */
228
+ color: #33a;
229
+ background-color: transparent;
230
+ }
231
+ a:hover, a:focus, a:active {
232
+ color: #fff;
233
+ background-color: #33a;
234
+ }
235
+
236
+ a.external {
237
+ background: transparent url(images/external.png) no-repeat scroll right center;
238
+ padding: 0 27px 0 0;
239
+ }
240
+
241
+ a.external:visited {
242
+ /* color: #666666; */
243
+ color: #33a;
244
+ background-color: transparent;
245
+ }
246
+ a.external:hover, a.external:focus, a.external:active {
247
+ color: #fff;
248
+ background-color: #33a;
249
+ }
250
+
251
+ form {
252
+ padding: 0px;
253
+ margin: 0px;
254
+ }
255
+
256
+ hr {
257
+ color: #33a;
258
+ height: 1px;
259
+ }
260
+
261
+ @media print {
262
+ body {
263
+ font-family: osaka,'MS Mincho',serif;
264
+ line-height: 1.5;
265
+ }
266
+ div.menu {
267
+ display: none;
268
+ }
269
+ div.footer {
270
+ display: none;
271
+ }
272
+ h1 {
273
+ color: black;
274
+ background-color: white;
275
+ border-bottom: 2px solid #33a;
276
+ padding-bottom: 0em;
277
+ }
278
+ a, a:link, a:visited {
279
+ color: #33a;
280
+ font-weight: normal;
281
+ }
282
+ }
283
+
284
+ #top_search {
285
+ position: absolute;
286
+ top: 15px;
287
+ right: 10px;
288
+ }