setup 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +42 -0
- data/MANIFEST +48 -215
- data/README +8 -12
- data/RELEASE +41 -0
- data/VERSION +2 -0
- data/doc/assets/images/setup-small.png +0 -0
- data/doc/assets/images/setup.png +0 -0
- data/doc/assets/styles/custom.css +59 -0
- data/doc/guide/doc.en/custom.css +47 -0
- data/doc/{manual → guide}/doc.en/devel.html +24 -17
- data/doc/{manual → guide}/doc.en/hookapi.html +11 -2
- data/doc/guide/doc.en/index.html +50 -0
- data/doc/{manual → guide}/doc.en/metaconfapi.html +14 -2
- data/doc/{manual → guide}/doc.en/usage.html +12 -3
- data/doc/{manual → guide}/doc.ja/devel.html +0 -0
- data/doc/{manual → guide}/doc.ja/hookapi.html +0 -0
- data/doc/{manual → guide}/doc.ja/index.html +0 -0
- data/doc/{manual → guide}/doc.ja/metaconfapi.html +0 -0
- data/doc/{manual → guide}/doc.ja/news.html +0 -0
- data/doc/{manual → guide}/doc.ja/usage.html +0 -0
- data/doc/index.html +58 -0
- data/doc/log/bstats/stats.html +39 -0
- data/doc/log/notes.xml +28 -0
- data/doc/log/stats.log +14 -0
- data/doc/log/syntax.log +0 -0
- data/doc/log/testunit.log +60 -0
- data/doc/note/TODO +14 -0
- data/doc/note/changelog-3.4.1.txt +732 -0
- data/doc/{manual/doc.en → note}/news.html +5 -0
- data/doc/note/release-4.0.0.txt +26 -0
- data/lib/setup.rb +1 -1
- data/lib/setup/command.rb +16 -11
- data/lib/setup/config.rb +128 -14
- data/lib/setup/install.rb +89 -67
- data/meta/abstract +8 -0
- data/meta/authors +3 -0
- data/meta/contact +1 -0
- data/meta/created +1 -0
- data/meta/homepage +1 -0
- data/meta/summary +1 -0
- data/{script → task}/install +0 -0
- data/test/test_installer.rb +139 -0
- metadata +65 -231
- data/HISTORY +0 -7
- data/METADATA +0 -25
- data/NEWS +0 -21
- data/doc/manual/doc.en/index.html +0 -28
- data/doc/rdoc/classes/Errno.html +0 -89
- data/doc/rdoc/classes/Errno/ENOTEMPTY.html +0 -92
- data/doc/rdoc/classes/File.html +0 -134
- data/doc/rdoc/classes/Setup.html +0 -107
- data/doc/rdoc/classes/Setup/Command.html +0 -276
- data/doc/rdoc/classes/Setup/ConfigTable.html +0 -622
- data/doc/rdoc/classes/Setup/Installer.html +0 -2454
- data/doc/rdoc/classes/Setup/Installer/Shebang.html +0 -187
- data/doc/rdoc/classes/SetupError.html +0 -92
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/COPYING.html +0 -759
- data/doc/rdoc/files/HISTORY.html +0 -104
- data/doc/rdoc/files/METADATA.html +0 -92
- data/doc/rdoc/files/NEWS.html +0 -113
- data/doc/rdoc/files/README.html +0 -214
- data/doc/rdoc/files/bin/setup_rb.html +0 -96
- data/doc/rdoc/files/lib/setup/build_rb.html +0 -96
- data/doc/rdoc/files/lib/setup/command_rb.html +0 -98
- data/doc/rdoc/files/lib/setup/config_rb.html +0 -98
- data/doc/rdoc/files/lib/setup/error_rb.html +0 -92
- data/doc/rdoc/files/lib/setup/install_rb.html +0 -116
- data/doc/rdoc/files/lib/setup/rake_rb.html +0 -97
- data/doc/rdoc/files/lib/setup/rubyver_rb.html +0 -96
- data/doc/rdoc/files/lib/setup_rb.html +0 -92
- data/doc/rdoc/fr_class_index.html +0 -55
- data/doc/rdoc/fr_file_index.html +0 -60
- data/doc/rdoc/fr_method_index.html +0 -182
- data/doc/rdoc/index.html +0 -26
- data/doc/rdoc/rdoc-style.css +0 -177
- data/doc/ri/Errno/ENOTEMPTY/cdesc-ENOTEMPTY.yaml +0 -15
- data/doc/ri/Errno/cdesc-Errno.yaml +0 -15
- data/doc/ri/File/cdesc-File.yaml +0 -18
- data/doc/ri/File/dir%3f-c.yaml +0 -12
- data/doc/ri/File/read-c.yaml +0 -10
- data/doc/ri/Setup/Command/cdesc-Command.yaml +0 -28
- data/doc/ri/Setup/Command/help-i.yaml +0 -12
- data/doc/ri/Setup/Command/run-c.yaml +0 -11
- data/doc/ri/Setup/Command/run-i.yaml +0 -11
- data/doc/ri/Setup/ConfigTable/%5b%5d%3d-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/%5b%5d-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/attr_accessor-c.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/attr_boolean-c.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/attr_pathlist-c.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/attr_pathname-c.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/cdesc-ConfigTable.yaml +0 -66
- data/doc/ri/Setup/ConfigTable/compiles%3f-i.yaml +0 -10
- data/doc/ri/Setup/ConfigTable/env_config-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/extconfs-i.yaml +0 -11
- data/doc/ri/Setup/ConfigTable/extensions-i.yaml +0 -10
- data/doc/ri/Setup/ConfigTable/initialize_defaults-i.yaml +0 -14
- data/doc/ri/Setup/ConfigTable/installdirs%3d-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/load_config-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/new-c.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/save_config-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/shebang%3d-i.yaml +0 -12
- data/doc/ri/Setup/ConfigTable/show-i.yaml +0 -10
- data/doc/ri/Setup/Installer/Shebang/cdesc-Shebang.yaml +0 -28
- data/doc/ri/Setup/Installer/Shebang/load-c.yaml +0 -10
- data/doc/ri/Setup/Installer/Shebang/new-c.yaml +0 -10
- data/doc/ri/Setup/Installer/Shebang/parse-c.yaml +0 -10
- data/doc/ri/Setup/Installer/Shebang/to_s-i.yaml +0 -10
- data/doc/ri/Setup/Installer/binread-i.yaml +0 -14
- data/doc/ri/Setup/Installer/cdesc-Installer.yaml +0 -281
- data/doc/ri/Setup/Installer/clean_dir_bin-i.yaml +0 -12
- data/doc/ri/Setup/Installer/clean_dir_data-i.yaml +0 -12
- data/doc/ri/Setup/Installer/clean_dir_doc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/clean_dir_etc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/clean_dir_ext-i.yaml +0 -10
- data/doc/ri/Setup/Installer/clean_dir_lib-i.yaml +0 -12
- data/doc/ri/Setup/Installer/clean_dir_man-i.yaml +0 -12
- data/doc/ri/Setup/Installer/command-i.yaml +0 -10
- data/doc/ri/Setup/Installer/compiles%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/config_dir_bin-i.yaml +0 -12
- data/doc/ri/Setup/Installer/config_dir_data-i.yaml +0 -12
- data/doc/ri/Setup/Installer/config_dir_doc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/config_dir_etc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/config_dir_ext-i.yaml +0 -10
- data/doc/ri/Setup/Installer/config_dir_lib-i.yaml +0 -12
- data/doc/ri/Setup/Installer/config_dir_man-i.yaml +0 -12
- data/doc/ri/Setup/Installer/curr_objdir-i.yaml +0 -10
- data/doc/ri/Setup/Installer/curr_srcdir-i.yaml +0 -12
- data/doc/ri/Setup/Installer/diff%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/directories_of-i.yaml +0 -10
- data/doc/ri/Setup/Installer/distclean_dir_bin-i.yaml +0 -12
- data/doc/ri/Setup/Installer/distclean_dir_data-i.yaml +0 -12
- data/doc/ri/Setup/Installer/distclean_dir_doc-i.yaml +0 -10
- data/doc/ri/Setup/Installer/distclean_dir_etc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/distclean_dir_ext-i.yaml +0 -10
- data/doc/ri/Setup/Installer/distclean_dir_lib-i.yaml +0 -12
- data/doc/ri/Setup/Installer/distclean_dir_man-i.yaml +0 -12
- data/doc/ri/Setup/Installer/dive_into-i.yaml +0 -10
- data/doc/ri/Setup/Installer/dllext-i.yaml +0 -10
- data/doc/ri/Setup/Installer/exec_all-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_clean-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_config-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_distclean-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_doc-i.yaml +0 -11
- data/doc/ri/Setup/Installer/exec_install-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_rdoc-i.yaml +0 -14
- data/doc/ri/Setup/Installer/exec_ri-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_setup-i.yaml +0 -14
- data/doc/ri/Setup/Installer/exec_show-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_task_traverse-i.yaml +0 -12
- data/doc/ri/Setup/Installer/exec_test-i.yaml +0 -14
- data/doc/ri/Setup/Installer/exec_uninstall-i.yaml +0 -12
- data/doc/ri/Setup/Installer/existfiles-i.yaml +0 -10
- data/doc/ri/Setup/Installer/extconf-i.yaml +0 -10
- data/doc/ri/Setup/Installer/extdir%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/extensions-i.yaml +0 -12
- data/doc/ri/Setup/Installer/files_of-i.yaml +0 -10
- data/doc/ri/Setup/Installer/force_remove_file-i.yaml +0 -10
- data/doc/ri/Setup/Installer/get_config-i.yaml +0 -11
- data/doc/ri/Setup/Installer/glob_reject-i.yaml +0 -10
- data/doc/ri/Setup/Installer/glob_select-i.yaml +0 -10
- data/doc/ri/Setup/Installer/globs2re-i.yaml +0 -10
- data/doc/ri/Setup/Installer/hookfiles-i.yaml +0 -10
- data/doc/ri/Setup/Installer/inspect-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_dir_bin-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_dir_data-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_dir_doc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/install_dir_etc-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_dir_ext-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_dir_lib-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_dir_man-i.yaml +0 -10
- data/doc/ri/Setup/Installer/install_files-i.yaml +0 -10
- data/doc/ri/Setup/Installer/installation%21-i.yaml +0 -10
- data/doc/ri/Setup/Installer/installation%3f-i.yaml +0 -12
- data/doc/ri/Setup/Installer/libfiles-i.yaml +0 -10
- data/doc/ri/Setup/Installer/make-i.yaml +0 -10
- data/doc/ri/Setup/Installer/mapdir-i.yaml +0 -10
- data/doc/ri/Setup/Installer/mkdir_p-i.yaml +0 -10
- data/doc/ri/Setup/Installer/move_file-i.yaml +0 -10
- data/doc/ri/Setup/Installer/new-c.yaml +0 -12
- data/doc/ri/Setup/Installer/new_shebang-i.yaml +0 -10
- data/doc/ri/Setup/Installer/no_harm%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/noop-i.yaml +0 -54
- data/doc/ri/Setup/Installer/objdir_root-i.yaml +0 -10
- data/doc/ri/Setup/Installer/open_atomic_writer-i.yaml +0 -10
- data/doc/ri/Setup/Installer/quiet%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/record_installation-i.yaml +0 -10
- data/doc/ri/Setup/Installer/relpath-i.yaml +0 -10
- data/doc/ri/Setup/Installer/remove_file-i.yaml +0 -10
- data/doc/ri/Setup/Installer/remove_tree-i.yaml +0 -10
- data/doc/ri/Setup/Installer/remove_tree0-i.yaml +0 -10
- data/doc/ri/Setup/Installer/report_header-i.yaml +0 -11
- data/doc/ri/Setup/Installer/rm_f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/rm_rf-i.yaml +0 -10
- data/doc/ri/Setup/Installer/rmdir-i.yaml +0 -10
- data/doc/ri/Setup/Installer/ruby-i.yaml +0 -10
- data/doc/ri/Setup/Installer/rubyextentions-i.yaml +0 -10
- data/doc/ri/Setup/Installer/run_hook-i.yaml +0 -10
- data/doc/ri/Setup/Installer/set_config-i.yaml +0 -12
- data/doc/ri/Setup/Installer/setup_dir_bin-i.yaml +0 -10
- data/doc/ri/Setup/Installer/setup_dir_data-i.yaml +0 -12
- data/doc/ri/Setup/Installer/setup_dir_doc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/setup_dir_etc-i.yaml +0 -12
- data/doc/ri/Setup/Installer/setup_dir_ext-i.yaml +0 -10
- data/doc/ri/Setup/Installer/setup_dir_lib-i.yaml +0 -12
- data/doc/ri/Setup/Installer/setup_dir_man-i.yaml +0 -12
- data/doc/ri/Setup/Installer/srcdir_root-i.yaml +0 -12
- data/doc/ri/Setup/Installer/srcdirectories-i.yaml +0 -10
- data/doc/ri/Setup/Installer/srcdirectory%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/srcentries-i.yaml +0 -10
- data/doc/ri/Setup/Installer/srcexist%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/srcfile%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/srcfile-i.yaml +0 -10
- data/doc/ri/Setup/Installer/srcfiles-i.yaml +0 -10
- data/doc/ri/Setup/Installer/targetfiles-i.yaml +0 -10
- data/doc/ri/Setup/Installer/traverse-i.yaml +0 -10
- data/doc/ri/Setup/Installer/update_shebang_line-i.yaml +0 -10
- data/doc/ri/Setup/Installer/verbose%3f-i.yaml +0 -10
- data/doc/ri/Setup/Installer/verbose_off-i.yaml +0 -10
- data/doc/ri/Setup/cdesc-Setup.yaml +0 -15
- data/doc/ri/SetupError/cdesc-SetupError.yaml +0 -15
- data/doc/ri/created.rid +0 -1
@@ -0,0 +1,26 @@
|
|
1
|
+
= NEWS
|
2
|
+
|
3
|
+
== 4.1.0 // 2008-09-06
|
4
|
+
|
5
|
+
Change the location of the cache files to .cache/setup/.
|
6
|
+
|
7
|
+
|
8
|
+
== 4.0.0 // 2008-08-16
|
9
|
+
|
10
|
+
This is the initial release of Setup. As such it is
|
11
|
+
getting the label "betaware" until enough people put
|
12
|
+
it through it's paces. However, since it is predominantly
|
13
|
+
setup.rb 3.4.1 code, and that it works to install
|
14
|
+
itself ;) it certainly is a usable product.
|
15
|
+
|
16
|
+
Please report any problems so we can fix them ASAP.
|
17
|
+
|
18
|
+
Currently Setup does not support Aoki's Metaconfig API.
|
19
|
+
It's usefulness seems limited to me, but we can
|
20
|
+
reconsider adding it back in a furture version.
|
21
|
+
|
22
|
+
Multi-package support has also been removed.
|
23
|
+
|
24
|
+
--
|
25
|
+
Website: http://setup.rubyforge.org
|
26
|
+
|
data/lib/setup.rb
CHANGED
data/lib/setup/command.rb
CHANGED
@@ -30,7 +30,8 @@ module Setup
|
|
30
30
|
|
31
31
|
#
|
32
32
|
def run
|
33
|
-
|
33
|
+
config = ConfigTable.new
|
34
|
+
installer = Installer.new(config)
|
34
35
|
|
35
36
|
task = ARGV.find{ |a| a !~ /^[-]/ }
|
36
37
|
task = 'all' unless task
|
@@ -40,14 +41,14 @@ module Setup
|
|
40
41
|
exit 1
|
41
42
|
end
|
42
43
|
|
43
|
-
opts
|
44
|
+
opts = OptionParser.new
|
44
45
|
|
45
46
|
opts.banner = "Usage: #{File.basename($0)} [task] [options]"
|
46
47
|
|
47
48
|
if task == 'config' or task == 'all'
|
48
49
|
opts.separator ""
|
49
|
-
opts.separator "Config options:"
|
50
|
-
|
50
|
+
opts.separator "Config options:"
|
51
|
+
config.descriptions.each do |name, type, desc|
|
51
52
|
opts.on("--#{name} #{type.to_s.upcase}", desc) do |val|
|
52
53
|
ENV[name.to_s] = val.to_s
|
53
54
|
end
|
@@ -61,17 +62,21 @@ module Setup
|
|
61
62
|
opts.on("--prefix PATH", "Installation prefix") do |val|
|
62
63
|
installer.install_prefix = val
|
63
64
|
end
|
64
|
-
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
opts.separator "Install options:"
|
69
|
-
|
70
|
-
opts.on("--runner TYPE", "Test runner (auto|console|gtk|gtk2|tk)") do |val|
|
71
|
-
installer.config.testrunner = val
|
66
|
+
opts.on("--no-test", "Do not run tests") do |val|
|
67
|
+
installer.install_no_test = true
|
72
68
|
end
|
73
69
|
end
|
74
70
|
|
71
|
+
#if task == 'test'
|
72
|
+
# opts.separator ""
|
73
|
+
# opts.separator "Install options:"
|
74
|
+
#
|
75
|
+
# opts.on("--runner TYPE", "Test runner (auto|console|gtk|gtk2|tk)") do |val|
|
76
|
+
# installer.config.testrunner = val
|
77
|
+
# end
|
78
|
+
#end
|
79
|
+
|
75
80
|
# common options
|
76
81
|
opts.separator ""
|
77
82
|
opts.separator "General options:"
|
data/lib/setup/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rbconfig'
|
2
|
+
require 'fileutils'
|
2
3
|
require 'setup/rubyver'
|
3
4
|
require 'setup/error'
|
4
5
|
|
@@ -10,7 +11,7 @@ module Setup
|
|
10
11
|
|
11
12
|
RBCONFIG = ::Config::CONFIG
|
12
13
|
|
13
|
-
CONFIGFILE = '.config'
|
14
|
+
CONFIGFILE = '.cache/setup/config'
|
14
15
|
|
15
16
|
DESCRIPTIONS = [
|
16
17
|
[:prefix , :path, 'path prefix of target environment'],
|
@@ -30,7 +31,7 @@ module Setup
|
|
30
31
|
[:rbdir , :path, 'directory for ruby scripts'],
|
31
32
|
[:sodir , :path, 'directory for ruby extentions'],
|
32
33
|
[:rubypath , :prog, 'path to set to #! line'],
|
33
|
-
[:rubyprog , :prog, 'ruby program
|
34
|
+
[:rubyprog , :prog, 'ruby program used for installation'],
|
34
35
|
[:makeprog , :prog, 'make program to compile ruby extentions'],
|
35
36
|
[:extconfopt , :name, 'options to pass-thru to extconf.rb'],
|
36
37
|
[:without_ext , :bool, 'do not compile/install ruby extentions'],
|
@@ -110,16 +111,16 @@ module Setup
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
113
|
-
DESCRIPTIONS.each do |k,t,d|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
114
|
+
#DESCRIPTIONS.each do |k,t,d|
|
115
|
+
# case t
|
116
|
+
# when :path
|
117
|
+
# attr_pathname k
|
118
|
+
# when :bool
|
119
|
+
# attr_boolean k
|
120
|
+
# else
|
121
|
+
# attr_accessor k
|
122
|
+
# end
|
123
|
+
#end
|
123
124
|
|
124
125
|
# # provide verbosity (default is true)
|
125
126
|
# attr_accessor :verbose?
|
@@ -158,6 +159,7 @@ module Setup
|
|
158
159
|
|
159
160
|
# New ConfigTable
|
160
161
|
def initialize(values=nil)
|
162
|
+
initialize_attributes
|
161
163
|
initialize_defaults
|
162
164
|
if values
|
163
165
|
values.each{ |k,v| __send__("#{k}=", v) }
|
@@ -166,9 +168,33 @@ module Setup
|
|
166
168
|
load_config if File.file?(CONFIGFILE)
|
167
169
|
end
|
168
170
|
|
171
|
+
#
|
172
|
+
def initialize_attributes
|
173
|
+
load_meta_config
|
174
|
+
desc = descriptions
|
175
|
+
(class << self; self; end).class_eval do
|
176
|
+
desc.each do |k,t,d|
|
177
|
+
case t
|
178
|
+
when :path
|
179
|
+
attr_pathname k
|
180
|
+
when :bool
|
181
|
+
attr_boolean k
|
182
|
+
else
|
183
|
+
attr_accessor k
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
#
|
190
|
+
def descriptions
|
191
|
+
@descriptions ||= DESCRIPTIONS
|
192
|
+
end
|
193
|
+
|
169
194
|
# Assign CONFIG defaults
|
170
195
|
#
|
171
196
|
# TODO: Does this handle 'nmake' on windows?
|
197
|
+
#
|
172
198
|
def initialize_defaults
|
173
199
|
prefix = RBCONFIG['prefix']
|
174
200
|
|
@@ -277,6 +303,7 @@ module Setup
|
|
277
303
|
|
278
304
|
# Save configuration.
|
279
305
|
def save_config
|
306
|
+
FileUtils.mkdir_p(File.dirname(CONFIGFILE))
|
280
307
|
File.open(CONFIGFILE, 'w') do |f|
|
281
308
|
OPTIONS.each do |name|
|
282
309
|
val = self[name]
|
@@ -333,7 +360,94 @@ module Setup
|
|
333
360
|
# self[name].gsub(%r<\\$([^/]+)>){ self[$1] }
|
334
361
|
#end
|
335
362
|
|
336
|
-
|
363
|
+
# Metaconfig file is '.config/setup/metaconfig{,.rb}'.
|
364
|
+
def load_meta_config
|
365
|
+
path = Dir.glob('.config/setup/metaconfig{,.rb}').first
|
366
|
+
if path && File.file?(path)
|
367
|
+
MetaConfigEnvironment.new(self).instance_eval(File.read(path), path)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
#= Meta Configuration
|
372
|
+
# This works a bit differently from 3.4.1.
|
373
|
+
# Defaults are currently not supported but remain in the method interfaces.
|
374
|
+
class MetaConfigEnvironment
|
375
|
+
def initialize(config) #, installer)
|
376
|
+
@config = config
|
377
|
+
#@installer = installer
|
378
|
+
end
|
379
|
+
|
380
|
+
#
|
381
|
+
def config_names
|
382
|
+
@config.descriptions.collect{ |n, t, d| n.to_s }
|
383
|
+
end
|
384
|
+
|
385
|
+
#
|
386
|
+
def config?(name)
|
387
|
+
@config.descriptions.find do |sym, type, desc|
|
388
|
+
sym.to_s == name.to_s
|
389
|
+
end
|
390
|
+
end
|
391
|
+
|
392
|
+
#
|
393
|
+
def bool_config?(name)
|
394
|
+
@config.descriptions.find do |sym, type, desc|
|
395
|
+
sym.to_s == name.to_s && type == :bool
|
396
|
+
end
|
397
|
+
#@config.lookup(name).config_type == 'bool'
|
398
|
+
end
|
399
|
+
|
400
|
+
#
|
401
|
+
def path_config?(name)
|
402
|
+
@config.descriptions.find do |sym, type, desc|
|
403
|
+
sym.to_s == name.to_s && type == :path
|
404
|
+
end
|
405
|
+
#@config.lookup(name).config_type == 'path'
|
406
|
+
end
|
407
|
+
|
408
|
+
#
|
409
|
+
def value_config?(name)
|
410
|
+
@config.descriptions.find do |sym, type, desc|
|
411
|
+
sym.to_s == name.to_s && type != :prog
|
412
|
+
end
|
413
|
+
#@config.lookup(name).config_type != 'exec'
|
414
|
+
end
|
415
|
+
|
416
|
+
#
|
417
|
+
def add_config(name, default, desc)
|
418
|
+
@config.descriptions << [name.to_sym, nil, desc]
|
419
|
+
#@config.add item
|
420
|
+
end
|
421
|
+
|
422
|
+
#
|
423
|
+
def add_bool_config(name, default, desc)
|
424
|
+
@config.descriptions << [name.to_sym, :bool, desc]
|
425
|
+
#@config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
|
426
|
+
end
|
427
|
+
|
428
|
+
#
|
429
|
+
def add_path_config(name, default, desc)
|
430
|
+
@config.descriptions << [name.to_sym, :path, desc]
|
431
|
+
#@config.add PathItem.new(name, 'path', default, desc)
|
432
|
+
end
|
433
|
+
|
434
|
+
#
|
435
|
+
def set_config_default(name, default)
|
436
|
+
@config[name] = default
|
437
|
+
end
|
438
|
+
|
439
|
+
#
|
440
|
+
def remove_config(name)
|
441
|
+
item = @config.descriptions.find do |sym, type, desc|
|
442
|
+
sym.to_s == name.to_s
|
443
|
+
end
|
444
|
+
index = @config.descriptions.index(item)
|
445
|
+
@config.descriptions.delete(index)
|
446
|
+
#@config.remove(name)
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
end #class ConfigTable
|
337
451
|
|
338
|
-
end
|
452
|
+
end #module Setup
|
339
453
|
|
data/lib/setup/install.rb
CHANGED
@@ -21,7 +21,7 @@ module Setup
|
|
21
21
|
|
22
22
|
class Installer
|
23
23
|
|
24
|
-
MANIFEST = '.installedfiles'
|
24
|
+
MANIFEST = '.cache/setup/installedfiles'
|
25
25
|
|
26
26
|
FILETYPES = %w( bin lib ext data etc man doc )
|
27
27
|
|
@@ -33,13 +33,14 @@ module Setup
|
|
33
33
|
attr_writer :quiet
|
34
34
|
|
35
35
|
attr_accessor :install_prefix
|
36
|
+
attr_accessor :install_no_test
|
36
37
|
|
37
38
|
# New Installer.
|
38
|
-
def initialize #:yield:
|
39
|
+
def initialize(config=nil) #:yield:
|
39
40
|
srcroot = '.'
|
40
41
|
objroot = '.'
|
41
42
|
|
42
|
-
@config = ConfigTable.new
|
43
|
+
@config = config || ConfigTable.new
|
43
44
|
|
44
45
|
@srcdir = File.expand_path(srcroot)
|
45
46
|
@objdir = File.expand_path(objroot)
|
@@ -60,9 +61,9 @@ module Setup
|
|
60
61
|
def installation?; @installation; end
|
61
62
|
def installation!; @installation = true; end
|
62
63
|
|
63
|
-
def no_harm
|
64
|
-
def verbose
|
65
|
-
def quiet
|
64
|
+
def no_harm? ; @no_harm ; end
|
65
|
+
def verbose? ; @verbose ; end
|
66
|
+
def quiet? ; @quiet ; end
|
66
67
|
|
67
68
|
def verbose_off #:yield:
|
68
69
|
begin
|
@@ -98,7 +99,7 @@ module Setup
|
|
98
99
|
#
|
99
100
|
def noop(rel); end
|
100
101
|
|
101
|
-
|
102
|
+
##
|
102
103
|
# Hook Script API bases
|
103
104
|
#
|
104
105
|
|
@@ -114,19 +115,19 @@ module Setup
|
|
114
115
|
@currdir
|
115
116
|
end
|
116
117
|
|
117
|
-
|
118
|
+
##
|
118
119
|
# Task all
|
119
120
|
#
|
120
121
|
|
121
122
|
def exec_all
|
122
123
|
exec_config
|
123
124
|
exec_setup
|
124
|
-
exec_test
|
125
|
+
exec_test
|
125
126
|
exec_doc
|
126
127
|
exec_install
|
127
128
|
end
|
128
129
|
|
129
|
-
|
130
|
+
##
|
130
131
|
# TASK config
|
131
132
|
#
|
132
133
|
|
@@ -155,7 +156,7 @@ module Setup
|
|
155
156
|
ruby "#{curr_srcdir()}/extconf.rb", config.extconfopt
|
156
157
|
end
|
157
158
|
|
158
|
-
|
159
|
+
##
|
159
160
|
# TASK show
|
160
161
|
#
|
161
162
|
|
@@ -163,7 +164,7 @@ module Setup
|
|
163
164
|
config.show
|
164
165
|
end
|
165
166
|
|
166
|
-
|
167
|
+
##
|
167
168
|
# TASK setup
|
168
169
|
#
|
169
170
|
# FIXME: Update shebang at time of install not before.
|
@@ -268,60 +269,77 @@ module Setup
|
|
268
269
|
end
|
269
270
|
end
|
270
271
|
|
271
|
-
|
272
|
+
##
|
272
273
|
# TASK test
|
273
274
|
#
|
274
|
-
#
|
275
|
-
|
275
|
+
# Complexities arise in trying to figure out what test framework
|
276
|
+
# is used, and how to run tests. To simplify the process, this
|
277
|
+
# method simply looks for a script, either '.config/setup/testrc.rb',
|
278
|
+
# or 'script/test' or 'task/test' and runs it if found.
|
279
|
+
#
|
276
280
|
def exec_test
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
if File.file?('test/suite.rb')
|
285
|
-
notests = false
|
286
|
-
opt << "test/suite.rb"
|
287
|
-
else
|
288
|
-
notests = Dir["test/**/*.rb"].empty?
|
289
|
-
lib = ["lib"] + config.extensions.collect{ |d| File.dirname(d) }
|
290
|
-
opt << "-I" + lib.join(':')
|
291
|
-
opt << Dir["test/**/{test,tc}*.rb"]
|
292
|
-
end
|
293
|
-
opt = opt.flatten.join(' ').strip
|
294
|
-
# run tests
|
295
|
-
if notests
|
296
|
-
$stderr.puts 'no test in this package' if verbose?
|
297
|
-
else
|
298
|
-
cmd = "testrb #{opt}"
|
299
|
-
$stderr.puts cmd if verbose?
|
300
|
-
system cmd #config.ruby "-S tesrb", opt
|
301
|
-
end
|
302
|
-
else # autorunner
|
303
|
-
unless File.directory?('test')
|
304
|
-
$stderr.puts 'no test in this package' if verbose?
|
305
|
-
return
|
306
|
-
end
|
307
|
-
begin
|
308
|
-
require 'test/unit'
|
309
|
-
rescue LoadError
|
310
|
-
setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
|
311
|
-
end
|
312
|
-
autorunner = Test::Unit::AutoRunner.new(true)
|
313
|
-
autorunner.to_run << 'test'
|
314
|
-
autorunner.run
|
281
|
+
return if install_no_test
|
282
|
+
file = nil
|
283
|
+
file ||= Dir.glob('.config/setup/test{,rc}{,.rb}', File::FNM_CASEFOLD).first
|
284
|
+
file ||= Dir.glob('{script,task}/test', File::FNM_CASEFOLD).first
|
285
|
+
if file
|
286
|
+
report_header('test')
|
287
|
+
ruby(file)
|
315
288
|
end
|
316
289
|
end
|
317
290
|
|
291
|
+
### DEPRECATED
|
292
|
+
#def exec_test
|
293
|
+
#runner = config.testrunner
|
294
|
+
#case runner
|
295
|
+
#when 'testrb' # TODO: needs work
|
296
|
+
# opt = []
|
297
|
+
# opt << " -v" if verbose?
|
298
|
+
# opt << " --runner #{runner}"
|
299
|
+
# if File.file?('test/suite.rb')
|
300
|
+
# notests = false
|
301
|
+
# opt << "test/suite.rb"
|
302
|
+
# else
|
303
|
+
# notests = Dir["test/**/*.rb"].empty?
|
304
|
+
# lib = ["lib"] + config.extensions.collect{ |d| File.dirname(d) }
|
305
|
+
# opt << "-I" + lib.join(':')
|
306
|
+
# opt << Dir["test/**/{test,tc}*.rb"]
|
307
|
+
# end
|
308
|
+
# opt = opt.flatten.join(' ').strip
|
309
|
+
# # run tests
|
310
|
+
# if notests
|
311
|
+
# $stderr.puts 'no test in this package' if verbose?
|
312
|
+
# else
|
313
|
+
# cmd = "testrb #{opt}"
|
314
|
+
# $stderr.puts cmd if verbose?
|
315
|
+
# system cmd #config.ruby "-S testrb", opt
|
316
|
+
# end
|
317
|
+
#else # autorunner
|
318
|
+
# unless File.directory?('test')
|
319
|
+
# $stderr.puts 'no test in this package' if verbose?
|
320
|
+
# return
|
321
|
+
# end
|
322
|
+
# begin
|
323
|
+
# require 'test/unit'
|
324
|
+
# rescue LoadError
|
325
|
+
# setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'
|
326
|
+
# end
|
327
|
+
# lib = ["lib"] + config.extensions.collect{ |d| File.dirname(d) }
|
328
|
+
# lib.each{ |l| $LOAD_PATH << l }
|
329
|
+
# autorunner = Test::Unit::AutoRunner.new(true)
|
330
|
+
# autorunner.to_run << 'test'
|
331
|
+
# autorunner.run
|
332
|
+
#end
|
333
|
+
#end
|
334
|
+
|
318
335
|
# MAYBE: We could traverse and run each test independently (?)
|
319
336
|
#def test_dir_test
|
320
337
|
#end
|
321
338
|
|
339
|
+
##
|
340
|
+
# TASK doc
|
322
341
|
#
|
323
|
-
#
|
324
|
-
#
|
342
|
+
# NOT USED YET.
|
325
343
|
|
326
344
|
def exec_doc
|
327
345
|
return if config.without_doc?
|
@@ -330,9 +348,7 @@ module Setup
|
|
330
348
|
exec_ri
|
331
349
|
end
|
332
350
|
|
333
|
-
#
|
334
|
-
#
|
335
|
-
# NOTE USED YET.
|
351
|
+
# Generate rdocs.
|
336
352
|
|
337
353
|
def exec_rdoc
|
338
354
|
output = File.join('doc', 'rdoc')
|
@@ -369,7 +385,7 @@ module Setup
|
|
369
385
|
end
|
370
386
|
end
|
371
387
|
|
372
|
-
#
|
388
|
+
# Generate ri documentation.
|
373
389
|
|
374
390
|
def exec_ri
|
375
391
|
case config.installdirs
|
@@ -415,7 +431,7 @@ module Setup
|
|
415
431
|
end
|
416
432
|
end
|
417
433
|
|
418
|
-
|
434
|
+
##
|
419
435
|
# TASK install
|
420
436
|
#
|
421
437
|
|
@@ -544,7 +560,7 @@ module Setup
|
|
544
560
|
})\z/
|
545
561
|
end
|
546
562
|
|
547
|
-
|
563
|
+
##
|
548
564
|
# TASK uninstall
|
549
565
|
#
|
550
566
|
|
@@ -574,7 +590,7 @@ module Setup
|
|
574
590
|
rm_f(MANIFEST)
|
575
591
|
end
|
576
592
|
|
577
|
-
|
593
|
+
##
|
578
594
|
# TASK clean
|
579
595
|
#
|
580
596
|
|
@@ -596,7 +612,7 @@ module Setup
|
|
596
612
|
make 'clean' if File.file?('Makefile')
|
597
613
|
end
|
598
614
|
|
599
|
-
|
615
|
+
##
|
600
616
|
# TASK distclean
|
601
617
|
#
|
602
618
|
|
@@ -622,7 +638,7 @@ module Setup
|
|
622
638
|
#rm_rf('rdoc') if File.directory?('rdoc') # RDOC HERE
|
623
639
|
end
|
624
640
|
|
625
|
-
|
641
|
+
##
|
626
642
|
# Traversing
|
627
643
|
#
|
628
644
|
|
@@ -649,6 +665,7 @@ module Setup
|
|
649
665
|
}
|
650
666
|
end
|
651
667
|
|
668
|
+
#
|
652
669
|
def dive_into(rel)
|
653
670
|
return unless File.dir?("#{@srcdir}/#{rel}")
|
654
671
|
|
@@ -664,6 +681,7 @@ module Setup
|
|
664
681
|
@currdir = File.dirname(rel)
|
665
682
|
end
|
666
683
|
|
684
|
+
#
|
667
685
|
def run_hook(id)
|
668
686
|
path = [ "#{curr_srcdir()}/#{id}",
|
669
687
|
"#{curr_srcdir()}/#{id}.rb" ].detect {|cand| File.file?(cand) }
|
@@ -676,6 +694,7 @@ module Setup
|
|
676
694
|
end
|
677
695
|
end
|
678
696
|
|
697
|
+
##
|
679
698
|
# File Operations
|
680
699
|
#
|
681
700
|
# This module requires: #verbose?, #no_harm?
|
@@ -804,6 +823,7 @@ module Setup
|
|
804
823
|
end
|
805
824
|
|
806
825
|
def record_installation(path)
|
826
|
+
FileUtils.mkdir_p(File.dirname("#{objdir_root()}/#{MANIFEST}"))
|
807
827
|
File.open("#{objdir_root()}/#{MANIFEST}", 'a') do |f|
|
808
828
|
f.puts(path)
|
809
829
|
end
|
@@ -846,7 +866,7 @@ module Setup
|
|
846
866
|
}
|
847
867
|
end
|
848
868
|
|
849
|
-
|
869
|
+
##
|
850
870
|
# Hook Script API
|
851
871
|
#
|
852
872
|
# These require: #srcdir_root, #objdir_root, #relpath
|
@@ -854,7 +874,7 @@ module Setup
|
|
854
874
|
|
855
875
|
#
|
856
876
|
def get_config(key)
|
857
|
-
config
|
877
|
+
config[key]
|
858
878
|
end
|
859
879
|
|
860
880
|
# obsolete: use metaconfig to change configuration
|
@@ -863,10 +883,12 @@ module Setup
|
|
863
883
|
config[key] = val
|
864
884
|
end
|
865
885
|
|
866
|
-
#
|
867
886
|
# srcdir/objdir (works only in the package directory)
|
868
887
|
#
|
888
|
+
# TODO: Since package directory has been deprecated these
|
889
|
+
# probably can be worked out of the system. ?
|
869
890
|
|
891
|
+
#
|
870
892
|
def curr_srcdir
|
871
893
|
"#{srcdir_root()}/#{relpath()}"
|
872
894
|
end
|