gonzui 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) 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/bdbdbm.rb +118 -0
  31. data/lib/gonzui/cmdapp.rb +14 -0
  32. data/lib/gonzui/cmdapp/app.rb +175 -0
  33. data/lib/gonzui/cmdapp/search.rb +134 -0
  34. data/lib/gonzui/config.rb +117 -0
  35. data/lib/gonzui/content.rb +19 -0
  36. data/lib/gonzui/dbm.rb +673 -0
  37. data/lib/gonzui/deindexer.rb +162 -0
  38. data/lib/gonzui/delta.rb +49 -0
  39. data/lib/gonzui/extractor.rb +347 -0
  40. data/lib/gonzui/fetcher.rb +309 -0
  41. data/lib/gonzui/gettext.rb +144 -0
  42. data/lib/gonzui/importer.rb +84 -0
  43. data/lib/gonzui/indexer.rb +316 -0
  44. data/lib/gonzui/info.rb +80 -0
  45. data/lib/gonzui/license.rb +100 -0
  46. data/lib/gonzui/logger.rb +48 -0
  47. data/lib/gonzui/monitor.rb +177 -0
  48. data/lib/gonzui/progressbar.rb +235 -0
  49. data/lib/gonzui/remover.rb +38 -0
  50. data/lib/gonzui/searcher.rb +330 -0
  51. data/lib/gonzui/searchquery.rb +235 -0
  52. data/lib/gonzui/searchresult.rb +111 -0
  53. data/lib/gonzui/updater.rb +254 -0
  54. data/lib/gonzui/util.rb +415 -0
  55. data/lib/gonzui/vcs.rb +128 -0
  56. data/lib/gonzui/webapp.rb +25 -0
  57. data/lib/gonzui/webapp/advsearch.rb +123 -0
  58. data/lib/gonzui/webapp/filehandler.rb +24 -0
  59. data/lib/gonzui/webapp/jsfeed.rb +61 -0
  60. data/lib/gonzui/webapp/markup.rb +445 -0
  61. data/lib/gonzui/webapp/search.rb +269 -0
  62. data/lib/gonzui/webapp/servlet.rb +319 -0
  63. data/lib/gonzui/webapp/snippet.rb +155 -0
  64. data/lib/gonzui/webapp/source.rb +37 -0
  65. data/lib/gonzui/webapp/stat.rb +137 -0
  66. data/lib/gonzui/webapp/top.rb +63 -0
  67. data/lib/gonzui/webapp/uri.rb +140 -0
  68. data/lib/gonzui/webapp/webrick.rb +48 -0
  69. data/script/console +10 -0
  70. data/script/destroy +14 -0
  71. data/script/generate +14 -0
  72. data/script/makemanifest.rb +21 -0
  73. data/tasks/extconf.rake +13 -0
  74. data/tasks/extconf/autopack.rake +43 -0
  75. data/tasks/extconf/delta.rake +43 -0
  76. data/tasks/extconf/texttokenizer.rake +43 -0
  77. data/tasks/extconf/xmlformatter.rake +43 -0
  78. data/test/_external_tools.rb +13 -0
  79. data/test/_test-util.rb +142 -0
  80. data/test/foo/Makefile.foo +66 -0
  81. data/test/foo/bar.c +5 -0
  82. data/test/foo/bar.h +6 -0
  83. data/test/foo/foo.c +25 -0
  84. data/test/foo/foo.spec +33 -0
  85. data/test/test_apt.rb +42 -0
  86. data/test/test_autopack_extn.rb +7 -0
  87. data/test/test_bdbdbm.rb +79 -0
  88. data/test/test_cmdapp-app.rb +35 -0
  89. data/test/test_cmdapp-search.rb +99 -0
  90. data/test/test_config.rb +28 -0
  91. data/test/test_content.rb +15 -0
  92. data/test/test_dbm.rb +171 -0
  93. data/test/test_deindexer.rb +50 -0
  94. data/test/test_delta.rb +66 -0
  95. data/test/test_extractor.rb +78 -0
  96. data/test/test_fetcher.rb +75 -0
  97. data/test/test_gettext.rb +50 -0
  98. data/test/test_gonzui.rb +11 -0
  99. data/test/test_helper.rb +10 -0
  100. data/test/test_importer.rb +56 -0
  101. data/test/test_indexer.rb +37 -0
  102. data/test/test_info.rb +82 -0
  103. data/test/test_license.rb +49 -0
  104. data/test/test_logger.rb +60 -0
  105. data/test/test_monitor.rb +23 -0
  106. data/test/test_searcher.rb +37 -0
  107. data/test/test_searchquery.rb +27 -0
  108. data/test/test_searchresult.rb +43 -0
  109. data/test/test_texttokenizer.rb +47 -0
  110. data/test/test_updater.rb +95 -0
  111. data/test/test_util.rb +149 -0
  112. data/test/test_vcs.rb +61 -0
  113. data/test/test_webapp-markup.rb +42 -0
  114. data/test/test_webapp-util.rb +19 -0
  115. data/test/test_webapp-xmlformatter.rb +19 -0
  116. metadata +291 -0
@@ -0,0 +1,48 @@
1
+ #
2
+ # webrick.rb - webrick enhancements
3
+ #
4
+ # Copyright (C) 2004-2005 Satoru Takabayashi <satoru@namazu.org>
5
+ # All rights reserved.
6
+ # This is free software with ABSOLUTELY NO WARRANTY.
7
+ #
8
+ # You can redistribute it and/or modify it under the terms of
9
+ # the GNU General Public License version 2.
10
+ #
11
+
12
+ require 'webrick'
13
+ include WEBrick
14
+
15
+ module WEBrick
16
+ class HTTPRequest
17
+ # FIXME: it should be deleted if WEBRick supports the method
18
+ def parse_accept_language
19
+ if self["Accept-Language"]
20
+ tmp = []
21
+ parts = self["Accept-Language"].split(/,\s*/)
22
+ parts.each {|part|
23
+ if m = /^([\w-]+)(?:;q=([\d]+(?:\.[\d]+)))?$/.match(part)
24
+ lang = m[1]
25
+ q = (m[2] or 1).to_f
26
+ tmp.push([lang, q])
27
+ end
28
+ }
29
+ @accept_language =
30
+ tmp.sort_by {|lang, q| q}.map {|lang, q| lang}.reverse
31
+ else
32
+ @accept_language = ["en"] # FIXME: should be customizable?
33
+ end
34
+ end
35
+
36
+ def accept_language
37
+ unless @accept_language
38
+ parse_accept_language
39
+ end
40
+ return @accept_language
41
+ end
42
+
43
+ def gzip_encoding_supported?
44
+ /\bgzip\b/.match(self["accept-encoding"])
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/gonzui.rb'}"
9
+ puts "Loading gonzui gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby
2
+ # original: http://d.hatena.ne.jp/bellbind/20070605/1180979599
3
+
4
+ base_dir = File.join(File.dirname(__FILE__), "..")
5
+ glob_pattern = File.join("**", "*")
6
+ exclude_patterns = [
7
+ /^pkg/,/^doc/,
8
+ ]
9
+
10
+ Dir.chdir(base_dir)
11
+ files = Dir.glob(glob_pattern).delete_if do |fname|
12
+ File.directory?(fname) or
13
+ exclude_patterns.find do |pattern|
14
+ pattern =~ fname
15
+ end
16
+ end
17
+ manifest = File.new("Manifest.txt", "w")
18
+ manifest.puts files.sort.join("\n")
19
+ manifest.close
20
+
21
+ puts "Manifest.txt updated"
@@ -0,0 +1,13 @@
1
+ namespace :extconf do
2
+ desc "Compiles the Ruby extension"
3
+ task :compile
4
+ end
5
+
6
+ task :compile => "extconf:compile"
7
+
8
+ task :test => :compile
9
+
10
+ BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}"
11
+ $hoe.clean_globs |= ["ext/**/#{BIN}", "lib/**/#{BIN}", 'ext/**/Makefile']
12
+ $hoe.spec.require_paths = Dir['{lib,ext/*}']
13
+ $hoe.spec.extensions = FileList["ext/**/extconf.rb"].to_a
@@ -0,0 +1,43 @@
1
+ namespace :extconf do
2
+ extension = File.basename(__FILE__, '.rake')
3
+
4
+ ext = "ext/#{extension}"
5
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
6
+ ext_files = FileList[
7
+ "#{ext}/*.c",
8
+ "#{ext}/*.h",
9
+ "#{ext}/*.rl",
10
+ "#{ext}/extconf.rb",
11
+ "#{ext}/Makefile",
12
+ # "lib"
13
+ ]
14
+
15
+
16
+ task :compile => extension do
17
+ if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
18
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
+ STDERR.puts "Gem actually failed to build. Your system is"
20
+ STDERR.puts "NOT configured properly to build #{GEM_NAME}."
21
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
22
+ exit(1)
23
+ end
24
+ end
25
+
26
+ desc "Builds just the #{extension} extension"
27
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
28
+
29
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
30
+ Dir.chdir(ext) do ruby "extconf.rb" end
31
+ end
32
+
33
+ file ext_so => ext_files do
34
+ Dir.chdir(ext) do
35
+ sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ namespace :extconf do
2
+ extension = File.basename(__FILE__, '.rake')
3
+
4
+ ext = "ext/#{extension}"
5
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
6
+ ext_files = FileList[
7
+ "#{ext}/*.c",
8
+ "#{ext}/*.h",
9
+ "#{ext}/*.rl",
10
+ "#{ext}/extconf.rb",
11
+ "#{ext}/Makefile",
12
+ # "lib"
13
+ ]
14
+
15
+
16
+ task :compile => extension do
17
+ if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
18
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
+ STDERR.puts "Gem actually failed to build. Your system is"
20
+ STDERR.puts "NOT configured properly to build #{GEM_NAME}."
21
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
22
+ exit(1)
23
+ end
24
+ end
25
+
26
+ desc "Builds just the #{extension} extension"
27
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
28
+
29
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
30
+ Dir.chdir(ext) do ruby "extconf.rb" end
31
+ end
32
+
33
+ file ext_so => ext_files do
34
+ Dir.chdir(ext) do
35
+ sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ namespace :extconf do
2
+ extension = File.basename(__FILE__, '.rake')
3
+
4
+ ext = "ext/#{extension}"
5
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
6
+ ext_files = FileList[
7
+ "#{ext}/*.c",
8
+ "#{ext}/*.h",
9
+ "#{ext}/*.rl",
10
+ "#{ext}/extconf.rb",
11
+ "#{ext}/Makefile",
12
+ # "lib"
13
+ ]
14
+
15
+
16
+ task :compile => extension do
17
+ if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
18
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
+ STDERR.puts "Gem actually failed to build. Your system is"
20
+ STDERR.puts "NOT configured properly to build #{GEM_NAME}."
21
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
22
+ exit(1)
23
+ end
24
+ end
25
+
26
+ desc "Builds just the #{extension} extension"
27
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
28
+
29
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
30
+ Dir.chdir(ext) do ruby "extconf.rb" end
31
+ end
32
+
33
+ file ext_so => ext_files do
34
+ Dir.chdir(ext) do
35
+ sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ namespace :extconf do
2
+ extension = File.basename(__FILE__, '.rake')
3
+
4
+ ext = "ext/#{extension}"
5
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
6
+ ext_files = FileList[
7
+ "#{ext}/*.c",
8
+ "#{ext}/*.h",
9
+ "#{ext}/*.rl",
10
+ "#{ext}/extconf.rb",
11
+ "#{ext}/Makefile",
12
+ # "lib"
13
+ ]
14
+
15
+
16
+ task :compile => extension do
17
+ if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
18
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
+ STDERR.puts "Gem actually failed to build. Your system is"
20
+ STDERR.puts "NOT configured properly to build #{GEM_NAME}."
21
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
22
+ exit(1)
23
+ end
24
+ end
25
+
26
+ desc "Builds just the #{extension} extension"
27
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
28
+
29
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
30
+ Dir.chdir(ext) do ruby "extconf.rb" end
31
+ end
32
+
33
+ file ext_so => ext_files do
34
+ Dir.chdir(ext) do
35
+ sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,13 @@
1
+ dn = "/dev/null"
2
+ dn = "nul" if (/mswin|mingw|bccwin/ =~ RUBY_PLATFORM)
3
+ APT_ = ( system( "apt-get --version 2> #{dn} > #{dn}" ) ? true : false )
4
+ CVS_ = ( system( "cvs --version 2> #{dn} > #{dn}" ) ? true : false )
5
+ GIT_ = ( system( "git --version 2> #{dn} > #{dn}" ) ? true : false )
6
+ GREP_ = ( system( "grep --version 2> #{dn} > #{dn}" ) ? true : false )
7
+ SVN_ = ( system( "svn --version 2> #{dn} > #{dn}" ) ? true : false )
8
+ ZIP_ = ( system( "zip --version 2> #{dn} > #{dn}" ) ? true : false )
9
+ UNZIP_ = ( system( "unzip -v 2> #{dn} > #{dn}" ) ? true : false )
10
+ GZIP_ = ( system( "gzip --version 2> #{dn} > #{dn}" ) ? true : false )
11
+ BZIP2_ = ( system( "bzip2 --help 2> #{dn} > #{dn}" ) ? true : false )
12
+ TAR_ = ( system( "tar --version 2> #{dn} > #{dn}" ) ? true : false )
13
+ ARC_ = ( ZIP_ && UNZIP_ && GZIP_ && BZIP2_ && TAR_ )
@@ -0,0 +1,142 @@
1
+ require 'gonzui'
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ def gnu_make?
6
+ message = IO.popen("make --version").read
7
+ /^GNU/.match(message)
8
+ end
9
+
10
+ module TestUtil
11
+ FOO_FILES = ["bar.c", "bar.h", "foo.c", "Makefile" ].sort
12
+ FOO_C_FILES = FOO_FILES.find_all {|x| /\.[ch]$/.match(x) }
13
+ FOO_SYMBOLS = ["bar", "foo", "main", "printf"]
14
+ FOO_PACKAGE = "foo-0.1"
15
+ FOO_TGZ = File.join(File.dirname(__FILE__), "foo",
16
+ FOO_PACKAGE + ".tar.gz")
17
+
18
+ @@make_options = if gnu_make?
19
+ "--quiet --no-print-directory"
20
+ else
21
+ ""
22
+ end
23
+ @@foo = File.join(File.dirname(__FILE__), "foo")
24
+
25
+ ############### Import ###############
26
+
27
+ def add_package(config)
28
+ importer = Gonzui::Importer.new(config)
29
+ url = URI.from_path(FOO_TGZ)
30
+ importer.import(url)
31
+ importer.finish
32
+ end
33
+
34
+ ############### DB ###############
35
+
36
+ def make_db(config)
37
+ remove_db(config)
38
+ make_archives
39
+ importer = Gonzui::Importer.new(config)
40
+ url = URI.from_path(FOO_TGZ)
41
+ importer.import(url)
42
+ importer.finish
43
+ end
44
+
45
+ def remove_db(config)
46
+ rm_rf(config.db_directory)
47
+ end
48
+
49
+ ############### Make ###############
50
+
51
+ def make_dist_tree
52
+ system("cd #{@@foo} && make #{@@make_options} -f Makefile.foo dist-tree")
53
+ end
54
+
55
+ def make_clean
56
+ system("cd #{@@foo} && make #{@@make_options} -f Makefile.foo clean")
57
+ end
58
+
59
+ def make_archives
60
+ Gonzui::Util.require_command("zip")
61
+ Gonzui::Util.require_command("tar")
62
+ Gonzui::Util.require_command("gzip")
63
+ Gonzui::Util.require_command("bzip2")
64
+ system("cd #{@@foo} && make #{@@make_options} -f Makefile.foo dist")
65
+ system("cd #{@@foo} && make #{@@make_options} -f Makefile.foo dist-poor")
66
+ end
67
+
68
+ ############### CVS ###############
69
+
70
+ def cvsroot
71
+ File.expand_path(File.join(File.dirname(__FILE__), "tmp.cvsroot"))
72
+ end
73
+
74
+ def make_cvs
75
+ remove_cvs
76
+ make_dist_tree
77
+ assert(Gonzui::Util.command_exist?("cvs"))
78
+ Dir.mkdir(cvsroot)
79
+ command_line = sprintf("cvs -d %s init", shell_escape(cvsroot))
80
+ system(command_line)
81
+ command_line = sprintf("cd %s && ", shell_escape("#{@@foo}/#{FOO_PACKAGE}"))
82
+ command_line << sprintf("cvs -d %s import -m '' foo gonzui-test test", shell_escape(cvsroot))
83
+ system(command_line)
84
+ end
85
+
86
+ def remove_cvs
87
+ FileUtils.rm_rf(cvsroot)
88
+ end
89
+
90
+ ############### SVN ###############
91
+
92
+ def svnroot
93
+ File.expand_path(File.join(File.dirname(__FILE__), "tmp.svnroot"))
94
+ end
95
+
96
+ def make_svn
97
+ remove_svn
98
+ make_dist_tree
99
+ assert(Gonzui::Util.command_exist?("svn"))
100
+ assert(Gonzui::Util.command_exist?("svnadmin"))
101
+ svnroot_uri = sprintf("file:///%s", svnroot)
102
+ Dir.mkdir(svnroot)
103
+ command_line = sprintf("svnadmin create %s", shell_escape(svnroot))
104
+ system(command_line)
105
+ command_line = sprintf("cd %s && ", shell_escape("#{@@foo}/#{FOO_PACKAGE}"))
106
+ command_line << sprintf("svn -q import -m '' %s", shell_escape(svnroot_uri))
107
+ system(command_line)
108
+ return svnroot_uri
109
+ end
110
+
111
+ def remove_svn
112
+ FileUtils.rm_rf(svnroot)
113
+ end
114
+
115
+ ############### GIT ###############
116
+
117
+ def gitroot
118
+ File.expand_path(File.join(File.dirname(__FILE__), "tmp.gitroot"))
119
+ end
120
+
121
+ def make_git
122
+ remove_git
123
+ make_dist_tree
124
+ assert(Gonzui::Util.command_exist?("git"))
125
+ Dir.mkdir(gitroot)
126
+ command_line = sprintf("git --git-dir %s init", shell_escape(gitroot))
127
+ system(command_line)
128
+ command_line = sprintf("cd %s && ", shell_escape("#{@@foo}/#{FOO_PACKAGE}"))
129
+ command_line << sprintf("git --git-dir %s --work-tree . add . && ", shell_escape(gitroot))
130
+ command_line << sprintf("git --git-dir %s --work-tree . commit -m 'import'", shell_escape(gitroot))
131
+ system(command_line)
132
+ return gitroot
133
+ end
134
+
135
+ def remove_git
136
+ FileUtils.rm_rf(gitroot)
137
+ end
138
+ end
139
+
140
+ if ENV['MAKEFLAGS'] # be quiet in a make process.
141
+ ARGV.unshift("--verbose=s")
142
+ end