gonzui 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.txt +9 -0
- data/History.txt +5539 -0
- data/Manifest.txt +115 -0
- data/PostInstall.txt +17 -0
- data/README.rdoc +149 -0
- data/Rakefile +28 -0
- data/bin/gonzui-db +167 -0
- data/bin/gonzui-import +177 -0
- data/bin/gonzui-remove +58 -0
- data/bin/gonzui-search +68 -0
- data/bin/gonzui-server +176 -0
- data/bin/gonzui-update +53 -0
- data/data/gonzui/catalog/catalog.ja +80 -0
- data/data/gonzui/doc/favicon.ico +0 -0
- data/data/gonzui/doc/folder.png +0 -0
- data/data/gonzui/doc/gonzui.css +279 -0
- data/data/gonzui/doc/gonzui.js +111 -0
- data/data/gonzui/doc/text.png +0 -0
- data/data/gonzuirc.sample +29 -0
- data/ext/autopack/autopack.c +88 -0
- data/ext/autopack/extconf.rb +3 -0
- data/ext/delta/delta.c +147 -0
- data/ext/delta/extconf.rb +5 -0
- data/ext/texttokenizer/extconf.rb +5 -0
- data/ext/texttokenizer/texttokenizer.c +93 -0
- data/ext/xmlformatter/extconf.rb +5 -0
- data/ext/xmlformatter/xmlformatter.c +207 -0
- data/lib/gonzui.rb +59 -0
- data/lib/gonzui/apt.rb +193 -0
- data/lib/gonzui/bdbdbm.rb +118 -0
- data/lib/gonzui/cmdapp.rb +14 -0
- data/lib/gonzui/cmdapp/app.rb +175 -0
- data/lib/gonzui/cmdapp/search.rb +134 -0
- data/lib/gonzui/config.rb +117 -0
- data/lib/gonzui/content.rb +19 -0
- data/lib/gonzui/dbm.rb +673 -0
- data/lib/gonzui/deindexer.rb +162 -0
- data/lib/gonzui/delta.rb +49 -0
- data/lib/gonzui/extractor.rb +347 -0
- data/lib/gonzui/fetcher.rb +309 -0
- data/lib/gonzui/gettext.rb +144 -0
- data/lib/gonzui/importer.rb +84 -0
- data/lib/gonzui/indexer.rb +316 -0
- data/lib/gonzui/info.rb +80 -0
- data/lib/gonzui/license.rb +100 -0
- data/lib/gonzui/logger.rb +48 -0
- data/lib/gonzui/monitor.rb +177 -0
- data/lib/gonzui/progressbar.rb +235 -0
- data/lib/gonzui/remover.rb +38 -0
- data/lib/gonzui/searcher.rb +330 -0
- data/lib/gonzui/searchquery.rb +235 -0
- data/lib/gonzui/searchresult.rb +111 -0
- data/lib/gonzui/updater.rb +254 -0
- data/lib/gonzui/util.rb +415 -0
- data/lib/gonzui/vcs.rb +128 -0
- data/lib/gonzui/webapp.rb +25 -0
- data/lib/gonzui/webapp/advsearch.rb +123 -0
- data/lib/gonzui/webapp/filehandler.rb +24 -0
- data/lib/gonzui/webapp/jsfeed.rb +61 -0
- data/lib/gonzui/webapp/markup.rb +445 -0
- data/lib/gonzui/webapp/search.rb +269 -0
- data/lib/gonzui/webapp/servlet.rb +319 -0
- data/lib/gonzui/webapp/snippet.rb +155 -0
- data/lib/gonzui/webapp/source.rb +37 -0
- data/lib/gonzui/webapp/stat.rb +137 -0
- data/lib/gonzui/webapp/top.rb +63 -0
- data/lib/gonzui/webapp/uri.rb +140 -0
- data/lib/gonzui/webapp/webrick.rb +48 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/makemanifest.rb +21 -0
- data/tasks/extconf.rake +13 -0
- data/tasks/extconf/autopack.rake +43 -0
- data/tasks/extconf/delta.rake +43 -0
- data/tasks/extconf/texttokenizer.rake +43 -0
- data/tasks/extconf/xmlformatter.rake +43 -0
- data/test/_external_tools.rb +13 -0
- data/test/_test-util.rb +142 -0
- data/test/foo/Makefile.foo +66 -0
- data/test/foo/bar.c +5 -0
- data/test/foo/bar.h +6 -0
- data/test/foo/foo.c +25 -0
- data/test/foo/foo.spec +33 -0
- data/test/test_apt.rb +42 -0
- data/test/test_autopack_extn.rb +7 -0
- data/test/test_bdbdbm.rb +79 -0
- data/test/test_cmdapp-app.rb +35 -0
- data/test/test_cmdapp-search.rb +99 -0
- data/test/test_config.rb +28 -0
- data/test/test_content.rb +15 -0
- data/test/test_dbm.rb +171 -0
- data/test/test_deindexer.rb +50 -0
- data/test/test_delta.rb +66 -0
- data/test/test_extractor.rb +78 -0
- data/test/test_fetcher.rb +75 -0
- data/test/test_gettext.rb +50 -0
- data/test/test_gonzui.rb +11 -0
- data/test/test_helper.rb +10 -0
- data/test/test_importer.rb +56 -0
- data/test/test_indexer.rb +37 -0
- data/test/test_info.rb +82 -0
- data/test/test_license.rb +49 -0
- data/test/test_logger.rb +60 -0
- data/test/test_monitor.rb +23 -0
- data/test/test_searcher.rb +37 -0
- data/test/test_searchquery.rb +27 -0
- data/test/test_searchresult.rb +43 -0
- data/test/test_texttokenizer.rb +47 -0
- data/test/test_updater.rb +95 -0
- data/test/test_util.rb +149 -0
- data/test/test_vcs.rb +61 -0
- data/test/test_webapp-markup.rb +42 -0
- data/test/test_webapp-util.rb +19 -0
- data/test/test_webapp-xmlformatter.rb +19 -0
- metadata +291 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require '_test-util'
|
4
|
+
|
5
|
+
class TextTokenizerTest < Test::Unit::TestCase
|
6
|
+
include TestUtil
|
7
|
+
|
8
|
+
def _test_collect(text)
|
9
|
+
list = []
|
10
|
+
Gonzui::TextTokenizer.each_word(text) {|word, pos|
|
11
|
+
assert(word.is_a?(String))
|
12
|
+
assert(pos.is_a?(Integer))
|
13
|
+
list.push([word, pos])
|
14
|
+
}
|
15
|
+
return list
|
16
|
+
end
|
17
|
+
|
18
|
+
def _test_with_words(words, delim)
|
19
|
+
text = words.join(delim)
|
20
|
+
list = _test_collect(text)
|
21
|
+
|
22
|
+
pos = 0
|
23
|
+
words.each_with_index {|word, i|
|
24
|
+
assert_equal(word, list[i][0])
|
25
|
+
assert_equal(pos, list[i][1])
|
26
|
+
pos += word.length + delim.length
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def _test_text(text, n)
|
31
|
+
list = _test_collect(text)
|
32
|
+
assert_equal(n, list.length)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_each
|
36
|
+
words = ["foo", "bar", "baz"]
|
37
|
+
_test_with_words(words, " ")
|
38
|
+
_test_with_words(words, "\n")
|
39
|
+
_test_with_words(words, ", ")
|
40
|
+
_test_with_words(words, ",\n")
|
41
|
+
_test_with_words(words, "!#%&\n\n\n@@")
|
42
|
+
|
43
|
+
_test_text("foo_bar", 1)
|
44
|
+
_test_text("あ", 1) # single multi-byte character
|
45
|
+
_test_text("あい", 2) # two multi-byte characters
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require '_test-util'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
class UpdaterTest < Test::Unit::TestCase
|
7
|
+
include TestUtil
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@dbm = nil
|
11
|
+
@config = Gonzui::Config.new
|
12
|
+
end
|
13
|
+
def teardown
|
14
|
+
unless @dbm.nil?
|
15
|
+
@dbm.close rescue nil
|
16
|
+
end
|
17
|
+
@dbm = nil
|
18
|
+
remove_db(@config)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_update
|
22
|
+
remove_db(@config)
|
23
|
+
tmp_dir = File.expand_path(
|
24
|
+
File.join(File.dirname(__FILE__), "tmp.update"))
|
25
|
+
#tmp_dir = File.expand_path("tmp.update")
|
26
|
+
FileUtils.rm_rf(tmp_dir)
|
27
|
+
FileUtils.mkdir(tmp_dir)
|
28
|
+
tmp_file1 = File.join(tmp_dir, "foo.txt")
|
29
|
+
tmp_file2 = File.join(tmp_dir, "bar.txt")
|
30
|
+
File.open(tmp_file1, "w") {|f| f.puts("foo") }
|
31
|
+
|
32
|
+
dbm = Gonzui::DBM.open(@config)
|
33
|
+
@dbm = dbm
|
34
|
+
url = URI.from_path(File.expand_path(tmp_file1))
|
35
|
+
content = Gonzui::Content.new(File.read(tmp_file1), File.mtime(tmp_file1))
|
36
|
+
source_url = URI.parse(sprintf("file://%s", tmp_dir))
|
37
|
+
indexer = Gonzui::Indexer.new(@config, dbm, source_url, tmp_file1, content)
|
38
|
+
indexer.index
|
39
|
+
dbm.flush_cache
|
40
|
+
assert_equal(1, dbm.get_ncontents)
|
41
|
+
assert(dbm.has_word?("foo"))
|
42
|
+
assert_equal(false, dbm.has_word?("bar"))
|
43
|
+
assert(dbm.consistent?)
|
44
|
+
|
45
|
+
File.open(tmp_file1, "w") {|f| f.puts("bar") }
|
46
|
+
updater = Gonzui::Updater.new(@config)
|
47
|
+
begin
|
48
|
+
updater.update
|
49
|
+
dbm.flush_cache
|
50
|
+
assert_equal(1, dbm.get_npackages)
|
51
|
+
assert_equal(1, dbm.get_ncontents)
|
52
|
+
assert_equal(1, dbm.get_nwords)
|
53
|
+
assert_equal(false, dbm.has_word?("foo"))
|
54
|
+
assert(dbm.has_word?("bar"))
|
55
|
+
assert(dbm.consistent?)
|
56
|
+
ensure
|
57
|
+
updater.finish
|
58
|
+
end
|
59
|
+
|
60
|
+
File.open(tmp_file2, "w") {|f| f.puts("baz") }
|
61
|
+
updater = Gonzui::Updater.new(@config)
|
62
|
+
begin
|
63
|
+
updater.update
|
64
|
+
dbm.flush_cache
|
65
|
+
assert_equal(1, dbm.get_npackages)
|
66
|
+
assert_equal(2, dbm.get_ncontents)
|
67
|
+
assert_equal(2, dbm.get_nwords)
|
68
|
+
assert(dbm.has_word?("bar"))
|
69
|
+
assert(dbm.has_word?("baz"))
|
70
|
+
assert(dbm.consistent?)
|
71
|
+
ensure
|
72
|
+
updater.finish
|
73
|
+
end
|
74
|
+
|
75
|
+
FileUtils.rm_rf(tmp_file1)
|
76
|
+
FileUtils.rm_rf(tmp_file2)
|
77
|
+
updater = Gonzui::Updater.new(@config)
|
78
|
+
begin
|
79
|
+
updater.update
|
80
|
+
dbm.flush_cache
|
81
|
+
assert_equal(0, dbm.get_npackages)
|
82
|
+
assert_equal(0, dbm.get_ncontents)
|
83
|
+
assert_equal(0, dbm.get_nwords)
|
84
|
+
assert_equal(false, dbm.has_word?("foo"))
|
85
|
+
assert_equal(false, dbm.has_word?("bar"))
|
86
|
+
assert_equal(false, dbm.has_word?("baz"))
|
87
|
+
assert(dbm.consistent?)
|
88
|
+
ensure
|
89
|
+
updater.finish
|
90
|
+
end
|
91
|
+
|
92
|
+
FileUtils.rm_rf(tmp_dir)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
data/test/test_util.rb
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require 'ftools'
|
4
|
+
require 'fileutils'
|
5
|
+
require '_test-util'
|
6
|
+
|
7
|
+
class UtilTest < Test::Unit::TestCase
|
8
|
+
include FileUtils
|
9
|
+
include Gonzui::Util
|
10
|
+
|
11
|
+
def test_string_methods
|
12
|
+
assert_equal("oo", "foo".prechop)
|
13
|
+
assert_equal("", "".prechop)
|
14
|
+
assert_equal(0...3, "foo\nbar\nbaz\n".line_range(0))
|
15
|
+
assert_equal(0...3, "foo\nbar\nbaz\n".line_range(2))
|
16
|
+
assert_equal(4...7, "foo\nbar\nbaz\n".line_range(4))
|
17
|
+
|
18
|
+
"foo\nbar\nbaz\n".each_line_range(4, 1) {|lineno_offset, range|
|
19
|
+
case lineno_offset
|
20
|
+
when -1
|
21
|
+
assert_equal(0...3, range)
|
22
|
+
when 0
|
23
|
+
assert_equal(4...7, range)
|
24
|
+
when 1
|
25
|
+
assert_equal(8...11, range)
|
26
|
+
else
|
27
|
+
assert(false)
|
28
|
+
end
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_dir_methods
|
33
|
+
rm_rf("t")
|
34
|
+
File.mkpath("t")
|
35
|
+
assert_equal([], Dir.entries_without_dots("t"))
|
36
|
+
|
37
|
+
touch(["t/a", "t/b"])
|
38
|
+
assert_equal(["a", "b"], Dir.entries_without_dots("t"))
|
39
|
+
|
40
|
+
File.mkpath("t/t")
|
41
|
+
assert_equal(["a", "b", "t"], Dir.entries_without_dots("t"))
|
42
|
+
|
43
|
+
touch(["t/t/c"])
|
44
|
+
assert_equal(["t/a", "t/b", "t/t/c", ], Dir.all_files("t"))
|
45
|
+
rm_rf("t")
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_file_methods
|
49
|
+
assert_equal("bar", File.relative_path("/foo/bar", "/foo"))
|
50
|
+
assert_equal("foo", File.relative_path("/foo", "/"))
|
51
|
+
assert_equal("", File.relative_path("/foo", "/foo"))
|
52
|
+
assert(File.any_exist?("/"))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_command_operations
|
56
|
+
unless windows?
|
57
|
+
assert(command_exist?("sh"))
|
58
|
+
assert(require_command("sh"))
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_shell_escape
|
63
|
+
assert_equal('"foo"', shell_escape('foo'))
|
64
|
+
if (/mswin|mingw|bccwin/ =~ RUBY_PLATFORM)
|
65
|
+
assert_equal('"c:\\temp"', shell_escape('c:/temp'))
|
66
|
+
assert_equal('"file:///c:/temp"', shell_escape('file://c:/temp'))
|
67
|
+
assert_equal('"file:///c:/temp"', shell_escape('file:///c:/temp'))
|
68
|
+
else
|
69
|
+
assert_equal('"\\$foo"', shell_escape('$foo'))
|
70
|
+
assert_equal('"\\`foo\\`"', shell_escape('`foo`'))
|
71
|
+
assert_equal('"foo\\\\bar"', shell_escape('foo\\bar'))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_commify
|
76
|
+
assert_equal("1", commify(1))
|
77
|
+
assert_equal("12", commify(12))
|
78
|
+
assert_equal("123", commify(123))
|
79
|
+
assert_equal("1,234", commify(1234))
|
80
|
+
assert_equal("12,345", commify(12345))
|
81
|
+
assert_equal("123,456", commify(123456))
|
82
|
+
assert_equal("1,234,567", commify(1234567))
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_temporary_directory_util
|
86
|
+
foo = Object.new
|
87
|
+
foo.extend(Gonzui::TemporaryDirectoryUtil)
|
88
|
+
foo.set_temporary_directory(".")
|
89
|
+
foo.prepare_temporary_directory
|
90
|
+
begin
|
91
|
+
foo.prepare_temporary_directory
|
92
|
+
assert(false)
|
93
|
+
rescue
|
94
|
+
assert(true)
|
95
|
+
end
|
96
|
+
assert(File.directory?(foo.temporary_directory))
|
97
|
+
foo.clean_temporary_directory
|
98
|
+
assert_equal(false, File.exist?(foo.temporary_directory))
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_utf8
|
102
|
+
str, name = Gonzui::UTF8.to_utf8("foo")
|
103
|
+
assert_equal("foo", str)
|
104
|
+
assert_equal("us-ascii", name)
|
105
|
+
|
106
|
+
|
107
|
+
utf8 = "日本語です"
|
108
|
+
["shift_jis", "euc-jp", "iso-2022-jp"].each {|name|
|
109
|
+
str = Iconv.conv(name, "utf-8", utf8)
|
110
|
+
s, n = Gonzui::UTF8.to_utf8(str)
|
111
|
+
assert_equal(name, n)
|
112
|
+
assert_equal(utf8, s)
|
113
|
+
}
|
114
|
+
end
|
115
|
+
|
116
|
+
def text_windows_path
|
117
|
+
# drive leter
|
118
|
+
path = "C:\\WINDOWS\\"
|
119
|
+
r = from_path(path)
|
120
|
+
assert_equal("C:", r.host)
|
121
|
+
assert_equal("\\WINDOWS\\", r.path)
|
122
|
+
assert_equal(path, r.to_s)
|
123
|
+
|
124
|
+
path = "C:/WINDOWS/"
|
125
|
+
r = from_path(path)
|
126
|
+
assert_equal("C:", r.host)
|
127
|
+
assert_equal("/WINDOWS/", r.path)
|
128
|
+
|
129
|
+
path = "C:/WINDOWS"
|
130
|
+
r = from_path(path)
|
131
|
+
assert_equal("C:", r.host)
|
132
|
+
assert_equal("/WINDOWS", r.path)
|
133
|
+
|
134
|
+
# space
|
135
|
+
path = "C:\\Documents and Settings\\"
|
136
|
+
r = from_path(path)
|
137
|
+
assert_equal("C:", r.host)
|
138
|
+
assert_equal("\\Documents and Settings\\", r.path)
|
139
|
+
assert_equal(path, r.to_s)
|
140
|
+
|
141
|
+
# extend
|
142
|
+
path = "\\\\?\\C:\\WINDOWS\\"
|
143
|
+
r = from_path(path)
|
144
|
+
assert_equal("\\\\", r.host)
|
145
|
+
assert_equal("?\\C:\\WINDOWS\\", r.path)
|
146
|
+
assert_equal(path, r.to_s)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
data/test/test_vcs.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require '_external_tools'
|
4
|
+
require 'ftools'
|
5
|
+
require '_test-util'
|
6
|
+
|
7
|
+
class VCSTest < Test::Unit::TestCase
|
8
|
+
include TestUtil
|
9
|
+
include Gonzui::Util
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
remove_db(Gonzui::Config.new)
|
13
|
+
end
|
14
|
+
|
15
|
+
def prepare
|
16
|
+
make_dist_tree
|
17
|
+
config = Gonzui::Config.new
|
18
|
+
config.quiet = true
|
19
|
+
remove_db(config)
|
20
|
+
return config
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_cvs
|
24
|
+
config = prepare
|
25
|
+
make_cvs
|
26
|
+
cvs = Gonzui::CVS.new(config, cvsroot, "foo")
|
27
|
+
cvs.extract
|
28
|
+
cached_foo = File.join(config.cache_directory, "foo")
|
29
|
+
entries = Dir.entries_without_dots(cached_foo)
|
30
|
+
FOO_FILES.each {|base_name|
|
31
|
+
assert(entries.include?(base_name))
|
32
|
+
}
|
33
|
+
remove_cvs
|
34
|
+
end if (CVS_)
|
35
|
+
|
36
|
+
def test_svn
|
37
|
+
config = prepare
|
38
|
+
svnroot_uri = make_svn
|
39
|
+
svn = Gonzui::Subversion.new(config, svnroot_uri, "foo")
|
40
|
+
svn.extract
|
41
|
+
cached_foo = File.join(config.cache_directory, "foo")
|
42
|
+
entries = Dir.entries_without_dots(cached_foo)
|
43
|
+
FOO_FILES.each {|base_name|
|
44
|
+
assert(entries.include?(base_name))
|
45
|
+
}
|
46
|
+
remove_svn
|
47
|
+
end if (SVN_)
|
48
|
+
|
49
|
+
def test_git
|
50
|
+
config = prepare
|
51
|
+
gitroot = make_git
|
52
|
+
git = Gonzui::Git.new(config, gitroot, "foo")
|
53
|
+
git.extract
|
54
|
+
cached_foo = File.join(config.cache_directory, File.basename(gitroot))
|
55
|
+
entries = Dir.entries_without_dots(cached_foo)
|
56
|
+
FOO_FILES.each {|base_name|
|
57
|
+
assert(entries.include?(base_name))
|
58
|
+
}
|
59
|
+
remove_git
|
60
|
+
end if (GIT_)
|
61
|
+
end if (CVS_ || SVN_ || GIT_)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require '_external_tools.rb'
|
4
|
+
require 'gonzui/webapp'
|
5
|
+
require '_test-util'
|
6
|
+
|
7
|
+
class TextBeautifierTest < Test::Unit::TestCase
|
8
|
+
include TestUtil
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@dbm = nil
|
12
|
+
end
|
13
|
+
def teardown
|
14
|
+
unless @dbm.nil?
|
15
|
+
@dbm.close rescue nil
|
16
|
+
end
|
17
|
+
@dbm = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def init_dbm(config)
|
21
|
+
remove_db(config)
|
22
|
+
make_archives
|
23
|
+
add_package(config)
|
24
|
+
dbm = Gonzui::DBM.open(config)
|
25
|
+
@dbm = dbm
|
26
|
+
return dbm
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_beautify
|
30
|
+
config = Gonzui::Config.new
|
31
|
+
dbm = init_dbm(config)
|
32
|
+
path_id = dbm.get_path_id("foo-0.1/foo.c")
|
33
|
+
assert(path_id.is_a?(Fixnum))
|
34
|
+
content = dbm.get_content(path_id)
|
35
|
+
digest = dbm.get_digest(path_id)
|
36
|
+
beautifier = Gonzui::TextBeautifier.new(content, digest, [], "search?q=")
|
37
|
+
html = beautifier.beautify
|
38
|
+
assert(html.is_a?(Array))
|
39
|
+
assert(html.flatten.include?(:span))
|
40
|
+
remove_db(config)
|
41
|
+
end
|
42
|
+
end if (ARC_)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require 'gonzui/webapp/xmlformatter'
|
4
|
+
require '_test-util'
|
5
|
+
|
6
|
+
class UtilTest < Test::Unit::TestCase
|
7
|
+
def test_format_xml
|
8
|
+
html = [:html]
|
9
|
+
head = [:head, [:title, "foo"]]
|
10
|
+
body = [:body, [:h1, [:a, {:href => 'foo<&">.html'}, 'foo<&">']]]
|
11
|
+
body.push([:p, "hello"])
|
12
|
+
html.push(head)
|
13
|
+
html.push(body)
|
14
|
+
formatter = Gonzui::XMLFormatter.new
|
15
|
+
result = formatter.format(html)
|
16
|
+
assert_equal("<html\n><head\n><title\n>foo</title\n></head\n><body\n><h1\n><a href=\"foo<&">.html\"\n>foo<&"></a\n></h1\n><p\n>hello</p\n></body\n></html\n>",
|
17
|
+
result)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
require 'gonzui/webapp/xmlformatter'
|
4
|
+
require '_test-util'
|
5
|
+
|
6
|
+
class XMLFormatterTest < Test::Unit::TestCase
|
7
|
+
def test_format_xml
|
8
|
+
html = [:html]
|
9
|
+
head = [:head, [:title, "foo"]]
|
10
|
+
body = [:body, [:h1, [:a, {:href => 'foo<&">.html'}, 'foo<&">']]]
|
11
|
+
body.push([:p, "hello"])
|
12
|
+
html.push(head)
|
13
|
+
html.push(body)
|
14
|
+
formatter = Gonzui::XMLFormatter.new
|
15
|
+
result = formatter.format(html)
|
16
|
+
assert_equal("<html\n><head\n><title\n>foo</title\n></head\n><body\n><h1\n><a href=\"foo<&">.html\"\n>foo<&"></a\n></h1\n><p\n>hello</p\n></body\n></html\n>",
|
17
|
+
result)
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,291 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gonzui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
version: "1.2"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- mallowlabs
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-15 00:00:00 +09:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: langscan
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 11
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 2
|
32
|
+
version: "1.2"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rubyforge
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 7
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 0
|
47
|
+
- 4
|
48
|
+
version: 2.0.4
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: hoe
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 21
|
60
|
+
segments:
|
61
|
+
- 2
|
62
|
+
- 6
|
63
|
+
- 1
|
64
|
+
version: 2.6.1
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
description: gonzui is a source code search engine for accelerating open source software development. In the open source software development, programmers frequently refer to source codes written by others. Our goal is to help programmers develop programs effectively by creating a source code search engine that covers vast quantities of open source codes available on the Internet.
|
68
|
+
email:
|
69
|
+
- mallowlabs@gmail.com
|
70
|
+
executables:
|
71
|
+
- gonzui-db
|
72
|
+
- gonzui-import
|
73
|
+
- gonzui-remove
|
74
|
+
- gonzui-search
|
75
|
+
- gonzui-server
|
76
|
+
- gonzui-update
|
77
|
+
extensions:
|
78
|
+
- ext/autopack/extconf.rb
|
79
|
+
- ext/delta/extconf.rb
|
80
|
+
- ext/texttokenizer/extconf.rb
|
81
|
+
- ext/xmlformatter/extconf.rb
|
82
|
+
extra_rdoc_files:
|
83
|
+
- AUTHORS.txt
|
84
|
+
- History.txt
|
85
|
+
- Manifest.txt
|
86
|
+
- PostInstall.txt
|
87
|
+
files:
|
88
|
+
- AUTHORS.txt
|
89
|
+
- History.txt
|
90
|
+
- Manifest.txt
|
91
|
+
- PostInstall.txt
|
92
|
+
- README.rdoc
|
93
|
+
- Rakefile
|
94
|
+
- bin/gonzui-db
|
95
|
+
- bin/gonzui-import
|
96
|
+
- bin/gonzui-remove
|
97
|
+
- bin/gonzui-search
|
98
|
+
- bin/gonzui-server
|
99
|
+
- bin/gonzui-update
|
100
|
+
- data/gonzui/catalog/catalog.ja
|
101
|
+
- data/gonzui/doc/favicon.ico
|
102
|
+
- data/gonzui/doc/folder.png
|
103
|
+
- data/gonzui/doc/gonzui.css
|
104
|
+
- data/gonzui/doc/gonzui.js
|
105
|
+
- data/gonzui/doc/text.png
|
106
|
+
- data/gonzuirc.sample
|
107
|
+
- ext/autopack/autopack.c
|
108
|
+
- ext/autopack/extconf.rb
|
109
|
+
- ext/delta/delta.c
|
110
|
+
- ext/delta/extconf.rb
|
111
|
+
- ext/texttokenizer/extconf.rb
|
112
|
+
- ext/texttokenizer/texttokenizer.c
|
113
|
+
- ext/xmlformatter/extconf.rb
|
114
|
+
- ext/xmlformatter/xmlformatter.c
|
115
|
+
- lib/gonzui.rb
|
116
|
+
- lib/gonzui/apt.rb
|
117
|
+
- lib/gonzui/bdbdbm.rb
|
118
|
+
- lib/gonzui/cmdapp.rb
|
119
|
+
- lib/gonzui/cmdapp/app.rb
|
120
|
+
- lib/gonzui/cmdapp/search.rb
|
121
|
+
- lib/gonzui/config.rb
|
122
|
+
- lib/gonzui/content.rb
|
123
|
+
- lib/gonzui/dbm.rb
|
124
|
+
- lib/gonzui/deindexer.rb
|
125
|
+
- lib/gonzui/delta.rb
|
126
|
+
- lib/gonzui/extractor.rb
|
127
|
+
- lib/gonzui/fetcher.rb
|
128
|
+
- lib/gonzui/gettext.rb
|
129
|
+
- lib/gonzui/importer.rb
|
130
|
+
- lib/gonzui/indexer.rb
|
131
|
+
- lib/gonzui/info.rb
|
132
|
+
- lib/gonzui/license.rb
|
133
|
+
- lib/gonzui/logger.rb
|
134
|
+
- lib/gonzui/monitor.rb
|
135
|
+
- lib/gonzui/progressbar.rb
|
136
|
+
- lib/gonzui/remover.rb
|
137
|
+
- lib/gonzui/searcher.rb
|
138
|
+
- lib/gonzui/searchquery.rb
|
139
|
+
- lib/gonzui/searchresult.rb
|
140
|
+
- lib/gonzui/updater.rb
|
141
|
+
- lib/gonzui/util.rb
|
142
|
+
- lib/gonzui/vcs.rb
|
143
|
+
- lib/gonzui/webapp.rb
|
144
|
+
- lib/gonzui/webapp/advsearch.rb
|
145
|
+
- lib/gonzui/webapp/filehandler.rb
|
146
|
+
- lib/gonzui/webapp/jsfeed.rb
|
147
|
+
- lib/gonzui/webapp/markup.rb
|
148
|
+
- lib/gonzui/webapp/search.rb
|
149
|
+
- lib/gonzui/webapp/servlet.rb
|
150
|
+
- lib/gonzui/webapp/snippet.rb
|
151
|
+
- lib/gonzui/webapp/source.rb
|
152
|
+
- lib/gonzui/webapp/stat.rb
|
153
|
+
- lib/gonzui/webapp/top.rb
|
154
|
+
- lib/gonzui/webapp/uri.rb
|
155
|
+
- lib/gonzui/webapp/webrick.rb
|
156
|
+
- script/console
|
157
|
+
- script/destroy
|
158
|
+
- script/generate
|
159
|
+
- script/makemanifest.rb
|
160
|
+
- tasks/extconf.rake
|
161
|
+
- tasks/extconf/autopack.rake
|
162
|
+
- tasks/extconf/delta.rake
|
163
|
+
- tasks/extconf/texttokenizer.rake
|
164
|
+
- tasks/extconf/xmlformatter.rake
|
165
|
+
- test/_external_tools.rb
|
166
|
+
- test/_test-util.rb
|
167
|
+
- test/foo/Makefile.foo
|
168
|
+
- test/foo/bar.c
|
169
|
+
- test/foo/bar.h
|
170
|
+
- test/foo/foo.c
|
171
|
+
- test/foo/foo.spec
|
172
|
+
- test/test_apt.rb
|
173
|
+
- test/test_autopack_extn.rb
|
174
|
+
- test/test_bdbdbm.rb
|
175
|
+
- test/test_cmdapp-app.rb
|
176
|
+
- test/test_cmdapp-search.rb
|
177
|
+
- test/test_config.rb
|
178
|
+
- test/test_content.rb
|
179
|
+
- test/test_dbm.rb
|
180
|
+
- test/test_deindexer.rb
|
181
|
+
- test/test_delta.rb
|
182
|
+
- test/test_extractor.rb
|
183
|
+
- test/test_fetcher.rb
|
184
|
+
- test/test_gettext.rb
|
185
|
+
- test/test_gonzui.rb
|
186
|
+
- test/test_helper.rb
|
187
|
+
- test/test_importer.rb
|
188
|
+
- test/test_indexer.rb
|
189
|
+
- test/test_info.rb
|
190
|
+
- test/test_license.rb
|
191
|
+
- test/test_logger.rb
|
192
|
+
- test/test_monitor.rb
|
193
|
+
- test/test_searcher.rb
|
194
|
+
- test/test_searchquery.rb
|
195
|
+
- test/test_searchresult.rb
|
196
|
+
- test/test_texttokenizer.rb
|
197
|
+
- test/test_updater.rb
|
198
|
+
- test/test_util.rb
|
199
|
+
- test/test_vcs.rb
|
200
|
+
- test/test_webapp-markup.rb
|
201
|
+
- test/test_webapp-util.rb
|
202
|
+
- test/test_webapp-xmlformatter.rb
|
203
|
+
has_rdoc: true
|
204
|
+
homepage: http://gonzui.sourceforge.net/index.html.en
|
205
|
+
licenses: []
|
206
|
+
|
207
|
+
post_install_message: |
|
208
|
+
Welcome to gonzui!
|
209
|
+
|
210
|
+
First, you need to install Berkley DB 4.7 and
|
211
|
+
bdb for ruby (http://raa.ruby-lang.org/project/bdb/).
|
212
|
+
If you use Ubuntu linux, only type following commands.
|
213
|
+
$ sudo apt-get install libdb-dev
|
214
|
+
$ sudo apt-get install libdb-ruby1.8
|
215
|
+
|
216
|
+
First step:
|
217
|
+
$ mkdir gonzui
|
218
|
+
$ cd gonzui
|
219
|
+
$ gonzui-import path/to/project
|
220
|
+
$ gonzui-server
|
221
|
+
Access to http://localhost:46984/ and enjoy!
|
222
|
+
|
223
|
+
More information:
|
224
|
+
See README.rdoc
|
225
|
+
|
226
|
+
rdoc_options:
|
227
|
+
- --main
|
228
|
+
- README.rdoc
|
229
|
+
require_paths:
|
230
|
+
- lib
|
231
|
+
- ext/autopack
|
232
|
+
- ext/delta
|
233
|
+
- ext/texttokenizer
|
234
|
+
- ext/xmlformatter
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
hash: 3
|
241
|
+
segments:
|
242
|
+
- 0
|
243
|
+
version: "0"
|
244
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
|
+
none: false
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
hash: 3
|
250
|
+
segments:
|
251
|
+
- 0
|
252
|
+
version: "0"
|
253
|
+
requirements: []
|
254
|
+
|
255
|
+
rubyforge_project: gonzui
|
256
|
+
rubygems_version: 1.3.7
|
257
|
+
signing_key:
|
258
|
+
specification_version: 3
|
259
|
+
summary: gonzui is a source code search engine for accelerating open source software development
|
260
|
+
test_files:
|
261
|
+
- test/test_apt.rb
|
262
|
+
- test/test_autopack_extn.rb
|
263
|
+
- test/test_bdbdbm.rb
|
264
|
+
- test/test_cmdapp-app.rb
|
265
|
+
- test/test_cmdapp-search.rb
|
266
|
+
- test/test_config.rb
|
267
|
+
- test/test_content.rb
|
268
|
+
- test/test_dbm.rb
|
269
|
+
- test/test_deindexer.rb
|
270
|
+
- test/test_delta.rb
|
271
|
+
- test/test_extractor.rb
|
272
|
+
- test/test_fetcher.rb
|
273
|
+
- test/test_gettext.rb
|
274
|
+
- test/test_gonzui.rb
|
275
|
+
- test/test_helper.rb
|
276
|
+
- test/test_importer.rb
|
277
|
+
- test/test_indexer.rb
|
278
|
+
- test/test_info.rb
|
279
|
+
- test/test_license.rb
|
280
|
+
- test/test_logger.rb
|
281
|
+
- test/test_monitor.rb
|
282
|
+
- test/test_searcher.rb
|
283
|
+
- test/test_searchquery.rb
|
284
|
+
- test/test_searchresult.rb
|
285
|
+
- test/test_texttokenizer.rb
|
286
|
+
- test/test_updater.rb
|
287
|
+
- test/test_util.rb
|
288
|
+
- test/test_vcs.rb
|
289
|
+
- test/test_webapp-markup.rb
|
290
|
+
- test/test_webapp-util.rb
|
291
|
+
- test/test_webapp-xmlformatter.rb
|