setup 4.2.0 → 5.0.0

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 (55) hide show
  1. data/HISTORY +47 -3
  2. data/MANIFEST +49 -16
  3. data/README.rdoc +148 -0
  4. data/bin/setup.rb +1 -5
  5. data/lib/setup.rb +2 -2
  6. data/lib/setup/base.rb +143 -0
  7. data/lib/setup/command.rb +218 -114
  8. data/lib/setup/compiler.rb +69 -0
  9. data/lib/setup/configuration.rb +822 -0
  10. data/lib/setup/constants.rb +12 -0
  11. data/lib/setup/{rubyver.rb → core_ext.rb} +0 -0
  12. data/lib/setup/documentor.rb +149 -0
  13. data/lib/setup/installer.rb +363 -0
  14. data/lib/setup/project.rb +68 -0
  15. data/lib/setup/rake.rb +44 -45
  16. data/lib/setup/session.rb +233 -0
  17. data/lib/setup/tester.rb +92 -0
  18. data/lib/setup/uninstaller.rb +76 -0
  19. data/meta/active +1 -0
  20. data/meta/collection +1 -0
  21. data/meta/{abstract → description} +0 -0
  22. data/meta/{package → name} +0 -0
  23. data/meta/repository +1 -0
  24. data/meta/ruby +3 -0
  25. data/meta/version +1 -1
  26. data/script/bstrap +5 -0
  27. data/script/bundle +64 -0
  28. data/script/setup +1338 -0
  29. data/script/test +3 -0
  30. data/test/cases/installer.rb +28 -0
  31. data/test/features/config.feature +16 -0
  32. data/test/features/document.feature +2 -0
  33. data/test/features/install.feature +72 -0
  34. data/test/features/make.feature +18 -0
  35. data/test/features/step_definitions/common_steps.rb +34 -0
  36. data/test/features/step_definitions/config_steps.rb +24 -0
  37. data/test/features/step_definitions/env.rb +37 -0
  38. data/test/features/step_definitions/install_steps.rb +75 -0
  39. data/test/features/step_definitions/setup_steps.rb +30 -0
  40. data/test/features/step_definitions/uninstall_steps.rb +8 -0
  41. data/test/features/test.feature +2 -0
  42. data/test/features/uninstall.feature +13 -0
  43. data/test/fixtures/faux-project/bin/faux +3 -0
  44. data/test/fixtures/faux-project/ext/faux/extconf.rb +12 -0
  45. data/test/fixtures/faux-project/ext/faux/faux.c +24 -0
  46. data/test/fixtures/faux-project/lib/faux.rb +1 -0
  47. metadata +58 -29
  48. data/README +0 -106
  49. data/RELEASE +0 -41
  50. data/lib/setup/build.rb +0 -2
  51. data/lib/setup/config.rb +0 -452
  52. data/lib/setup/error.rb +0 -4
  53. data/lib/setup/install.rb +0 -1007
  54. data/meta/setup/metaconfig.rb +0 -3
  55. data/test/test_installer.rb +0 -139
data/README DELETED
@@ -1,106 +0,0 @@
1
- = Setup
2
-
3
- http://setup.rubyforge.org
4
-
5
-
6
- == Introduction
7
-
8
- Every Rubyist is aware of Minero Aoki's ever useful
9
- setup.rb script. It's how most of us used to install
10
- our ruby programs before RubyGems came along.And it's
11
- still mighty useful in certain scenarios, not the least
12
- of which is the job of the distribution package managers.
13
- Setup converts setup.rb into a stand-alone application.
14
- No longer will you need distribute setup.rb with you
15
- Ruby packages. Just instruct your users to use Setup.
16
-
17
-
18
- == Important
19
-
20
- There a couple very important difference between the old
21
- 3.4.1 verison of the setup.rb script and version 4.0.0
22
- of the independent application.
23
-
24
- * The directory convention 'conf' has been change to 'etc'.
25
- * The Metacofig API is not currently supported.
26
- * Multi-package project layouts are no longer supported.
27
-
28
-
29
- == Install
30
-
31
- The easy way to install is via RubyGems.
32
-
33
- $ gem install setup
34
-
35
- To install Setup manually you need to "boot-strap" it.
36
- This is done for you, by running the following:
37
-
38
- $ task/install
39
-
40
-
41
- == Usage
42
-
43
- To use setup.rb, a project must conform to the setup.rb
44
- standard layout.
45
-
46
- Please see the documentation in doc/book. Note that
47
- the documentation is slightly out of sync with the
48
- latest release.
49
-
50
- Usage is as simple as:
51
-
52
- $ setup.rb config
53
- $ setup.rb setup
54
- $ setup.rb install
55
-
56
- or
57
-
58
- $ setup.rb all
59
-
60
- If you later decide you want to remove the program.
61
-
62
- $ setup.rb uninstall
63
-
64
- Note that uninstall is made possible by the 'installedfiles'
65
- file that is generated by the install process. If that file
66
- is deleted than you will not be able to uninstall. (You can
67
- get around this be reinstalling first though).
68
-
69
- You can clean up any setup products with:
70
-
71
- $ setup.rb clean
72
-
73
- And restore the package to it's pristine state with:
74
-
75
- $ setup.rb distclean
76
-
77
- Not that this last command will remove the .installedfiles
78
- file!
79
-
80
-
81
- == To Do
82
-
83
- * Maybe protect 'installedfiles' from removal, even on distclean.
84
- * Separate compiling code into separate class.
85
-
86
-
87
- == License
88
-
89
- Copyright (c) 2002,2005 Minero Aoki
90
- Copyright (c) 2008 TigerOps & Thomas Sawyer
91
-
92
- GNU LGPL, Lesser General Public License version 2.1.
93
- For details of LGPL, see the file "COPYING".
94
-
95
-
96
-
97
-
98
- 7trans
99
- transfire@gmail.com
100
- http://tigerops.org
101
-
102
-
103
- Minero Aoki
104
- aamine@loveruby.net
105
- http://i.loveruby.net
106
-
data/RELEASE DELETED
@@ -1,41 +0,0 @@
1
- = Release Notes
2
-
3
- Ruby Setup is a fork or Minero Aokoi's setup.rb script.
4
- Whereas setup.rb had to be copied into every project
5
- that used it, Ruby Setup is a stand alone application.
6
-
7
- The API is largely the same, with a only few distinctions.
8
- Most importantly, multi-package support has been removed.
9
- Also the underlying system has been made more object-oriented,
10
- for instance, what was ToplevelInstaller is now Setup::Installer.
11
- Finally configuration files are saved to .cache/setup and
12
- metaconfig should be placed in .config/setup, rather then
13
- directly into the root project directory.
14
-
15
- I still consider this and "early" release of Ruby Setup, that
16
- is until enough people put it through it's paces.
17
- However, since it is predominantly setup.rb 3.4.1 code,
18
- and since it works well enough to install itself ;)
19
- it certainly is a usable product.
20
-
21
- Please report any problems so I can fix them ASAP.
22
-
23
-
24
- ### 4.1.0 / 2008-11-16
25
-
26
- * 5 Major Enhancements
27
-
28
- * testing only runs if a test script if provided
29
- * cache files are now stored in .cache/setup/
30
- * Renamed binary from rubysetup to setup.rb.
31
- * Hoping that the use of a dot in the name is not a problem on Windows.
32
- * By using setup.rb for the binary, it matches exactly the name of the old script.
33
- * Other developers could do likewise, eg. setup.py; akin to mkfs.ext3 and friends.
34
- * Added script/install as a bootstrap installer.
35
- * restored metaconfig
36
-
37
- * 2 Minor Enhancements
38
-
39
- * added test from original (needs work)
40
- * removed test/suite.rb option from testing
41
-
@@ -1,2 +0,0 @@
1
- # TODO: Extract the compiler portion of setup and put it here.
2
-
@@ -1,452 +0,0 @@
1
- require 'rbconfig'
2
- require 'fileutils'
3
- require 'setup/rubyver'
4
- require 'setup/error'
5
-
6
- module Setup
7
-
8
- # Config stores platform information.
9
-
10
- class ConfigTable # TODO: Rename to Config (?)
11
-
12
- RBCONFIG = ::Config::CONFIG
13
-
14
- CONFIGFILE = '.cache/setup/config'
15
-
16
- DESCRIPTIONS = [
17
- [:prefix , :path, 'path prefix of target environment'],
18
- [:bindir , :path, 'directory for commands'],
19
- [:libdir , :path, 'directory for libraries'],
20
- [:datadir , :path, 'directory for shared data'],
21
- [:mandir , :path, 'directory for man pages'],
22
- [:docdir , :path, 'Directory for documentation'],
23
- [:sysconfdir , :path, 'directory for system configuration files'],
24
- [:localstatedir , :path, 'directory for local state data'],
25
- [:libruby , :path, 'directory for ruby libraries'],
26
- [:librubyver , :path, 'directory for standard ruby libraries'],
27
- [:librubyverarch , :path, 'directory for standard ruby extensions'],
28
- [:siteruby , :path, 'directory for version-independent aux ruby libraries'],
29
- [:siterubyver , :path, 'directory for aux ruby libraries'],
30
- [:siterubyverarch , :path, 'directory for aux ruby binaries'],
31
- [:rbdir , :path, 'directory for ruby scripts'],
32
- [:sodir , :path, 'directory for ruby extentions'],
33
- [:rubypath , :prog, 'path to set to #! line'],
34
- [:rubyprog , :prog, 'ruby program used for installation'],
35
- [:makeprog , :prog, 'make program to compile ruby extentions'],
36
- [:extconfopt , :name, 'options to pass-thru to extconf.rb'],
37
- [:withoutext , :bool, 'do not compile/install ruby extentions'],
38
- [:withoutdoc , :bool, 'do not generate documentation'],
39
- [:shebang , :pick, 'shebang line (#!) editing mode (all,ruby,never)'],
40
- [:doctemplate , :pick, 'document template to use (html|xml)'],
41
- [:testrunner , :pick, 'Runner to use for testing (auto|console|tk|gtk|gtk2)'],
42
- [:installdirs , :pick, 'install location mode (std,site,home :: libruby,site_ruby,$HOME)']
43
- ]
44
-
45
- # List of configurable options.
46
- OPTIONS = DESCRIPTIONS.collect{ |(k,t,v)| k.to_s }
47
-
48
- # Pathname attribute. Pathnames are automatically expanded
49
- # unless they start with '$', a path variable.
50
- def self.attr_pathname(name)
51
- class_eval %{
52
- def #{name}
53
- @#{name}.gsub(%r<\\$([^/]+)>){ self[$1] }
54
- end
55
- def #{name}=(path)
56
- raise Error, "bad config: #{name.to_s.upcase} requires argument" unless path
57
- @#{name} = (path[0,1] == '$' ? path : File.expand_path(path))
58
- end
59
- }
60
- end
61
-
62
- # List of pathnames. These are not expanded though.
63
- def self.attr_pathlist(name)
64
- class_eval %{
65
- def #{name}
66
- @#{name}
67
- end
68
- def #{name}=(pathlist)
69
- case pathlist
70
- when Array
71
- @#{name} = pathlist
72
- else
73
- @#{name} = pathlist.to_s.split(/[:;,]/)
74
- end
75
- end
76
- }
77
- end
78
-
79
- # Adds boolean support.
80
- def self.attr_accessor(*names)
81
- bools, attrs = names.partition{ |name| name.to_s =~ /\?$/ }
82
- attr_boolean *bools
83
- super *attrs
84
- end
85
-
86
- # Boolean attribute. Can be assigned true, false, nil, or
87
- # a string matching yes|true|y|t or no|false|n|f.
88
- def self.attr_boolean(*names)
89
- names.each do |name|
90
- name = name.to_s.chomp('?')
91
- attr_reader name # MAYBE: Deprecate
92
- code = %{
93
- def #{name}?; @#{name}; end
94
- def #{name}=(val)
95
- case val
96
- when true, false, nil
97
- @#{name} = val
98
- else
99
- case val.to_s.downcase
100
- when 'y', 'yes', 't', 'true'
101
- @#{name} = true
102
- when 'n', 'no', 'f', 'false'
103
- @#{name} = false
104
- else
105
- raise Error, "bad config: use #{name.upcase}=(yes|no) [\#{val}]"
106
- end
107
- end
108
- end
109
- }
110
- class_eval code
111
- end
112
- end
113
-
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
124
-
125
- # # provide verbosity (default is true)
126
- # attr_accessor :verbose?
127
-
128
- # # don't actually write files to system
129
- # attr_accessor :no_harm?
130
-
131
- # shebang has only three options.
132
- def shebang=(val)
133
- if %w(all ruby never).include?(val)
134
- @shebang = val
135
- else
136
- raise Error, "bad config: use SHEBANG=(all|ruby|never) [#{val}]"
137
- end
138
- end
139
-
140
- # installdirs has only three options; and it has side-effects.
141
- def installdirs=(val)
142
- @installdirs = val
143
- case val.to_s
144
- when 'std'
145
- self.rbdir = '$librubyver'
146
- self.sodir = '$librubyverarch'
147
- when 'site'
148
- self.rbdir = '$siterubyver'
149
- self.sodir = '$siterubyverarch'
150
- when 'home'
151
- raise Error, 'HOME is not set.' unless ENV['HOME']
152
- self.prefix = ENV['HOME']
153
- self.rbdir = '$libdir/ruby'
154
- self.sodir = '$libdir/ruby'
155
- else
156
- raise Error, "bad config: use INSTALLDIRS=(std|site|home|local) [#{val}]"
157
- end
158
- end
159
-
160
- # New ConfigTable
161
- def initialize(values=nil)
162
- initialize_attributes
163
- initialize_defaults
164
- if values
165
- values.each{ |k,v| __send__("#{k}=", v) }
166
- end
167
- yeild(self) if block_given?
168
- load_config if File.file?(CONFIGFILE)
169
- end
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
-
194
- # Assign CONFIG defaults
195
- #
196
- # TODO: Does this handle 'nmake' on windows?
197
- #
198
- def initialize_defaults
199
- prefix = RBCONFIG['prefix']
200
-
201
- rubypath = File.join(RBCONFIG['bindir'], RBCONFIG['ruby_install_name'] + RBCONFIG['EXEEXT'])
202
-
203
- major = RBCONFIG['MAJOR'].to_i
204
- minor = RBCONFIG['MINOR'].to_i
205
- teeny = RBCONFIG['TEENY'].to_i
206
- version = "#{major}.#{minor}"
207
-
208
- # ruby ver. >= 1.4.4?
209
- newpath_p = ((major >= 2) or
210
- ((major == 1) and
211
- ((minor >= 5) or
212
- ((minor == 4) and (teeny >= 4)))))
213
-
214
- if RBCONFIG['rubylibdir']
215
- # V > 1.6.3
216
- libruby = "#{prefix}/lib/ruby"
217
- librubyver = RBCONFIG['rubylibdir']
218
- librubyverarch = RBCONFIG['archdir']
219
- siteruby = RBCONFIG['sitedir']
220
- siterubyver = RBCONFIG['sitelibdir']
221
- siterubyverarch = RBCONFIG['sitearchdir']
222
- elsif newpath_p
223
- # 1.4.4 <= V <= 1.6.3
224
- libruby = "#{prefix}/lib/ruby"
225
- librubyver = "#{prefix}/lib/ruby/#{version}"
226
- librubyverarch = "#{prefix}/lib/ruby/#{version}/#{c['arch']}"
227
- siteruby = RBCONFIG['sitedir']
228
- siterubyver = "$siteruby/#{version}"
229
- siterubyverarch = "$siterubyver/#{RBCONFIG['arch']}"
230
- else
231
- # V < 1.4.4
232
- libruby = "#{prefix}/lib/ruby"
233
- librubyver = "#{prefix}/lib/ruby/#{version}"
234
- librubyverarch = "#{prefix}/lib/ruby/#{version}/#{c['arch']}"
235
- siteruby = "#{prefix}/lib/ruby/#{version}/site_ruby"
236
- siterubyver = siteruby
237
- siterubyverarch = "$siterubyver/#{RBCONFIG['arch']}"
238
- end
239
-
240
- if arg = RBCONFIG['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
241
- makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
242
- else
243
- makeprog = 'make'
244
- end
245
-
246
- parameterize = lambda do |path|
247
- val = RBCONFIG[path]
248
- raise "Unknown path -- #{path}" if val.nil?
249
- val.sub(/\A#{Regexp.quote(prefix)}/, '$prefix')
250
- end
251
-
252
- self.prefix = prefix
253
- self.bindir = parameterize['bindir']
254
- self.libdir = parameterize['libdir']
255
- self.datadir = parameterize['datadir']
256
- self.mandir = parameterize['mandir']
257
- self.docdir = File.dirname(parameterize['docdir']) # b/c of trailing $(PACKAGE)
258
- self.sysconfdir = parameterize['sysconfdir']
259
- self.localstatedir = parameterize['localstatedir']
260
- self.libruby = libruby
261
- self.librubyver = librubyver
262
- self.librubyverarch = librubyverarch
263
- self.siteruby = siteruby
264
- self.siterubyver = siterubyver
265
- self.siterubyverarch = siterubyverarch
266
- self.rbdir = '$siterubyver'
267
- self.sodir = '$siterubyverarch'
268
- self.rubypath = rubypath
269
- self.rubyprog = rubypath
270
- self.makeprog = makeprog
271
- self.extconfopt = ''
272
- self.shebang = 'ruby'
273
- self.withoutext = 'no'
274
- self.withoutdoc = 'no'
275
- self.doctemplate = nil
276
- self.testrunner = 'auto' # needed?
277
- self.installdirs = 'site'
278
- end
279
-
280
- # Get configuration from environment.
281
- def env_config
282
- OPTIONS.each do |name|
283
- if value = ENV[name]
284
- __send__("#{name}=",value)
285
- end
286
- end
287
- end
288
-
289
- # Load configuration.
290
- def load_config
291
- #if File.file?(CONFIGFILE)
292
- begin
293
- File.foreach(CONFIGFILE) do |line|
294
- k, v = *line.split(/=/, 2)
295
- k.gsub!('-','_')
296
- __send__("#{k}=",v.strip) #self[k] = v.strip
297
- end
298
- rescue Errno::ENOENT
299
- raise Error, $!.message + "\n#{File.basename($0)} config first"
300
- end
301
- #end
302
- end
303
-
304
- # Save configuration.
305
- def save_config
306
- FileUtils.mkdir_p(File.dirname(CONFIGFILE))
307
- File.open(CONFIGFILE, 'w') do |f|
308
- OPTIONS.each do |name|
309
- val = self[name]
310
- f << "#{name}=#{val}\n"
311
- end
312
- end
313
- end
314
-
315
- def show
316
- fmt = "%-20s %s\n"
317
- OPTIONS.each do |name|
318
- value = self[name]
319
- reslv = __send__(name)
320
- case reslv
321
- when String
322
- reslv = "(none)" if reslv.empty?
323
- when false, nil
324
- reslv = "no"
325
- when true
326
- reslv = "yes"
327
- end
328
- printf fmt, name, reslv
329
- end
330
- end
331
-
332
- #
333
- def extconfs
334
- @extconfs ||= Dir['ext/**/extconf.rb']
335
- end
336
-
337
- def extensions
338
- @extensions ||= extconfs.collect{ |f| File.dirname(f) }
339
- end
340
-
341
- def compiles?
342
- !extensions.empty?
343
- end
344
-
345
- private
346
-
347
- # Get unresloved attribute.
348
- def [](name)
349
- instance_variable_get("@#{name}")
350
- end
351
-
352
- # Set attribute.
353
- def []=(name, value)
354
- instance_variable_set("@#{name}", value)
355
- end
356
-
357
- # Resolved attribute. (for paths)
358
- #def resolve(name)
359
- # self[name].gsub(%r<\\$([^/]+)>){ self[$1] }
360
- #end
361
-
362
- # Metaconfig file is '.config/setup/metaconfig{,.rb}'.
363
- def load_meta_config
364
- path = Dir.glob('.config/setup/metaconfig{,.rb}').first
365
- if path && File.file?(path)
366
- MetaConfigEnvironment.new(self).instance_eval(File.read(path), path)
367
- end
368
- end
369
-
370
- #= Meta Configuration
371
- # This works a bit differently from 3.4.1.
372
- # Defaults are currently not supported but remain in the method interfaces.
373
- class MetaConfigEnvironment
374
- def initialize(config) #, installer)
375
- @config = config
376
- #@installer = installer
377
- end
378
-
379
- #
380
- def config_names
381
- @config.descriptions.collect{ |n, t, d| n.to_s }
382
- end
383
-
384
- #
385
- def config?(name)
386
- @config.descriptions.find do |sym, type, desc|
387
- sym.to_s == name.to_s
388
- end
389
- end
390
-
391
- #
392
- def bool_config?(name)
393
- @config.descriptions.find do |sym, type, desc|
394
- sym.to_s == name.to_s && type == :bool
395
- end
396
- #@config.lookup(name).config_type == 'bool'
397
- end
398
-
399
- #
400
- def path_config?(name)
401
- @config.descriptions.find do |sym, type, desc|
402
- sym.to_s == name.to_s && type == :path
403
- end
404
- #@config.lookup(name).config_type == 'path'
405
- end
406
-
407
- #
408
- def value_config?(name)
409
- @config.descriptions.find do |sym, type, desc|
410
- sym.to_s == name.to_s && type != :prog
411
- end
412
- #@config.lookup(name).config_type != 'exec'
413
- end
414
-
415
- #
416
- def add_config(name, default, desc)
417
- @config.descriptions << [name.to_sym, nil, desc]
418
- #@config.add item
419
- end
420
-
421
- #
422
- def add_bool_config(name, default, desc)
423
- @config.descriptions << [name.to_sym, :bool, desc]
424
- #@config.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
425
- end
426
-
427
- #
428
- def add_path_config(name, default, desc)
429
- @config.descriptions << [name.to_sym, :path, desc]
430
- #@config.add PathItem.new(name, 'path', default, desc)
431
- end
432
-
433
- #
434
- def set_config_default(name, default)
435
- @config[name] = default
436
- end
437
-
438
- #
439
- def remove_config(name)
440
- item = @config.descriptions.find do |sym, type, desc|
441
- sym.to_s == name.to_s
442
- end
443
- index = @config.descriptions.index(item)
444
- @config.descriptions.delete(index)
445
- #@config.remove(name)
446
- end
447
- end
448
-
449
- end #class ConfigTable
450
-
451
- end #module Setup
452
-