ratch 0.3.0 → 0.4.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 (132) hide show
  1. data/{log/history → CHANGES} +0 -0
  2. data/{log/todo → TODO} +0 -0
  3. data/bin/manifest +451 -0
  4. data/bin/ratch +3 -3
  5. data/demo/task/config.yaml +4 -0
  6. data/lib/ratch/{batch/argvutils.rb → dsl/argv.rb} +9 -4
  7. data/lib/ratch/dsl/batch.rb +226 -0
  8. data/lib/ratch/{batch → dsl}/build.rb +83 -4
  9. data/lib/ratch/{batch/consoleutils.rb → dsl/console.rb} +13 -5
  10. data/lib/ratch/{batch/emailutils.rb → dsl/email.rb} +21 -25
  11. data/lib/ratch/{batch/fileutils.rb → dsl/file.rb} +56 -56
  12. data/lib/ratch/dsl/meta.rb +132 -0
  13. data/lib/ratch/{batch → dsl}/options.rb +7 -5
  14. data/lib/ratch/dsl/setup.rb +124 -0
  15. data/lib/ratch/{support/signiture.rb → dsl/sign.rb} +9 -18
  16. data/lib/ratch/dsl/stage.rb +147 -0
  17. data/lib/ratch/dsl/task.rb +139 -0
  18. data/lib/ratch/{uploadutils.rb → dsl/upload.rb} +7 -5
  19. data/lib/ratch/{batch/task.rb → dsl/zip.rb} +30 -14
  20. data/lib/ratch/dsl.rb +52 -0
  21. data/lib/ratch/extra/email.rb +5 -0
  22. data/lib/ratch/extra/stage.rb +5 -0
  23. data/lib/ratch/extra/zip.rb +5 -0
  24. data/lib/ratch/manifest.rb +540 -0
  25. data/lib/ratch/{project → metadata}/information.rb +1 -0
  26. data/lib/ratch/{project → metadata}/package.rb +28 -2
  27. data/lib/ratch/{project → metadata}/project.rb +8 -16
  28. data/lib/ratch/{project → metadata}/release.rb +6 -6
  29. data/lib/ratch/support/errors.rb +4 -0
  30. data/lib/ratch/support/filename.rb +18 -0
  31. data/lib/ratch/toolset/ruby/compile +49 -0
  32. data/lib/ratch/toolset/ruby/pack/gem +26 -18
  33. data/lib/ratch/toolset/ruby/pack/tgz +25 -64
  34. data/lib/ratch/toolset/ruby/pack/zip +46 -0
  35. data/lib/ratch/toolset/ruby/publish +23 -24
  36. data/lib/ratch/toolset/ruby/release +8 -0
  37. data/lib/ratch/toolset/ruby/stamp +33 -0
  38. data/lib/ratch/toolset/sandbox +11 -0
  39. data/meta/MANIFEST +101 -23
  40. data/meta/ROLLRC +1 -1
  41. data/meta/config.yaml +10 -0
  42. data/meta/icli.yaml +2 -2
  43. data/meta/project.yaml +9 -10
  44. data/meta/xProjectInfo +41 -0
  45. data/task/release +1 -4
  46. metadata +82 -156
  47. data/demo/task/rdoc +0 -88
  48. data/demo/task/rdoc-old +0 -182
  49. data/doc/images/clipboard.jpg +0 -0
  50. data/doc/images/clipboard2.png +0 -0
  51. data/doc/images/milles-tn.jpg +0 -0
  52. data/doc/images/mints.png +0 -0
  53. data/doc/images/ratch2.png +0 -0
  54. data/doc/images/ruby-sm.png +0 -0
  55. data/doc/images/silver.gif +0 -0
  56. data/doc/images/toolbox.jpg +0 -0
  57. data/doc/index.html +0 -181
  58. data/doc/notes/original.rb +0 -308
  59. data/doc/rdoc/classes/Array.html +0 -194
  60. data/doc/rdoc/classes/Dir.html +0 -317
  61. data/doc/rdoc/classes/Hash.html +0 -217
  62. data/doc/rdoc/classes/Ratch/ArgvUtils/Ext.html +0 -285
  63. data/doc/rdoc/classes/Ratch/ArgvUtils.html +0 -173
  64. data/doc/rdoc/classes/Ratch/BatchFile.html +0 -207
  65. data/doc/rdoc/classes/Ratch/BatchManager.html +0 -250
  66. data/doc/rdoc/classes/Ratch/BatchScript.html +0 -127
  67. data/doc/rdoc/classes/Ratch/Batchable.html +0 -373
  68. data/doc/rdoc/classes/Ratch/Build.html +0 -321
  69. data/doc/rdoc/classes/Ratch/BuildManager.html +0 -319
  70. data/doc/rdoc/classes/Ratch/Buildable.html +0 -202
  71. data/doc/rdoc/classes/Ratch/ConfigUtils.html +0 -281
  72. data/doc/rdoc/classes/Ratch/ConsoleUtils.html +0 -189
  73. data/doc/rdoc/classes/Ratch/EmailUtils.html +0 -209
  74. data/doc/rdoc/classes/Ratch/FileUtils.html +0 -674
  75. data/doc/rdoc/classes/Ratch/GeneralOptions.html +0 -430
  76. data/doc/rdoc/classes/Ratch/Task.html +0 -201
  77. data/doc/rdoc/classes/Ratch/TaskManager.html +0 -330
  78. data/doc/rdoc/classes/Ratch/Taskable.html +0 -231
  79. data/doc/rdoc/classes/Ratch/UploadUtils.html +0 -566
  80. data/doc/rdoc/classes/Ratch.html +0 -201
  81. data/doc/rdoc/created.rid +0 -1
  82. data/doc/rdoc/files/COPYING.html +0 -1003
  83. data/doc/rdoc/files/README.html +0 -143
  84. data/doc/rdoc/files/lib/ratch/argvutils_rb.html +0 -131
  85. data/doc/rdoc/files/lib/ratch/batch_rb.html +0 -155
  86. data/doc/rdoc/files/lib/ratch/batchable_rb.html +0 -131
  87. data/doc/rdoc/files/lib/ratch/batchfile_rb.html +0 -148
  88. data/doc/rdoc/files/lib/ratch/buildable_rb.html +0 -131
  89. data/doc/rdoc/files/lib/ratch/consoleutils_rb.html +0 -131
  90. data/doc/rdoc/files/lib/ratch/emailutils_rb.html +0 -139
  91. data/doc/rdoc/files/lib/ratch/facets/multiglob_rb.html +0 -137
  92. data/doc/rdoc/files/lib/ratch/fileutils_rb.html +0 -139
  93. data/doc/rdoc/files/lib/ratch/options_rb.html +0 -131
  94. data/doc/rdoc/files/lib/ratch/taskable_rb.html +0 -131
  95. data/doc/rdoc/files/lib/ratch/uploadutils_rb.html +0 -150
  96. data/doc/rdoc/fr_class_index.html +0 -48
  97. data/doc/rdoc/fr_file_index.html +0 -41
  98. data/doc/rdoc/fr_method_index.html +0 -133
  99. data/doc/rdoc/index.html +0 -24
  100. data/doc/rdoc/rdoc-style.css +0 -208
  101. data/doc/scrap/flexihead-flip.jpg +0 -0
  102. data/doc/scrap/flexihead.jpg +0 -0
  103. data/doc/scrap/head1.jpg +0 -0
  104. data/doc/scrap/ratch.jpg +0 -0
  105. data/doc/scrap/ratch1.png +0 -0
  106. data/doc/scrap/ratch2.jpg +0 -0
  107. data/doc/scrap/ratch3.png +0 -0
  108. data/doc/scrap/red-ratch.jpg +0 -0
  109. data/doc/scrap/redratchet.jpg +0 -0
  110. data/doc/scrap/ruby-kit/ruby.png +0 -0
  111. data/doc/scrap/scrap.red +0 -256
  112. data/doc/sitemap.yaml +0 -10
  113. data/doc/siteparts/index.red +0 -100
  114. data/doc/siteparts/layout.rhtml +0 -56
  115. data/doc/siteparts/tutorial.red +0 -578
  116. data/doc/style.css +0 -112
  117. data/doc/tutorial.html +0 -722
  118. data/lib/ratch/batch.rb +0 -488
  119. data/lib/ratch/support/setuputils.rb +0 -124
  120. data/lib/ratch/support/stage.rb +0 -292
  121. data/lib/ratch/toolset/ruby/rdoc +0 -88
  122. data/task/rdoc +0 -6
  123. data/work/old/batchfile.rb +0 -95
  124. data/work/project-old.rb +0 -67
  125. data/work/scrap/install +0 -89
  126. data/work/scrap/install.0 +0 -49
  127. data/work/scrap/install.1 +0 -63
  128. data/work/scrap/ludo +0 -25
  129. data/work/scrap/oldtaskable.rb +0 -573
  130. data/work/scrap/ratch.man +0 -39
  131. data/work/scrap/taskable-simple.rb +0 -42
  132. data/work/scrap/taskable.rb +0 -120
data/lib/ratch/batch.rb DELETED
@@ -1,488 +0,0 @@
1
- # = TITLE:
2
- #
3
- # BatchFile
4
- #
5
- # = COPYING:
6
- #
7
- # Copyright (c) 2007 Psi T Corp.
8
- #
9
- # This file is part of the ProUtils' Ratch program.
10
- #
11
- # Ratch is free software: you can redistribute it and/or modify
12
- # it under the terms of the GNU General Public License as published by
13
- # the Free Software Foundation, either version 3 of the License, or
14
- # (at your option) any later version.
15
- #
16
- # Ratch is distributed in the hope that it will be useful,
17
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- # GNU General Public License for more details.
20
- #
21
- # You should have received a copy of the GNU General Public License
22
- # along with Ratch. If not, see <http://www.gnu.org/licenses/>.
23
-
24
- #require 'shellwords'
25
- require 'yaml'
26
- require 'rbconfig' # replace with facets/rbsystem in future ?
27
- #require 'facets/hash/merge' # for reverse_merge
28
-
29
- require 'ratch/batch/options'
30
-
31
- require 'ratch/batch/consoleutils'
32
- require 'ratch/batch/configutils'
33
- require 'ratch/batch/emailutils'
34
- require 'ratch/batch/fileutils'
35
- require 'ratch/batch/argvutils'
36
-
37
- require 'ratch/batch/task'
38
- require 'ratch/batch/build'
39
-
40
-
41
- module Ratch
42
-
43
- # If no batch file is found.
44
-
45
- class NoBatchError < Exception
46
- end
47
-
48
- # This is a type of functor, that allows for calling batch files
49
- # that are in subdirectories using "dir.file" notation. Eg.
50
- #
51
- # svn.log
52
- #
53
- # could run the svn/log ratch file.
54
-
55
- class BatchDirectory
56
- private *instance_methods.select{ |m| m !~ /^__/ }
57
-
58
- def initialize(manager, directory)
59
- @manager = manager
60
- @directory = directory
61
- end
62
-
63
- def method_missing(sym, *args)
64
- path = File.join(@directory, sym.to_s)
65
- @manager.open_batch(path, *args)
66
- end
67
- end
68
-
69
- # BatchScript module defines the DSL available to a ratch script.
70
-
71
- module BatchScript #< Module
72
-
73
- include GeneralOptions
74
- include ConsoleUtils
75
- include ArgvUtils
76
- include FileUtils
77
- include ConfigUtils
78
- include EmailUtils
79
-
80
- # Shell runner.
81
-
82
- def sh(cmd)
83
- if noharm?
84
- puts cmd
85
- true
86
- else
87
- puts "--> system call: #{cmd}" if trace?
88
- system(cmd)
89
- end
90
- end
91
-
92
- # Abort running.
93
- #def abort(msg=nil)
94
- # puts msg if msg
95
- # exit 0
96
- #end
97
-
98
- def root_directory
99
- @root_directory ||= Dir.pwd
100
- end
101
-
102
- def call_directory
103
- @call_directory ||= File.expand_path(File.dirname($0))
104
- end
105
-
106
- # TODO Better name? Better definition? (Won't handle task subdirs!).
107
-
108
- def batch_directory
109
- @batch_directory ||= (
110
- dir = call_directory.sub(root_directory + '/', '').split('/').first
111
- File.join(root_directory, dir)
112
- )
113
- end
114
-
115
- # Run batch file and cache result.
116
- #
117
- # Usually this can be taken care of by method_missing.
118
- # But, in some cases, built in method names block batch
119
- # calls, so you have to use #batch to invoke those.
120
-
121
- def batch(batchfile, arguments=nil)
122
- batch_cache[batchfile] ||= launch(batchfile, arguments)
123
- end
124
-
125
- # Lauch a batch file. Like #batch but not-cached.
126
- # Run a batch file.
127
- # TODO: How to handle arguments?
128
-
129
- def launch(batchfile, arguments=nil)
130
- # # TODO probably should raise error instead
131
- # abort "missing batch file -- #{batchfile}" unless File.file?(batchfile)
132
-
133
- #BatchFile.new(batchfile).call # Old way with batch execution context object.
134
- script = File.read($0 = batchfile)
135
- #eval(script, $batch_binding, $0)
136
- eval(script, TOPLEVEL_BINDING, $0)
137
-
138
- batch_file = File.expand_path($0).sub(batch_directory + '/', '')
139
- call_task(batch_file)
140
- end
141
-
142
- # Is a path a local batch directory?
143
-
144
- def batch_directory?(path)
145
- b = File.dirname($0) + "/#{path}"
146
- b if FileTest.directory?(b)
147
- end
148
-
149
- # Is a file a local batch file?
150
-
151
- def batch?(path)
152
- b = File.dirname($0) + "/#{path}" #.chomp!('!')
153
- b if FileTest.file?(b) && FileTest.executable?(b)
154
- end
155
-
156
- # Is a batch run complete or in the process of being completed?
157
- # Has the batch file been executed before?
158
-
159
- def done?(batchfile)
160
- batchfile == $0 || batch_cache.key?(batchfile)
161
- end
162
-
163
- # Batch cache, which prevents batch runs from re-executing.
164
-
165
- def batch_cache
166
- @batch_cache ||= {}
167
- end
168
-
169
- # If method is missing try to run an external task
170
- # or binary by that name. If it is a binary, arguments
171
- # translate into commandline parameters. For example:
172
- #
173
- # tar 'foo/', :x=>true, :v=>true, :z=>true, :f=>'foo.tar.gz'
174
- #
175
- # or
176
- #
177
- # tar '-xvzf', "foo.tar.gz", "foo/"
178
- #
179
- # becomes
180
- #
181
- # tar -x -v -z -f foo.tar.gz foo/
182
- #
183
- # If it is a task, it will be cached. Tasks only ever run once.
184
- # To run them more than once you can manually execute them with #run.
185
- # Likewise you can manually run and cache by calling #batch.
186
- # This is good to know, b/c in some cases built in method names
187
- # block task calls, so you have to #batch to invoke them.
188
-
189
- def method_missing(sym,*args)
190
- puts "method_missing: #{sym}" if debug?
191
- #begin
192
- open_batch(sym,*args)
193
- #rescue NoBatchError
194
- # super
195
- #end
196
- end
197
-
198
- private
199
-
200
- #
201
-
202
- def open_batch(name, *args)
203
- name = name.to_s
204
- force = name.chomp!('!')
205
-
206
- # is this a batch directory?
207
- if dir = batch_directory?(name)
208
- return BatchDirectory.new(self, dir)
209
- end
210
-
211
- params = args.to_params
212
-
213
- # is this a batch file?
214
- if bat = batch?(name)
215
- if force
216
- cmd = "./#{bat} #{params}"
217
- puts "--> non-cached execution: #{cmd}" if trace?
218
- return launch(bat, args)
219
- else
220
- if done?(bat)
221
- return nil unless bin?(name) # return cache?
222
- else
223
- cmd = "./#{bat} #{params}"
224
- puts "--> cached execution: #{cmd}" if trace?
225
- return batch(bat, args)
226
- end
227
- end
228
- end
229
-
230
- # is this a bin file?
231
- if bin = bin?(name)
232
- cmd = "#{File.basename(bin)} #{params}"
233
- return sh(cmd)
234
- end
235
-
236
- raise NoBatchError, "no extecutable file found -- #{name}"
237
- end
238
-
239
- public
240
-
241
- # Define main task.
242
-
243
- def main(name, &block)
244
- name, deps, block = *parse_task_dependencies(name, &block)
245
- define_main(name, *deps, &block)
246
- end
247
-
248
- # Define a task.
249
-
250
- def task(name, &block)
251
- name, deps, block = *parse_task_dependencies(name, &block)
252
- define_task(name, *deps, &block)
253
- end
254
-
255
- # Run a task.
256
-
257
- def run(name, arguments=nil)
258
- call_task(name)
259
- end
260
-
261
- private
262
-
263
- def tasks ; @tasks ||= {} ; end
264
-
265
- # TODO If @main is nil try task by same name a file (?)
266
-
267
- def main_task
268
- @main
269
- end
270
-
271
- #
272
-
273
- def parse_task_dependencies(name_deps, &block)
274
- if Hash===name_deps
275
- name = name_deps.keys[0]
276
- deps = name_deps.values[0]
277
- else
278
- name = name_deps
279
- deps = []
280
- end
281
- [name, deps, block]
282
- end
283
-
284
- def define_main(name=nil, *depend, &block)
285
- @main = define_task(name, *depend, &block)
286
- #@main = Task.new(name, *depend, &block)
287
- #tasks[@main.name] = @main
288
- end
289
-
290
- def define_task(name, *depend, &block)
291
- task = Task.new(name, *depend, &block)
292
- tasks[task.name] = task
293
- end
294
-
295
- # Call main task.
296
-
297
- def call_main #(task=nil)
298
- #@main ||= task
299
- #return unless @main || task
300
- call_task(main_task.name)
301
- end
302
-
303
- # Call task.
304
-
305
- def call_task(name)
306
- task_plan(name).each{ |name| tasks[name].call }
307
- end
308
-
309
- # Prepare plan, checking for circular dependencies.
310
-
311
- def task_plan(name, list=[])
312
- if list.include?(name)
313
- raise "Circular dependency #{name}."
314
- end
315
- if task = tasks[name]
316
- task.needs.each do |need|
317
- need = need.to_s
318
- next if list.include?(need)
319
- #@tasks[need].task_plan(need, list)
320
- task_plan(need, list)
321
- end
322
- list << task.name
323
- else
324
- # TODO THIS TIES TASKS INTO BATCH, BETTER WAY?
325
- if name != main_task && fname = batch?(name)
326
- task = Task.new(name) do
327
- batch(fname)
328
- end
329
- tasks[name] = task
330
- list << task.name
331
- else
332
- abort "no task -- #{name}"
333
- end
334
- end
335
- return list
336
- end
337
-
338
- public
339
-
340
- # Define a build target.
341
-
342
- def file(name, &block)
343
- name, deps, block = *parse_build_dependencies(name, &block)
344
- define_file(name, *deps, &block)
345
- end
346
-
347
- # Build target(s).
348
-
349
- def build(file)
350
- call_build(file)
351
- end
352
-
353
- private
354
-
355
- def builds; @builds ||= [] ; end
356
-
357
- #
358
- def parse_build_dependencies(name_deps, &block)
359
- if Hash===name_deps
360
- name = name_deps.keys[0]
361
- deps = name_deps.values[0]
362
- else
363
- name = name_deps
364
- deps = []
365
- end
366
- [name, deps, block]
367
- end
368
-
369
- # Define a file build task.
370
-
371
- def define_file(name, *depend, &block)
372
- build = Build.new(name, *depend, &block)
373
- builds << build
374
- end
375
-
376
- # Call build.
377
-
378
- def call_build(path)
379
- # TODO How to handle more than one matching means of building?
380
- #warn "More than one build definition matches #{path} using #{means.first}" if means.size > 1
381
- if build = find(path)
382
- if build.needed_for?(path) || force?
383
- list, todo = *build_plan(build, path)
384
- todo.each{|bld, pth| bld.call(pth) } #@builds[name].call }
385
- build.call(path)
386
- end
387
- else
388
- raise "build not found -- #{path}"
389
- end
390
- end
391
-
392
- def find(path)
393
- builds.find{ |b| b.match?(path) }
394
- end
395
-
396
- # Prepare build plan, checking for circular dependencies.
397
-
398
- def build_plan(build, path, list=[], todo=[])
399
- #if list.include?(build)
400
- # raise "Circular build dependency #{build.name}."
401
- #end
402
-
403
- build.needed_paths.each do |npath|
404
- next if list.include?(npath)
405
- if nbuild = find(npath)
406
- build_plan(nbuild, npath, list, todo)
407
- todo << [nbuild, npath]
408
- else
409
- list << npath
410
- end
411
- end
412
-
413
- return list, todo
414
- end
415
-
416
-
417
- # OLD WAY
418
- # def method_missing(sym,*args)
419
- # name = sym.to_s
420
- #
421
- # bat = batch?(name) # is this a batch file?
422
- # done = bat && done?(bat)
423
- # cache = bat && !done && name[1,-1] != '!'
424
- # bin = bin?(name) if (!bat || done)
425
- # none = bat && done && !bin
426
- # #bat = name if bin
427
- #
428
- # return super unless bat || bin
429
- #
430
- # return if none # nothing to do
431
- #
432
- # params = args.to_params
433
- #
434
- # if bin
435
- # cmd = "#{File.basename(bin)} #{params}"
436
- # res = sh(cmd)
437
- # elsif bat
438
- # cmd = "./#{bat} #{params}"
439
- # puts "--> #{cache ? '' : 'not-'}cached execution: #{cmd}" if trace?
440
- # res = batch(bat, args)
441
- # if cache
442
- # #@batch_catch[bat] ||= (system(cmd); true)
443
- # #batch_cache[bat] ||= res
444
- # batch_manager.cache ||= res
445
- # end
446
- # end
447
- #
448
- # return res
449
-
450
-
451
- # Quick start, equivalent to calling new.run(file).
452
- #def self.start(file)
453
- # new(file).call
454
- #end
455
-
456
- # New Batch File
457
- #def initialize(file)
458
- # abort "missing batch file -- #{file}" unless File.file?(file)
459
- # @file = file
460
- #end
461
-
462
- # TODO What todo about arguments?
463
- #def call(arguments=nil)
464
- # script = File.read($0 = @file)
465
- # eval(script, binding, $0) #instance_eval(script)
466
- # #@main.call if @main
467
- # call_main
468
- # #run(:main) if task_manager.main
469
- # end
470
-
471
- end
472
-
473
- end
474
-
475
- # Load BatchScript into to toplevel.
476
- #
477
- # TODO: Should this be in all Object space (ie. no class << self)?
478
-
479
- class << self
480
- include Ratch::BatchScript
481
- end
482
-
483
- END {
484
- #task = File.expand_path($0).sub(batch_directory + '/', '')
485
- call_main #(task)
486
- }
487
-
488
- #$batch_binding = binding
@@ -1,124 +0,0 @@
1
- # FILE:
2
- #
3
- # setup.rb
4
- #
5
- # SUMMARY:
6
- #
7
- # Mixen used to setup a package, eg. a manual install.
8
- #
9
- # COPYING:
10
- #
11
- # Copyright (c) 2007 Psi T Corp.
12
- #
13
- # This file is part of the ProUtils' Box program.
14
- #
15
- # Box is free software: you can redistribute it and/or modify
16
- # it under the terms of the GNU General Public License as published by
17
- # the Free Software Foundation, either version 3 of the License, or
18
- # (at your option) any later version.
19
- #
20
- # Box is distributed in the hope that it will be useful,
21
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- # GNU General Public License for more details.
24
- #
25
- # You should have received a copy of the GNU General Public License
26
- # along with Box. If not, see <http://www.gnu.org/licenses/>.
27
-
28
- #
29
- module Box
30
-
31
- # = setup utilties
32
- #
33
- # Setup utilities provides a convenient way to install
34
- # a ruby project via setup.rb.
35
-
36
- module SetupUtils
37
-
38
- # If setup.rb is not found add a copy to the project.
39
-
40
- def setup_rb
41
- unless File.exist?('setup.rb')
42
- f = File.join(libdir,'vendor','setup.rb')
43
- if File.exist?(f)
44
- cp(f,'.')
45
- else
46
- abort "setup.rb is not avaialble"
47
- end
48
- end
49
- true
50
- end
51
-
52
- # Installation to a prefix destination using setup.rb.
53
- # Some package types need this.
54
-
55
- def prefix_install( prefix )
56
- FileUtils.mkdir_p( prefix )
57
- Dir.chdir( folder ) do
58
- unless setup_rb
59
- raise "Setup.rb is missing. Forced to abort."
60
- end
61
- # mock install
62
- cmd = ''
63
- cmd << 'ruby setup.rb '
64
- cmd << '-q ' unless project.verbose?
65
- cmd << 'config --installdirs=std ; '
66
- cmd << 'ruby setup.rb '
67
- cmd << '-q ' unless project.verbose?
68
- cmd << "install --prefix=#{prefix}"
69
- sh cmd
70
- end
71
- end
72
-
73
- # Setup and install. This builds and installs a project
74
- # using setup.rb or install.rb. If neither exist setup.rb
75
- # will be created for the purpose.
76
- #
77
- # options Command line options to add to shell command.
78
- # script Install script, default is install.rb or setup.rb
79
- #--
80
- # source Location of source. (Defaults to current directory)
81
- #++
82
-
83
- def setup( keys={} )
84
- #keys |= project.select(:options=>:setup_options, :script=>:setup_script)
85
-
86
- options = keys['options']
87
- script = keys['script']
88
- #source = keys.source || Dir.pwd
89
-
90
- options = [options].flatten.compact
91
-
92
- if script
93
- exe = script + ' '
94
- exe << options.join(' ')
95
- elsif File.exist?('install.rb')
96
- exe = 'ruby install.rb '
97
- exe << options.join(' ')
98
- elsif File.exist?('setup.rb') or setup_rb
99
- exe = 'ruby setup.rb '
100
- exe << '-q ' unless project.verbose?
101
- exe << options.join(' ')
102
- exe << ' all'
103
- else
104
- puts "Script setup.rb or install.rb is missing."
105
- return nil
106
- end
107
-
108
- # SHELLS OUT!
109
-
110
- #Dir.chdir(source) do
111
- #begin
112
- success = sh( exe )
113
- puts "Installation complete!" if success
114
- #rescue Errno::EACCES
115
- # puts "Permission denied"
116
- # exit -1
117
- #end
118
- #end
119
- end
120
-
121
- end
122
-
123
- end
124
-