setup 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY ADDED
@@ -0,0 +1,77 @@
1
+ = RELEASE HISTORY
2
+
3
+ == 4.2.0 / 2009-08-26
4
+
5
+ This release finally gets rdoc generation and doc installation working.
6
+ Note that rdoc generation is shelled-out at the moment b/c of issues with
7
+ loading the new verison of RDoc vs. the old version included with Ruby
8
+ (which bombs). In the process of doding this, all configuration files
9
+ have now been located in meta/ and meta/setup (or .meta/). See the changes
10
+ below for more details.
11
+
12
+ Changes:
13
+
14
+ * 7 Major Enhancements
15
+
16
+ * relocated all user configuration files to meta/ and meta/setup
17
+ * meta/package must exist for doc to be installed.
18
+ * meta/setup/test.rb must be provided to run tests.
19
+ * meta/setup/doc.rb can be provided as alternate for generating docs.
20
+ * meta/setup/metaconfig.rb is now where meta-configuration goes.
21
+ * documentation is installed to <system-doc-dir>/ruby-<package>/.
22
+ * documentation generation shells out (for now, b/c of issues with using API)
23
+
24
+ * 1 Minor Addition
25
+
26
+ * Notice the setup.rb file in the project repo. Guess what that is! ;)
27
+
28
+
29
+ == 4.1.0 / 2008-11-16
30
+
31
+ Ruby Setup is a fork or Minero Aokoi's setup.rb script. Whereas setup.rb
32
+ had to be copied into every project that used it, Ruby Setup is a stand
33
+ alone application.
34
+
35
+ The API is largely the same, with a only few distinctions. Most importantly,
36
+ multi-package support has been removed. Also the underlying system has been
37
+ made more object-oriented. For instance, what was ToplevelInstaller is now
38
+ Setup::Installer. Finally configuration files are saved to .cache/setup and
39
+ metaconfig should be placed in .config/setup, rather then directly into
40
+ the root project directory.
41
+
42
+ I still consider this and "early" release of Ruby Setup, that is until enough
43
+ people put it through it's paces. However, since it is predominantly
44
+ setup.rb 3.4.1 code, and since it works well enough to install itself ;)
45
+ it certainly is a usable product.
46
+
47
+ Please report any problems so I can fix them ASAP. Thanks.
48
+
49
+ Changes:
50
+
51
+ * 5 Major Enhancements
52
+
53
+ * testing only runs if a test script if provided
54
+ * cache files are now stored in .cache/setup/
55
+ * Renamed binary from rubysetup to setup.rb.
56
+ * Hoping that the use of a dot in the name is not a problem on Windows.
57
+ * By using setup.rb for the binary, it matches exactly the name of the old script.
58
+ * Other developers could do likewise, eg. setup.py; akin to mkfs.ext3 and friends.
59
+ * Added script/install as a bootstrap installer.
60
+ * restored metaconfig
61
+
62
+ * 2 Minor Enhancements
63
+
64
+ * added test from original (needs work)
65
+ * removed test/suite.rb option from testing
66
+
67
+
68
+ == 4.0.0 / 2008-08-15
69
+
70
+ This is the first whack at making setup.rb a stand-alone application.
71
+
72
+ Changes:
73
+
74
+ * 3 Other Enhancements
75
+
76
+ * Initial checkin.
77
+
data/MANIFEST CHANGED
@@ -1,64 +1,31 @@
1
- doc
2
- doc/guide
3
- doc/guide/doc.en
4
- doc/guide/doc.en/devel.html
5
- doc/guide/doc.en/usage.html
6
- doc/guide/doc.en/custom.css
7
- doc/guide/doc.en/index.html
8
- doc/guide/doc.en/hookapi.html
9
- doc/guide/doc.en/metaconfapi.html
10
- doc/guide/doc.ja
11
- doc/guide/doc.ja/devel.html
12
- doc/guide/doc.ja/usage.html
13
- doc/guide/doc.ja/index.html
14
- doc/guide/doc.ja/hookapi.html
15
- doc/guide/doc.ja/news.html
16
- doc/guide/doc.ja/metaconfapi.html
17
- doc/assets
18
- doc/assets/styles
19
- doc/assets/styles/custom.css
20
- doc/assets/images
21
- doc/assets/images/setup.png
22
- doc/assets/images/setup-small.png
23
- doc/note
24
- doc/note/changelog-3.4.1.txt
25
- doc/note/TODO
26
- doc/note/release-4.0.0.txt
27
- doc/note/news.html
28
- doc/index.html
29
- doc/log
30
- doc/log/stats.log
31
- doc/log/notes.xml
32
- doc/log/bstats
33
- doc/log/bstats/stats.html
34
- doc/log/syntax.log
35
- doc/log/testunit.log
1
+ COPYING
2
+ HISTORY
36
3
  MANIFEST
37
- test
38
- test/test_installer.rb
39
- CHANGES
40
- RELEASE
41
4
  README
42
- meta
43
- meta/created
44
- meta/homepage
45
- meta/summary
46
- meta/abstract
47
- meta/authors
48
- meta/contact
49
- task
50
- task/install
5
+ RELEASE
6
+ bin
7
+ bin/setup.rb
51
8
  lib
52
- lib/setup.rb
53
9
  lib/setup
54
- lib/setup/install.rb
55
- lib/setup/rake.rb
56
- lib/setup/command.rb
10
+ lib/setup.rb
57
11
  lib/setup/build.rb
12
+ lib/setup/command.rb
58
13
  lib/setup/config.rb
59
- lib/setup/rubyver.rb
60
14
  lib/setup/error.rb
61
- VERSION
62
- bin
63
- bin/setup.rb
64
- COPYING
15
+ lib/setup/install.rb
16
+ lib/setup/rake.rb
17
+ lib/setup/rubyver.rb
18
+ meta
19
+ meta/abstract
20
+ meta/authors
21
+ meta/contact
22
+ meta/created
23
+ meta/homepage
24
+ meta/package
25
+ meta/released
26
+ meta/setup
27
+ meta/setup/metaconfig.rb
28
+ meta/summary
29
+ meta/version
30
+ test
31
+ test/test_installer.rb
@@ -1,5 +1,3 @@
1
1
  module Setup
2
- VERSION = '4.1.0'
3
- COPYRIGHT = 'Copyright (c) 2002,2008 Minero Aoki & Thomas Sawyer'
4
- end
5
-
2
+ VERSION = '4.1.1'
3
+ end
@@ -1,35 +1,38 @@
1
1
  require 'setup/config'
2
2
  require 'setup/build'
3
3
  require 'setup/install'
4
+ require 'setup/error'
4
5
 
5
6
  module Setup
6
7
 
7
- # CLI for setup.
8
- #
8
+ # CLI for Setup.rb
9
9
  class Command
10
10
 
11
11
  TASKS = %w(all config show setup test install uninstall rdoc ri clean distclean)
12
12
 
13
13
  TASK_DESCRIPTIONS = [
14
- [ 'all', 'do config, setup, then install' ],
15
- [ 'config', 'saves your configurations' ],
16
- [ 'show', 'shows current configuration' ],
17
- [ 'setup', 'compiles ruby extentions and others' ],
18
- [ 'rdoc', 'generate rdoc documentation' ],
19
- [ 'ri', 'generate ri documentation' ],
20
- [ 'install', 'installs files' ],
21
- [ 'test', 'run all tests in test/' ],
22
- [ 'clean', "does `make clean' for each extention" ],
23
- [ 'distclean',"does `make distclean' for each extention" ]
14
+ [ 'all', "do config, setup, then install" ],
15
+ [ 'config', "saves your configurations" ],
16
+ [ 'show', "shows current configuration" ],
17
+ [ 'setup', "compiles ruby extentions and others" ],
18
+ [ 'rdoc', "generate rdoc documentation" ],
19
+ [ 'ri', "generate ri documentation" ],
20
+ [ 'install', "installs files" ],
21
+ [ 'uninstall', "uninstalls files" ],
22
+ [ 'test', "run all tests in test/" ],
23
+ [ 'clean', "does `make clean' for each extention" ],
24
+ [ 'distclean', "does `make distclean' for each extention" ]
24
25
  ]
25
26
 
26
27
  #
27
- def self.run
28
- new.run
28
+ def self.run(*argv)
29
+ new.run(*argv)
29
30
  end
30
31
 
31
32
  #
32
- def run
33
+ def run(*argv)
34
+ ARGV.replace(argv) unless argv.empty?
35
+
33
36
  config = ConfigTable.new
34
37
  installer = Installer.new(config)
35
38
 
@@ -89,11 +92,11 @@ module Setup
89
92
  installer.verbose = val
90
93
  end
91
94
 
92
- opts.on("-n", "--no-write", "Do not write to disk") do |val|
95
+ opts.on("--no-write", "Do not write to disk") do |val|
93
96
  installer.no_harm = !val
94
97
  end
95
98
 
96
- opts.on("--dryrun", "Same as --no-write") do |val|
99
+ opts.on("-n", "--dryrun", "Same as --no-write") do |val|
97
100
  installer.no_harm = val
98
101
  end
99
102
 
@@ -126,7 +129,7 @@ module Setup
126
129
 
127
130
  begin
128
131
  installer.__send__("exec_#{task}")
129
- rescue SetupError
132
+ rescue Error
130
133
  raise if $DEBUG
131
134
  $stderr.puts $!.message
132
135
  $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
@@ -134,9 +137,9 @@ module Setup
134
137
  end
135
138
  end
136
139
 
137
- # Generate help text.
140
+ # Generate help text
138
141
  def help
139
- fmt = " " * 10 + "%-10s %s"
142
+ fmt = " " * 10 + "%-10s %s"
140
143
  commands = TASK_DESCRIPTIONS.collect do |k,d|
141
144
  (fmt % ["#{k}", d])
142
145
  end.join("\n").strip
@@ -164,11 +167,8 @@ module Setup
164
167
  -n --no-write Do not write to disk
165
168
 
166
169
  END
167
-
168
170
  text.gsub(/^ \ \ \ \ \ /, '')
169
171
  end
170
172
 
171
173
  end
172
-
173
174
  end
174
-
@@ -34,8 +34,8 @@ module Setup
34
34
  [:rubyprog , :prog, 'ruby program used for installation'],
35
35
  [:makeprog , :prog, 'make program to compile ruby extentions'],
36
36
  [:extconfopt , :name, 'options to pass-thru to extconf.rb'],
37
- [:without_ext , :bool, 'do not compile/install ruby extentions'],
38
- [:without_doc , :bool, 'do not generate html documentation'],
37
+ [:withoutext , :bool, 'do not compile/install ruby extentions'],
38
+ [:withoutdoc , :bool, 'do not generate documentation'],
39
39
  [:shebang , :pick, 'shebang line (#!) editing mode (all,ruby,never)'],
40
40
  [:doctemplate , :pick, 'document template to use (html|xml)'],
41
41
  [:testrunner , :pick, 'Runner to use for testing (auto|console|tk|gtk|gtk2)'],
@@ -53,10 +53,10 @@ module Setup
53
53
  @#{name}.gsub(%r<\\$([^/]+)>){ self[$1] }
54
54
  end
55
55
  def #{name}=(path)
56
- raise SetupError, "bad config: #{name.to_s.upcase} requires argument" unless path
56
+ raise Error, "bad config: #{name.to_s.upcase} requires argument" unless path
57
57
  @#{name} = (path[0,1] == '$' ? path : File.expand_path(path))
58
58
  end
59
- }
59
+ }
60
60
  end
61
61
 
62
62
  # List of pathnames. These are not expanded though.
@@ -73,7 +73,7 @@ module Setup
73
73
  @#{name} = pathlist.to_s.split(/[:;,]/)
74
74
  end
75
75
  end
76
- }
76
+ }
77
77
  end
78
78
 
79
79
  # Adds boolean support.
@@ -102,7 +102,7 @@ module Setup
102
102
  when 'n', 'no', 'f', 'false'
103
103
  @#{name} = false
104
104
  else
105
- raise SetupError, "bad config: use #{name.upcase}=(yes|no) [\#{val}]"
105
+ raise Error, "bad config: use #{name.upcase}=(yes|no) [\#{val}]"
106
106
  end
107
107
  end
108
108
  end
@@ -133,7 +133,7 @@ module Setup
133
133
  if %w(all ruby never).include?(val)
134
134
  @shebang = val
135
135
  else
136
- raise SetupError, "bad config: use SHEBANG=(all|ruby|never) [#{val}]"
136
+ raise Error, "bad config: use SHEBANG=(all|ruby|never) [#{val}]"
137
137
  end
138
138
  end
139
139
 
@@ -148,12 +148,12 @@ module Setup
148
148
  self.rbdir = '$siterubyver'
149
149
  self.sodir = '$siterubyverarch'
150
150
  when 'home'
151
- raise SetupError, 'HOME is not set.' unless ENV['HOME']
151
+ raise Error, 'HOME is not set.' unless ENV['HOME']
152
152
  self.prefix = ENV['HOME']
153
153
  self.rbdir = '$libdir/ruby'
154
154
  self.sodir = '$libdir/ruby'
155
155
  else
156
- raise SetupError, "bad config: use INSTALLDIRS=(std|site|home|local) [#{val}]"
156
+ raise Error, "bad config: use INSTALLDIRS=(std|site|home|local) [#{val}]"
157
157
  end
158
158
  end
159
159
 
@@ -270,10 +270,10 @@ module Setup
270
270
  self.makeprog = makeprog
271
271
  self.extconfopt = ''
272
272
  self.shebang = 'ruby'
273
- self.without_ext = 'no'
274
- self.without_doc = 'yes'
275
- self.doctemplate = 'html'
276
- self.testrunner = 'auto'
273
+ self.withoutext = 'no'
274
+ self.withoutdoc = 'no'
275
+ self.doctemplate = nil
276
+ self.testrunner = 'auto' # needed?
277
277
  self.installdirs = 'site'
278
278
  end
279
279
 
@@ -296,7 +296,7 @@ module Setup
296
296
  __send__("#{k}=",v.strip) #self[k] = v.strip
297
297
  end
298
298
  rescue Errno::ENOENT
299
- raise SetupError, $!.message + "\n#{File.basename($0)} config first"
299
+ raise Error, $!.message + "\n#{File.basename($0)} config first"
300
300
  end
301
301
  #end
302
302
  end
@@ -330,7 +330,6 @@ module Setup
330
330
  end
331
331
 
332
332
  #
333
-
334
333
  def extconfs
335
334
  @extconfs ||= Dir['ext/**/extconf.rb']
336
335
  end
@@ -362,7 +361,7 @@ module Setup
362
361
 
363
362
  # Metaconfig file is '.config/setup/metaconfig{,.rb}'.
364
363
  def load_meta_config
365
- path = Dir.glob('.config/setup/metaconfig{,.rb}').first
364
+ path = Dir.glob('.config/setup/metaconfig{,.rb}').first
366
365
  if path && File.file?(path)
367
366
  MetaConfigEnvironment.new(self).instance_eval(File.read(path), path)
368
367
  end
@@ -1 +1,4 @@
1
- class SetupError < StandardError; end
1
+ module Setup
2
+ class Error < StandardError; end
3
+ end
4
+
@@ -1,18 +1,32 @@
1
1
  require 'optparse'
2
2
  require 'setup/config'
3
3
 
4
- # TODO: we need to abort install if tests fail (how?)
5
- # We will also need to add a force install option then.
6
- # TODO: Need to get name setting from where?
7
- # TODO: Add support for rdoc once project name issue is worked out. (see RDOC HERE.)
8
- # TODO: Generate rdocs? Package developer may want to deactivate this.
4
+ # TODO: we need to abort install if tests fail (check return code of TESTER)
5
+ # We will also need to add a force install option then to by pass failed tests.
6
+ #
7
+ # TODO: Generate rdocs... Package developer may want to deactivate this. How?
8
+ #
9
+ # TODO: Should be using Rdoc programmatically, but load issue arose and an error
10
+ # was being generated on ri generation. Reverting back to shelling out for now.
11
+
12
+ # The name of the package, used to install docs in system doc/ruby-{name}/ location.
13
+ # The information must be provided in a file called meta/package.
14
+ PACKAGE =(
15
+ if file = Dir["{meta,.meta}/package"].first
16
+ File.read(file).strip
17
+ else
18
+ nil
19
+ end
20
+ )
21
+
22
+ # A ruby script that instructs setup how to run tests, located at meta/setup/test.rb
23
+ # If the tests fail, the script should exit with a fail status (eg. -1).
24
+ TESTER = Dir.glob('{meta,.meta}/setup/test{,rc}.rb', File::FNM_CASEFOLD).first
9
25
 
10
- # Need the package name. This is used to install docs in system doc/ruby-{name}/ location.
11
- PACKAGE_NAME = ""
26
+ # A ruby script that instructs setup how to generate docs, located at meta/setup/doc.rb
27
+ # NOTE: Docs must be generate into the doc/ for them to be installed.
28
+ DOCTOR = Dir.glob('{meta,.meta}/setup/doc{,rc}.rb', File::FNM_CASEFOLD).first
12
29
 
13
- #--
14
- #File.read(Dir.glob('{.,meta/}unixname{,.txt}', File::FNM_CASEFOLD).first).strip
15
- #++
16
30
 
17
31
  module Setup
18
32
 
@@ -46,13 +60,14 @@ module Setup
46
60
  @objdir = File.expand_path(objroot)
47
61
  @currdir = '.'
48
62
 
49
- self.quiet = ENV['quiet'] if ENV['quiet']
63
+ self.quiet = ENV['quiet'] if ENV['quiet']
50
64
  self.verbose = ENV['verbose'] if ENV['verbose']
51
65
  self.no_harm = ENV['nowrite'] if ENV['nowrite']
52
66
 
53
67
  yield(self) if block_given?
54
68
  end
55
69
 
70
+ #
56
71
  def inspect
57
72
  "#<#{self.class} #{File.basename(@srcdir)}>"
58
73
  end
@@ -167,10 +182,7 @@ module Setup
167
182
  ##
168
183
  # TASK setup
169
184
  #
170
- # FIXME: Update shebang at time of install not before.
171
- # for now I've commented out the shebang.
172
- #
173
-
185
+ # FIXME: Update shebang on install rather than before.
174
186
  def exec_setup
175
187
  report_header('setup')
176
188
  exec_task_traverse 'setup'
@@ -179,7 +191,7 @@ module Setup
179
191
 
180
192
  def setup_dir_bin(rel)
181
193
  files_of(curr_srcdir()).each do |fname|
182
- #update_shebang_line "#{curr_srcdir()}/#{fname}" # HERE
194
+ update_shebang_line "#{curr_srcdir()}/#{fname}" # MOVE TO INSTALL (BUT HOW?)
183
195
  end
184
196
  end
185
197
 
@@ -274,18 +286,17 @@ module Setup
274
286
  #
275
287
  # Complexities arise in trying to figure out what test framework
276
288
  # 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.
289
+ # simply looks for a script in meta/setup called testrc.rb,
290
+ # or just test.rb.
279
291
  #
280
292
  def exec_test
281
293
  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
294
+ file = TESTER
285
295
  if file
286
296
  report_header('test')
287
297
  ruby(file)
288
298
  end
299
+ #puts "Ok." unless quiet?
289
300
  end
290
301
 
291
302
  ### DEPRECATED
@@ -338,50 +349,76 @@ module Setup
338
349
 
339
350
  ##
340
351
  # TASK doc
341
- #
342
- # NOT USED YET.
343
352
 
344
353
  def exec_doc
345
- return if config.without_doc?
354
+ return if config.withoutdoc?
346
355
  report_header('doc')
347
- #exec_rdoc unless config.without_doc? # RDOC HERE
348
- exec_ri
356
+ if file = DOCTOR
357
+ ruby(file)
358
+ else
359
+ exec_rdoc
360
+ end
361
+ exec_ri
349
362
  end
350
363
 
351
364
  # Generate rdocs.
352
-
365
+ #
366
+ # NOT USED YET B/C WE WOULD HAVE TO KNOW THE NAME OF THE PROJECT
367
+ # TO DO THIS CORRECTLY. (WHERE DO WE GET THAT?)
368
+ #
369
+ # Answer: meta/package or .meta/package
370
+ #
353
371
  def exec_rdoc
354
- output = File.join('doc', 'rdoc')
355
- title = (PACKAGE_NAME.capitalize + " API").strip
356
- main = Dir.glob("README{,.txt}", File::FNM_CASEFOLD).first
357
- template = config.doctemplate || 'html'
358
-
359
- opt = []
360
- opt << "-U"
361
- opt << "-S"
362
- opt << "--op=#{output}"
363
- opt << "--template=#{template}"
364
- opt << "--title=#{title}"
365
- opt << "--main=#{main}" if main
372
+ main = Dir.glob("README{,.*}", File::FNM_CASEFOLD).first
366
373
 
367
374
  if File.exist?('.document')
368
375
  files = File.read('.document').split("\n")
369
376
  files.reject!{ |l| l =~ /^\s*[#]/ || l !~ /\S/ }
370
377
  files.collect!{ |f| f.strip }
371
- opt << files
372
378
  else
373
- opt << main if main
374
- opt << ["lib", "ext"]
379
+ files = []
380
+ files << main if main
381
+ files << 'lib' if File.directory?('lib')
382
+ files << 'ext' if File.directory?('ext')
375
383
  end
376
384
 
385
+ checkfiles = (files + files.map{ |f| Dir[File.join(f,'*','**')] }).flatten.uniq
386
+ if FileUtils.uptodate?('doc/rdoc', checkfiles)
387
+ puts "RDocs look uptodate."
388
+ return
389
+ end
390
+
391
+ output = 'doc/rdoc'
392
+ title = (PACKAGE.capitalize + " API").strip
393
+ template = config.doctemplate || 'html'
394
+
395
+ opt = []
396
+ opt << "-U"
397
+ opt << "-q" #if quiet?
398
+ opt << "--op=#{output}"
399
+ #opt << "--template=#{template}"
400
+ opt << "--title=#{title}"
401
+ opt << "--main=#{main}" if main
402
+ #opt << "--debug"
403
+ opt << files
404
+
377
405
  opt = opt.flatten
378
406
 
407
+ cmd = "rdoc " + opt.join(' ')
408
+
379
409
  if no_harm?
380
- puts "rdoc " + opt.join(' ').strip
410
+ puts cmd
381
411
  else
382
- #sh "rdoc {opt.join(' ').strip}"
383
- require 'rdoc/rdoc'
384
- ::RDoc::RDoc.new.document(opt)
412
+ begin
413
+ system(cmd)
414
+ #require 'rdoc/rdoc'
415
+ #::RDoc::RDoc.new.document(opt)
416
+ puts "Ok rdoc." unless quiet?
417
+ rescue Exception
418
+ puts "Fail rdoc."
419
+ puts "Command was: '#{cmd}'"
420
+ puts "Proceeding with install anyway."
421
+ end
385
422
  end
386
423
  end
387
424
 
@@ -404,30 +441,43 @@ module Setup
404
441
  files.reject!{ |l| l =~ /^\s*[#]/ || l !~ /\S/ }
405
442
  files.collect!{ |f| f.strip }
406
443
  else
407
- files = ["lib", "ext"]
444
+ files = []
445
+ files << 'lib' if File.directory?('lib')
446
+ files << 'ext' if File.directory?('ext')
408
447
  end
409
448
 
410
449
  opt = []
411
450
  opt << "-U"
451
+ opt << "-q" #if quiet?
452
+ #opt << "-D" #if $DEBUG
412
453
  opt << output
413
454
  opt << files
455
+
414
456
  opt = opt.flatten
415
457
 
458
+ cmd = "rdoc " + opt.join(' ')
459
+
416
460
  if no_harm?
417
- puts "rdoc #{opt.join(' ').strip}"
461
+ puts cmd
418
462
  else
419
463
  # Generate in system location specified
420
- #sh "rdoc #{opt.join(' ').strip}"
421
- require 'rdoc/rdoc'
422
- ::RDoc::RDoc.new.document(opt)
423
-
464
+ begin
465
+ system(cmd)
466
+ #require 'rdoc/rdoc'
467
+ #::RDoc::RDoc.new.document(opt)
468
+ puts "Ok ri." unless quiet?
469
+ rescue Exception
470
+ puts "Fail ri."
471
+ puts "Command was: '#{cmd}'"
472
+ puts "Proceeding with install anyway."
473
+ end
424
474
  # Now in local directory
425
- opt = []
426
- opt << "-U"
427
- opt << "--ri --op 'doc/ri'"
428
- opt << files
429
- opt = opt.flatten
430
- ::RDoc::RDoc.new.document(opt)
475
+ #opt = []
476
+ #opt << "-U"
477
+ #opt << "--ri --op 'doc/ri'"
478
+ #opt << files
479
+ #opt = opt.flatten
480
+ #::RDoc::RDoc.new.document(opt)
431
481
  end
432
482
  end
433
483
 
@@ -473,15 +523,12 @@ module Setup
473
523
 
474
524
  # doc installs to directory named: "ruby-#{package}"
475
525
  def install_dir_doc(rel)
476
- return if config.without_doc?
477
- dir = "#{config.docdir}/ruby-#{PACKAGE_NAME}/#{rel}" # "#{config.docdir}/#{rel}"
526
+ return if config.withoutdoc?
527
+ return unless PACKAGE
528
+ dir = "#{config.docdir}/ruby-#{PACKAGE}/#{rel}" # "#{config.docdir}/#{rel}"
478
529
  install_files targetfiles(), dir, 0644
479
530
  end
480
531
 
481
- # doc installs to directory named: "ruby-#{package}"
482
- def install_dir_doc(rel)
483
- end
484
-
485
532
  def install_files(list, dest, mode)
486
533
  mkdir_p dest, install_prefix
487
534
  list.each do |fname|
@@ -519,7 +566,7 @@ module Setup
519
566
  end
520
567
 
521
568
  # picked up many entries from cvs-1.11.1/src/ignore.c
522
- JUNK_FILES = %w(
569
+ JUNK_FILES = %w(
523
570
  core RCSLOG tags TAGS .make.state
524
571
  .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
525
572
  *~ *.old *.bak *.BAK *.orig *.rej _$* *$
@@ -568,9 +615,24 @@ module Setup
568
615
  paths = File.read(MANIFEST).split("\n")
569
616
  dirs, files = paths.partition{ |f| File.dir?(f) }
570
617
 
571
- files.each do |file|
618
+ remove = []
619
+ files.uniq.each do |file|
572
620
  next if /^\#/ =~ file # skip comments
573
- rm_f(file) if File.exist?(file)
621
+ remove << file if File.exist?(file)
622
+ end
623
+
624
+ if verbose? && !no_harm?
625
+ puts remove.collect{ |f| "rm #{f}" }.join("\n")
626
+ ans = ask("Continue?", "yN")
627
+ case ans
628
+ when 'y', 'Y', 'yes'
629
+ else
630
+ return # abort?
631
+ end
632
+ end
633
+
634
+ remove.each do |file|
635
+ rm_f(file)
574
636
  end
575
637
 
576
638
  dirs.each do |dir|
@@ -645,7 +707,7 @@ module Setup
645
707
  def exec_task_traverse(task)
646
708
  run_hook "pre-#{task}"
647
709
  FILETYPES.each do |type|
648
- if type == 'ext' and config.without_ext == 'yes'
710
+ if type == 'ext' and config.withoutext? #== 'yes'
649
711
  $stderr.puts 'skipping ext/* by user option' if verbose?
650
712
  next
651
713
  end
@@ -866,6 +928,14 @@ module Setup
866
928
  }
867
929
  end
868
930
 
931
+ # Ask a question of the user.
932
+ def ask(question, answers=nil)
933
+ $stdout << "#{question}"
934
+ $stdout << " [#{answers}] " if answers
935
+ until inp = $stdin.gets ; sleep 1 ; end
936
+ inp.strip
937
+ end
938
+
869
939
  ##
870
940
  # Hook Script API
871
941
  #
@@ -885,7 +955,7 @@ module Setup
885
955
 
886
956
  # srcdir/objdir (works only in the package directory)
887
957
  #
888
- # TODO: Since package directory has been deprecated these
958
+ # TODO: Since package directory has been deprecated these
889
959
  # probably can be worked out of the system. ?
890
960
 
891
961
  #