gonzui 1.2-x86-mswin32-60

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.
Files changed (120) hide show
  1. data/AUTHORS.txt +9 -0
  2. data/History.txt +5539 -0
  3. data/Manifest.txt +115 -0
  4. data/PostInstall.txt +17 -0
  5. data/README.rdoc +149 -0
  6. data/Rakefile +28 -0
  7. data/bin/gonzui-db +167 -0
  8. data/bin/gonzui-import +177 -0
  9. data/bin/gonzui-remove +58 -0
  10. data/bin/gonzui-search +68 -0
  11. data/bin/gonzui-server +176 -0
  12. data/bin/gonzui-update +53 -0
  13. data/data/gonzui/catalog/catalog.ja +80 -0
  14. data/data/gonzui/doc/favicon.ico +0 -0
  15. data/data/gonzui/doc/folder.png +0 -0
  16. data/data/gonzui/doc/gonzui.css +279 -0
  17. data/data/gonzui/doc/gonzui.js +111 -0
  18. data/data/gonzui/doc/text.png +0 -0
  19. data/data/gonzuirc.sample +29 -0
  20. data/ext/autopack/autopack.c +88 -0
  21. data/ext/autopack/extconf.rb +3 -0
  22. data/ext/delta/delta.c +147 -0
  23. data/ext/delta/extconf.rb +5 -0
  24. data/ext/texttokenizer/extconf.rb +5 -0
  25. data/ext/texttokenizer/texttokenizer.c +93 -0
  26. data/ext/xmlformatter/extconf.rb +5 -0
  27. data/ext/xmlformatter/xmlformatter.c +207 -0
  28. data/lib/gonzui.rb +59 -0
  29. data/lib/gonzui/apt.rb +193 -0
  30. data/lib/gonzui/autopack.so +0 -0
  31. data/lib/gonzui/bdbdbm.rb +118 -0
  32. data/lib/gonzui/cmdapp.rb +14 -0
  33. data/lib/gonzui/cmdapp/app.rb +175 -0
  34. data/lib/gonzui/cmdapp/search.rb +134 -0
  35. data/lib/gonzui/config.rb +117 -0
  36. data/lib/gonzui/content.rb +19 -0
  37. data/lib/gonzui/dbm.rb +673 -0
  38. data/lib/gonzui/deindexer.rb +162 -0
  39. data/lib/gonzui/delta.rb +49 -0
  40. data/lib/gonzui/delta.so +0 -0
  41. data/lib/gonzui/extractor.rb +347 -0
  42. data/lib/gonzui/fetcher.rb +309 -0
  43. data/lib/gonzui/gettext.rb +144 -0
  44. data/lib/gonzui/importer.rb +84 -0
  45. data/lib/gonzui/indexer.rb +316 -0
  46. data/lib/gonzui/info.rb +80 -0
  47. data/lib/gonzui/license.rb +100 -0
  48. data/lib/gonzui/logger.rb +48 -0
  49. data/lib/gonzui/monitor.rb +177 -0
  50. data/lib/gonzui/progressbar.rb +235 -0
  51. data/lib/gonzui/remover.rb +38 -0
  52. data/lib/gonzui/searcher.rb +330 -0
  53. data/lib/gonzui/searchquery.rb +235 -0
  54. data/lib/gonzui/searchresult.rb +111 -0
  55. data/lib/gonzui/texttokenizer.so +0 -0
  56. data/lib/gonzui/updater.rb +254 -0
  57. data/lib/gonzui/util.rb +415 -0
  58. data/lib/gonzui/vcs.rb +128 -0
  59. data/lib/gonzui/webapp.rb +25 -0
  60. data/lib/gonzui/webapp/advsearch.rb +123 -0
  61. data/lib/gonzui/webapp/filehandler.rb +24 -0
  62. data/lib/gonzui/webapp/jsfeed.rb +61 -0
  63. data/lib/gonzui/webapp/markup.rb +445 -0
  64. data/lib/gonzui/webapp/search.rb +269 -0
  65. data/lib/gonzui/webapp/servlet.rb +319 -0
  66. data/lib/gonzui/webapp/snippet.rb +155 -0
  67. data/lib/gonzui/webapp/source.rb +37 -0
  68. data/lib/gonzui/webapp/stat.rb +137 -0
  69. data/lib/gonzui/webapp/top.rb +63 -0
  70. data/lib/gonzui/webapp/uri.rb +140 -0
  71. data/lib/gonzui/webapp/webrick.rb +48 -0
  72. data/lib/gonzui/webapp/xmlformatter.so +0 -0
  73. data/script/console +10 -0
  74. data/script/destroy +14 -0
  75. data/script/generate +14 -0
  76. data/script/makemanifest.rb +21 -0
  77. data/tasks/extconf.rake +13 -0
  78. data/tasks/extconf/autopack.rake +43 -0
  79. data/tasks/extconf/delta.rake +43 -0
  80. data/tasks/extconf/texttokenizer.rake +43 -0
  81. data/tasks/extconf/xmlformatter.rake +43 -0
  82. data/test/_external_tools.rb +13 -0
  83. data/test/_test-util.rb +142 -0
  84. data/test/foo/Makefile.foo +66 -0
  85. data/test/foo/bar.c +5 -0
  86. data/test/foo/bar.h +6 -0
  87. data/test/foo/foo.c +25 -0
  88. data/test/foo/foo.spec +33 -0
  89. data/test/test_apt.rb +42 -0
  90. data/test/test_autopack_extn.rb +7 -0
  91. data/test/test_bdbdbm.rb +79 -0
  92. data/test/test_cmdapp-app.rb +35 -0
  93. data/test/test_cmdapp-search.rb +99 -0
  94. data/test/test_config.rb +28 -0
  95. data/test/test_content.rb +15 -0
  96. data/test/test_dbm.rb +171 -0
  97. data/test/test_deindexer.rb +50 -0
  98. data/test/test_delta.rb +66 -0
  99. data/test/test_extractor.rb +78 -0
  100. data/test/test_fetcher.rb +75 -0
  101. data/test/test_gettext.rb +50 -0
  102. data/test/test_gonzui.rb +11 -0
  103. data/test/test_helper.rb +10 -0
  104. data/test/test_importer.rb +56 -0
  105. data/test/test_indexer.rb +37 -0
  106. data/test/test_info.rb +82 -0
  107. data/test/test_license.rb +49 -0
  108. data/test/test_logger.rb +60 -0
  109. data/test/test_monitor.rb +23 -0
  110. data/test/test_searcher.rb +37 -0
  111. data/test/test_searchquery.rb +27 -0
  112. data/test/test_searchresult.rb +43 -0
  113. data/test/test_texttokenizer.rb +47 -0
  114. data/test/test_updater.rb +95 -0
  115. data/test/test_util.rb +149 -0
  116. data/test/test_vcs.rb +61 -0
  117. data/test/test_webapp-markup.rb +42 -0
  118. data/test/test_webapp-util.rb +19 -0
  119. data/test/test_webapp-xmlformatter.rb +19 -0
  120. metadata +292 -0
@@ -0,0 +1,66 @@
1
+ VERSION = 0.1
2
+ TARGET = foo
3
+ SOURCES = foo.c bar.c
4
+ HEADERS = bar.h
5
+ CFLAGS = -O2
6
+ OBJS = ${SOURCES:.c=.o}
7
+
8
+ all: $(TARGET)
9
+
10
+ foo: $(OBJS)
11
+ $(CC) -o foo $(OBJS)
12
+ .c.o:
13
+ $(CC) -c $<
14
+
15
+ clean:
16
+ rm -f $(TARGET) $(OBJS)
17
+ rm -rf *.tar.gz *.tar.bz2 *.zip foo-$(VERSION)
18
+
19
+
20
+ dist: dist-tree dist-targz dist-tarbz2 dist-zip dist-srpm dist-postprocess
21
+
22
+ dist-tree:
23
+ @rm -rf foo-$(VERSION)
24
+ @mkdir foo-$(VERSION)
25
+ @cp $(SOURCES) $(HEADERS) foo-$(VERSION)
26
+ @cp Makefile.foo foo-$(VERSION)/Makefile
27
+
28
+ dist-targz: dist-tree
29
+ @rm -f foo-$(VERSION).tar.gz
30
+ @tar zcf foo-$(VERSION).tar.gz foo-$(VERSION)
31
+
32
+ dist-tarbz2: dist-tree
33
+ @rm -f foo-$(VERSION).tar.bz2
34
+ @tar jcf foo-$(VERSION).tar.bz2 foo-$(VERSION)
35
+
36
+ dist-zip: dist-tree
37
+ @rm -f foo-$(VERSION).zip
38
+ @zip -qr foo-$(VERSION).zip foo-$(VERSION)
39
+
40
+ dist-srpm: dist-targz
41
+ @rm -f foo-$(VERSION)-1.src.rpm
42
+ @if which rpmbuild >/dev/null 2>&1; then \
43
+ mkdir -p SOURCES SRPMS; \
44
+ cp foo-$(VERSION).tar.gz SOURCES; \
45
+ rpmbuild --define '_topdir .' -bs foo.spec >/dev/null 2>&1; \
46
+ mv SRPMS/foo-$(VERSION)-1.src.rpm .; \
47
+ rm -rf SOURCES SRPMS; \
48
+ fi
49
+
50
+ dist-postprocess:
51
+ @rm -rf foo-$(VERSION)
52
+
53
+ dist-poor: dist-tree \
54
+ dist-poor-targz dist-poor-tarbz2 dist-poor-zip dist-postprocess
55
+
56
+ dist-poor-targz:
57
+ @rm -f foo-$(VERSION)p.tar.gz
58
+ @cd foo-$(VERSION) && tar zcf ../foo-$(VERSION)p.tar.gz .
59
+
60
+ dist-poor-tarbz2:
61
+ @rm -f foo-$(VERSION)p.tar.bz2
62
+ @cd foo-$(VERSION) && tar jcf ../foo-$(VERSION)p.tar.bz2 .
63
+
64
+ dist-poor-zip:
65
+ @rm -f foo-$(VERSION)p.zip
66
+ @cd foo-$(VERSION) && zip -qr ../foo-$(VERSION)p.zip .
data/test/foo/bar.c ADDED
@@ -0,0 +1,5 @@
1
+ int
2
+ bar (int a, int b)
3
+ {
4
+ return a + b;
5
+ }
data/test/foo/bar.h ADDED
@@ -0,0 +1,6 @@
1
+ #ifndef BAR_H
2
+ #define BAR_H
3
+
4
+ int bar(int a, int b);
5
+
6
+ #endif
data/test/foo/foo.c ADDED
@@ -0,0 +1,25 @@
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+ #include <assert.h>
4
+ #include "bar.h"
5
+
6
+ int foo (int a, int b);
7
+
8
+ /*
9
+ * We use tab characters for test purpose. gonzui internally
10
+ * converts tab characters into spaces and we need to test
11
+ * the effect.
12
+ */
13
+ int
14
+ main (int argc, char **argv)
15
+ {
16
+ printf("%d\n", foo(1, 2));
17
+ return 0;
18
+ }
19
+
20
+ int
21
+ foo (int a, int b)
22
+ {
23
+ return bar(a, b);
24
+ }
25
+
data/test/foo/foo.spec ADDED
@@ -0,0 +1,33 @@
1
+ Summary: foo is a test program
2
+ Name: foo
3
+ Version: 0.1
4
+ Release: 1
5
+ License: GPL
6
+ Group: Applications/Text
7
+ Source0: %{name}-%{version}.tar.gz
8
+ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
9
+
10
+ %description
11
+ foo is a test program.
12
+
13
+ %prep
14
+ %setup -q
15
+
16
+ %build
17
+
18
+ %install
19
+ rm -rf $RPM_BUILD_ROOT
20
+
21
+ %clean
22
+ rm -rf $RPM_BUILD_ROOT
23
+
24
+
25
+ %files
26
+ %defattr(-,root,root,-)
27
+ %doc
28
+
29
+
30
+ %changelog
31
+ * Wed Sep 1 2004 Satoru Takabayashi <satoru@namazu.org> -
32
+ - Initial build.
33
+
data/test/test_apt.rb ADDED
@@ -0,0 +1,42 @@
1
+ #! /usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require '_external_tools'
4
+ require '_test-util'
5
+
6
+ class AptTest < Test::Unit::TestCase
7
+ def _test_apt_get_temporary_directory(aptget)
8
+ assert(File.directory?(aptget.temporary_directory))
9
+ aptget.clean
10
+ assert_equal(false, File.directory?(aptget.temporary_directory))
11
+ end
12
+
13
+ def test_apt_get
14
+ return unless Gonzui::AptGet.available?
15
+ apt_type = Gonzui::AptGet.get_apt_type
16
+ assert((apt_type == :rpm or apt_type == :deb))
17
+ config = Gonzui::Config.new
18
+ aptget = Gonzui::AptGet.new(config, "portmap")
19
+
20
+ directory = aptget.extract
21
+ assert(File.directory?(directory))
22
+
23
+ _test_apt_get_temporary_directory(aptget)
24
+ end
25
+
26
+ def test_apt_get_nonexisting
27
+ return unless Gonzui::AptGet.available?
28
+ apt_type = Gonzui::AptGet.get_apt_type
29
+ assert((apt_type == :rpm or apt_type == :deb))
30
+ config = Gonzui::Config.new
31
+ aptget = Gonzui::AptGet.new(config, "qpewrguiniquegnoqwiu")
32
+ begin
33
+ aptget.extract
34
+ assert(false)
35
+ rescue Gonzui::AptGetError => e
36
+ assert(true)
37
+ end
38
+
39
+ _test_apt_get_temporary_directory(aptget)
40
+ end
41
+ end if (APT_)
42
+
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestAutopackExtn < Test::Unit::TestCase
4
+ def test_truth
5
+ assert true #TODO
6
+ end
7
+ end
@@ -0,0 +1,79 @@
1
+ #! /usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require '_test-util'
4
+
5
+ class BDBDBMTest < Test::Unit::TestCase
6
+ include TestUtil
7
+
8
+ def setup
9
+ @dbm = nil
10
+ end
11
+ def teardown
12
+ unless @dbm.nil?
13
+ @dbm.close rescue nil
14
+ end
15
+ @dbm = nil
16
+ remove_db(Gonzui::Config.new)
17
+ end
18
+
19
+ Words = ["foo", "bar", "baz", "quux"]
20
+
21
+ def test_api
22
+ config = Gonzui::Config.new
23
+ remove_db(config)
24
+ dbm = Gonzui::DBM.open(config)
25
+ @dbm = dbm
26
+ dbm.is_a?(Gonzui::BDBDBM)
27
+ dbm.respond_to?(:find_all_by_prefix)
28
+ end
29
+
30
+ def _test_each_by_prefix(db)
31
+ db.each_by_prefix("foo") {|k, v|
32
+ assert_equal("foo", k)
33
+ assert_equal(0, v)
34
+ }
35
+
36
+ db.each_by_prefix("ba") {|k ,v|
37
+ case k
38
+ when "bar"
39
+ assert_equal(v, 1)
40
+ when "baz"
41
+ assert_equal(v, 2)
42
+ when
43
+ assert(false)
44
+ end
45
+ }
46
+ end
47
+
48
+ def _test_delete_both(db)
49
+ assert(db.include?("foo"))
50
+ db.delete_both("foo", 1)
51
+ assert(db.include?("foo"))
52
+ db.delete_both("foo", 0)
53
+ assert(!db.include?("foo"))
54
+ end
55
+
56
+ def _test_get_last_key(db)
57
+ assert_equal("quux", db.get_last_key)
58
+ db.delete("quux")
59
+ assert_equal("baz", db.get_last_key)
60
+ end
61
+
62
+ def test_bdb_extentions
63
+ file_name = File.dirname(__FILE__) + "/test.db"
64
+
65
+ db = BDB::Btree.open(file_name, "test", BDB::CREATE, 0644,
66
+ "set_store_value" => Gonzui::AutoPack::Fixnum.store,
67
+ "set_fetch_value" => Gonzui::AutoPack::Fixnum.fetch)
68
+ db.extend(Gonzui::BDBExtension)
69
+ Words.each_with_index {|word, i|
70
+ db[word] = i
71
+ }
72
+
73
+ _test_each_by_prefix(db)
74
+ _test_delete_both(db)
75
+ _test_get_last_key(db)
76
+
77
+ File.unlink(file_name)
78
+ end if false # [BUG] Segmentation fault
79
+ end
@@ -0,0 +1,35 @@
1
+ #! /usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require 'gonzui/cmdapp'
4
+ require '_test-util'
5
+
6
+ class CommandLineApplicationTest < Test::Unit::TestCase
7
+ class TestApplication < Gonzui::CommandLineApplication
8
+ def parse_options
9
+ option_table = []
10
+ return parse_options_to_hash(option_table)
11
+ end
12
+
13
+ def start
14
+ parse_options
15
+ return @config
16
+ end
17
+ end
18
+
19
+
20
+ def test_app
21
+ app = TestApplication.new
22
+ config = app.start
23
+ assert(config.is_a?(Gonzui::Config))
24
+
25
+ original_stdout = STDOUT.dup
26
+ assert(STDOUT.tty?)
27
+ app.be_quiet
28
+ begin
29
+ assert_equal(false, STDOUT.tty?)
30
+ ensure
31
+ STDOUT.reopen(original_stdout)
32
+ end
33
+ assert(STDOUT.tty?)
34
+ end
35
+ end
@@ -0,0 +1,99 @@
1
+ #! /usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require 'gonzui/cmdapp'
4
+ require '_external_tools.rb'
5
+ require '_test-util'
6
+
7
+ class CommandLineSearcherTest < Test::Unit::TestCase
8
+ include TestUtil
9
+
10
+ include Gonzui::Util
11
+
12
+ def search(config, pattern, options = {})
13
+ strio = StringIO.new
14
+ options['out'] = strio
15
+ searcher = Gonzui::CommandLineSearcher.new(config, options)
16
+ searcher.search(pattern)
17
+ begin
18
+ if options['context']
19
+ return strio.string.gsub(/^== .*\n/s, "")
20
+ else
21
+ return strio.string
22
+ end
23
+ ensure
24
+ searcher.finish
25
+ end
26
+ end
27
+
28
+ def grep(argument)
29
+ ENV['GREP_OPTIONS'] = ""
30
+ files = FOO_FILES.map {|basename| File.join(FOO_PACKAGE, basename) }
31
+ cd = "cd"
32
+ cd << " /d" if (/mswin|mingw|bccwin/ =~ RUBY_PLATFORM)
33
+ tmp = IO.popen("#{cd} #{@@foo} && grep #{argument} #{files.join(' ')}").read
34
+ return tmp.gsub(/\t/, " " * 8)
35
+ end
36
+
37
+ def grep_has_color_option?
38
+ status = system("grep --help | grep -q color")
39
+ return status
40
+ end
41
+
42
+ def test_result
43
+ require_command('grep')
44
+ config = Gonzui::Config.new
45
+ make_db(config)
46
+ make_dist_tree
47
+
48
+ by_gonzui = search(config, "foo")
49
+ by_grep = grep("-H 'foo'")
50
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
51
+
52
+ by_gonzui = search(config, "foo", "package" => FOO_PACKAGE)
53
+ by_grep = grep("-H 'foo'")
54
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
55
+
56
+ by_gonzui = search(config, "foo", "package" => "hoge")
57
+ by_grep = ""
58
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
59
+
60
+ by_gonzui = search(config, "foo", "type" => "fundef")
61
+ by_grep = grep(%Q;-H "^foo (";)
62
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
63
+
64
+ by_gonzui = search(config, "foo", "line-number" => true)
65
+ by_grep = grep("-nH 'foo'")
66
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
67
+
68
+ by_gonzui = search(config, "foo", "no-filename" => true)
69
+ by_grep = grep("-h 'foo'")
70
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
71
+
72
+ by_gonzui = search(config, "mai", "prefix" => true)
73
+ by_grep = grep("-H 'mai'")
74
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
75
+
76
+ by_gonzui = search(config, "f.o", "regexp" => true)
77
+ by_grep = grep("-H 'f.o'")
78
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
79
+
80
+ by_gonzui = search(config, "foo", "type" => "funcall")
81
+ by_grep = grep("-H ' foo(1, 2)'")
82
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
83
+
84
+ (1..10).each {|i|
85
+ by_gonzui = search(config, "foo", "type" => "fundef",
86
+ "context" => i)
87
+ by_grep = grep(%Q;-hC#{i} "^foo (";)
88
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
89
+ }
90
+
91
+ if grep_has_color_option?
92
+ by_gonzui = search(config, "main",
93
+ "line-number" => true, "color" => true)
94
+ ENV["GREP_COLOR"] = ""
95
+ by_grep = grep("-nH --color=always 'main'")
96
+ assert_equal(by_grep.split.join, by_gonzui.split.join)
97
+ end
98
+ end
99
+ end if (GREP_ && ARC_)
@@ -0,0 +1,28 @@
1
+ #! /usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require '_test-util'
4
+
5
+ class ConfigTest < Test::Unit::TestCase
6
+ def test_config
7
+ config = Gonzui::Config.new
8
+ assert_not_nil(config.temporary_directory)
9
+ assert_not_nil(config.db_directory)
10
+
11
+ config.temporary_directory = "foo"
12
+ assert_equal("foo", config.temporary_directory)
13
+ config.db_directory = "bar"
14
+ assert_equal("bar", config.db_directory)
15
+
16
+ config.http_port = 12345
17
+ file_name = "tmp.gonzuirc"
18
+ File.open(file_name, "w") {|f|
19
+ config.dump(f)
20
+ }
21
+ assert(File.exist?(file_name))
22
+ config.http_port = 0
23
+ assert_equal(0, config.http_port)
24
+ config.load(file_name)
25
+ assert_equal(12345, config.http_port)
26
+ File.unlink(file_name)
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ #! /usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+ require '_test-util'
4
+
5
+ class ContentTest < Test::Unit::TestCase
6
+ def test_content
7
+ text = "foo"
8
+ mtime = Time.now
9
+ content = Gonzui::Content.new(text, mtime)
10
+ assert_equal(text, content.text)
11
+ assert_equal(text.length, content.length)
12
+ assert_equal(mtime, content.mtime)
13
+ end
14
+ end
15
+