ratch 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
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
File without changes
data/{log/todo → TODO} RENAMED
File without changes
data/bin/manifest ADDED
@@ -0,0 +1,451 @@
1
+ #! /usr/bin/ruby1.8
2
+
3
+ # TITLE
4
+ #
5
+ # Manifest Command
6
+ #
7
+ # SUMMARY:
8
+ #
9
+ # Commandline tool for generating and comparing package manifest.
10
+ #
11
+ # AUTHOR:
12
+ #
13
+ # - Thomas Sawyer
14
+
15
+ require 'facets/command'
16
+ require 'facets/module/alias'
17
+ require 'ratch/manifest'
18
+
19
+ module Ratch
20
+
21
+ # def optparse
22
+ # opts = GetoptLong.new(
23
+ # [ '--file' , '-f', GetoptLong::REQUIRED_ARGUMENT ],
24
+ # [ '--digest' , '-g', GetoptLong::REQUIRED_ARGUMENT ],
25
+ # [ '--exclude', '-x', GetoptLong::REQUIRED_ARGUMENT ],
26
+ # [ '--all' , '-a', GetoptLong::NO_ARGUMENT ],
27
+ # [ '--update' , '-u', GetoptLong::NO_ARGUMENT ],
28
+ # [ '--list' , '-l', GetoptLong::NO_ARGUMENT ],
29
+ # [ '--diff' , '-d', GetoptLong::NO_ARGUMENT ],
30
+ # [ '--new' , '-n', GetoptLong::NO_ARGUMENT ],
31
+ # [ '--old' , '-o', GetoptLong::NO_ARGUMENT ],
32
+ # [ '--clean' , GetoptLong::NO_ARGUMENT ],
33
+ # [ '--help' , '-h', GetoptLong::NO_ARGUMENT ]
34
+ # )
35
+
36
+
37
+ # unless args.empty?
38
+ # if File.file?(args[0])
39
+ # opts[:file] = args[0]
40
+ # opts[:directory] = args[1] if args[1]
41
+ # else
42
+ # opts[:directory] = args[0]
43
+ # opts[:file] = args[1] if args[1]
44
+ # end
45
+ # end
46
+ #
47
+ # @quiet = opts.delete(:quiet)
48
+ # @options = opts
49
+ # @command = cmd
50
+ # end
51
+
52
+
53
+ # Manifest Console Command
54
+
55
+ class ManifestCommand < Console::MasterCommand
56
+ include UniversalOptions
57
+
58
+ option_arity(
59
+ 'x' => 1, 'exclude' => 1,
60
+ 'f' => 1, 'file' => 1,
61
+ 'g' => 1, 'digest' => 1
62
+ )
63
+
64
+ attr_accessor :quiet
65
+
66
+ attr_accessor :file
67
+ attr_accessor :digest
68
+ attr_accessor :exclude
69
+ attr_accessor :all
70
+
71
+ # shorcuts
72
+ alias_accessor :f, :file
73
+ alias_accessor :x, :exclude
74
+ alias_accessor :g, :digest
75
+ alias_accessor :a, :all
76
+
77
+ # Default command -- output manifest.
78
+
79
+ def generate
80
+ if file
81
+ update
82
+ else
83
+ manifest = Manifest.new(manifest_options)
84
+ manifest.generate
85
+ end
86
+ end
87
+
88
+ alias_method :default, :generate
89
+
90
+ # Update a MANIFEST file for this package.
91
+
92
+ def update
93
+ begin
94
+ file = manifest.update
95
+ rescue NoManifestError => e
96
+ puts e.message
97
+ exit -1
98
+ end
99
+ report_updated(file)
100
+ end
101
+ alias_method :up, :update
102
+
103
+ # List files in manifest file.
104
+
105
+ def list
106
+ puts manifest.filelist
107
+ end
108
+
109
+ # Show diff comparison between listed and actual.
110
+
111
+ def diff
112
+ #begin
113
+ result = manifest.diff
114
+ report_difference(result)
115
+ #rescue NoManifestError
116
+ # report_manifest_missing
117
+ #end
118
+ end
119
+
120
+ # Files listed in manifest, but not found.
121
+
122
+ def old
123
+ #begin
124
+ list = manifest.whatsold
125
+ unless list.empty?
126
+ report_whatsold(list)
127
+ end
128
+ #rescue NoManifestError
129
+ # report_manifest_missing
130
+ # exit 0
131
+ #end
132
+ end
133
+
134
+ # Files found, but not listed in manifest.
135
+
136
+ def new
137
+ #begin
138
+ list = manifest.whatsnew
139
+ unless list.empty?
140
+ report_whatsnew(list)
141
+ end
142
+ #rescue NoManifestError
143
+ # report_manifest_missing
144
+ # exit!
145
+ #end
146
+ end
147
+
148
+ # Clean (or clobber if you prefer) non-manifest files.
149
+
150
+ def clean
151
+ ansr = confirm_clean(manifest.clean_files)
152
+ case ansr.downcase
153
+ when 'y', 'yes'
154
+ manifest.clean
155
+ else
156
+ report_cancelled('Clean')
157
+ exit!
158
+ end
159
+ end
160
+
161
+ # Display command help information.
162
+
163
+ def help
164
+ report_help
165
+ end
166
+
167
+ private
168
+
169
+ # Load manifest.
170
+ #--
171
+ # TODO Manifest lookup needs to go in Manifest class?
172
+ #++
173
+
174
+ def manifest
175
+ @manifest ||= (
176
+ begin
177
+ manifest = Manifest.open(file)
178
+ manifest.change_options(manifest_options)
179
+ manifest
180
+ rescue LoadError
181
+ report_manifest_missing
182
+ exit 0
183
+ end
184
+ )
185
+ end
186
+
187
+ def manifest_options
188
+ { :file=>file, :digest=>digest, :exclude=>exclude, :all=>all }
189
+ end
190
+
191
+ # Quiet opertation?
192
+
193
+ def quiet?; @quiet; end
194
+
195
+ # Get confirmation for clean.
196
+
197
+ def confirm_clean(list)
198
+ puts list.join("\n")
199
+ ask("The above files will be removed. Continue?", "yN")
200
+ end
201
+
202
+ # Get confirmation for clobber.
203
+
204
+ def confirm_clobber(list)
205
+ puts list.join("\n")
206
+ ask("The above files will be removed. Continue?", "yN")
207
+ end
208
+
209
+ # Report manifest created.
210
+
211
+ def report_created(file)
212
+ file = File.basename(file)
213
+ puts "#{file} created." unless quiet?
214
+ end
215
+
216
+ # Report manifest updated.
217
+
218
+ def report_updated(file)
219
+ if file
220
+ file = File.basename(file)
221
+ puts "#{file} updated." unless quiet?
222
+ else
223
+ puts "Manifest file doesn't exit."
224
+ end
225
+ end
226
+
227
+ # Display diff between file and actual.
228
+ #--
229
+ # TODO What about checkmode?
230
+ #++
231
+
232
+ def report_difference(result)
233
+ output = nil
234
+ if pass = result.empty?
235
+ if @checkmode
236
+ output = justified('Manifest', '[PASS]') + "\n"
237
+ else
238
+ #"Manifest is current."
239
+ end
240
+ else
241
+ output = result
242
+ end
243
+ puts output if output
244
+ end
245
+
246
+ # Report missing manifest file.
247
+
248
+ def report_whatsnew(list)
249
+ puts list.join("\n")
250
+ end
251
+
252
+ # Report missing manifest file.
253
+
254
+ def report_whatsold(list)
255
+ puts list.join("\n")
256
+ end
257
+
258
+ # Show help.
259
+
260
+ def report_help
261
+ puts DATA.read % [ File.mtime(__FILE__).strftime("%Y-%m-%d") ]
262
+ end
263
+
264
+ # Report missing manifest file.
265
+
266
+ def report_manifest_missing
267
+ puts "No manifest file."
268
+ end
269
+
270
+ # Report action cancelled.
271
+
272
+ def report_cancelled(action)
273
+ puts "#{action} cancelled"
274
+ end
275
+
276
+ # Report manifest overwrite.
277
+
278
+ def report_overwrite(manifest)
279
+ puts "#{manifest.filename} already exists."
280
+ end
281
+
282
+ # Warn that a manifest already exist higher in this hierarchy.
283
+
284
+ def report_warn_shadowing(manifest)
285
+ puts "Shadowing #{manifest.file}"
286
+ end
287
+ end
288
+
289
+ end
290
+
291
+ Ratch::ManifestCommand.start
292
+
293
+ =begin scrap
294
+
295
+ # # Lookup manifest.
296
+ #
297
+ # def manifest(create_missing=false)
298
+ # @manifest ||= (
299
+ # file = @options[:file]
300
+ # #manifest = file ? Manifest.open(file) : Manifest.lookup
301
+ # manifest = nil
302
+ #
303
+ # if file
304
+ # manifest = Manifest.open(file, @options)
305
+ # elsif create_missing
306
+ # manifest = Manifest.new(@options)
307
+ # else
308
+ # manifest = nil
309
+ # end
310
+ #
311
+ # if manifest
312
+ # #manifest.send(:set, @options)
313
+ # else
314
+ # report_manifest_missing
315
+ # exit 0
316
+ # end
317
+ # manifest
318
+ # )
319
+ # end
320
+
321
+ # @manifest ||= (
322
+ # file = @options[:file]
323
+ # #manifest = file ? Manifest.open(file) : Manifest.lookup
324
+ # manifest = nil
325
+ #
326
+ # if file
327
+ # manifest = Manifest.open(file)
328
+ # elsif create_missing
329
+ # manifest = Manifest.new
330
+ # else
331
+ # manifest = nil
332
+ # end
333
+ #
334
+ # if manifest
335
+ # manifest.change_options(@options)
336
+ # else
337
+ # report_manifest_missing
338
+ # exit 0
339
+ # end
340
+ # manifest
341
+ # )
342
+ # end
343
+
344
+ # # Generate manifest. By default it is a very simple filename
345
+ # # list. The digest can be supplied and a checksum will
346
+ # # be given before each filename.
347
+ #
348
+ # def create
349
+ # manifest = Manifest.new #lookup
350
+ #
351
+ # return report_overwrite(manifest) if (
352
+ # manifest and manifest.location == Dir.pwd
353
+ # )
354
+ #
355
+ # report_warn_shadowing(manifest) if manifest
356
+ #
357
+ # manifest = Manifest.new(options)
358
+ # file = manifest.create
359
+ # report_created(file)
360
+ # end
361
+
362
+ # # Clobber non-manifest files.
363
+ # #--
364
+ # # TODO Should clobber work off the manifest file itself
365
+ # #++
366
+ #
367
+ # def clobber
368
+ # ansr = confirm_clobber(manifest.toss)
369
+ # case ansr.downcase
370
+ # when 'y', 'yes'
371
+ # manifest.clobber
372
+ # else
373
+ # report_cancelled('Clobber')
374
+ # exit!
375
+ # end
376
+ # end
377
+
378
+ =end
379
+
380
+
381
+ __END__
382
+ manifest (%s)
383
+
384
+ The manifest listing tool is used to list or create and update a
385
+ manifest file for a package (eg. a directory), or compare a manifest
386
+ to actual contents. lmf is part of the ProUtils set of tools.
387
+
388
+ USAGE:
389
+
390
+ lmf [command] [options...] [file] [dir]
391
+
392
+ EXAMPLES:
393
+
394
+ manifest
395
+ manifest update -f READEME.manifest
396
+
397
+ COMMANDS:
398
+
399
+ When no command is given, a manifest is generated to standard out.
400
+ If --file is specified, it will generate to that file instead.
401
+
402
+ generate
403
+ Create a manifest and send it to stdout. This is the default
404
+ action when no command is given.
405
+
406
+ update up
407
+ Update an existing manifest/digest file using
408
+ any previous parameters set for that file.
409
+
410
+ list
411
+ Show all files listed in the manifest file.
412
+
413
+ diff
414
+ Diff manifest file against actual.
415
+
416
+ new
417
+ List existant files not given in the manifest.
418
+
419
+ old
420
+ Show files listed in manifest but are not in the
421
+ the package.
422
+
423
+ clean
424
+ Remove non-manifest files. (Will ask for confirmation first.)
425
+
426
+ help
427
+ Display this help message.
428
+
429
+ OPTIONS:
430
+
431
+ -a --all
432
+ Include all files. This deactivates deafult exclusions so
433
+ it is possible to make complete list of a contents.
434
+
435
+ -f --file [name]
436
+ Path to manifest file. By defualt this is the 'manifest' with
437
+ optional '.txt' or '.list' extension. it is case-insensitive and
438
+ it can also be in a meta/ subdirectory. If the path of the file is
439
+ anything else then --file option must be specified.
440
+
441
+ -g --digest [type]
442
+ Include crytogrpahic signiture. Type can be either
443
+ md5, sha1, sha128, sha256, or sha512. The default if
444
+ the type is not given id sha1.
445
+
446
+ -x --exclude [path]
447
+ Exclude a file or dir from the manifest. You can
448
+ use --exclude repeatedly.
449
+
450
+ -q --quiet
451
+ Suppress extraneous output.
data/bin/ratch CHANGED
@@ -1,4 +1,4 @@
1
- #! /usr/bin/ruby1.8
1
+ #! /usr/bin/env ruby
2
2
 
3
3
  if ARGV[0] == '-s'
4
4
  require 'ratch/manager'
@@ -7,7 +7,7 @@ if ARGV[0] == '-s'
7
7
  if file
8
8
  # run tool
9
9
  if tool = manager.tool?(file)
10
- require 'ratch/batch'
10
+ require 'ratch/dsl'
11
11
  load(tool)
12
12
  else
13
13
  puts "no tool -- #{file}"
@@ -19,7 +19,7 @@ elsif ARGV.empty?
19
19
  # TODO read stdin for ratch script
20
20
 
21
21
  else
22
- require 'ratch/batch'
22
+ require 'ratch/dsl'
23
23
  load($0 = ARGV.shift)
24
24
  end
25
25
 
@@ -0,0 +1,4 @@
1
+
2
+ rdoc:
3
+ include: [ README, lib ]
4
+
@@ -1,8 +1,8 @@
1
- # TITLE:
1
+ # = TITLE:
2
2
  #
3
- # ArgvUtils
3
+ # Argv DSL
4
4
  #
5
- # COPYING:
5
+ # = COPYING:
6
6
  #
7
7
  # Copyright (c) 2007 Psi T Corp.
8
8
  #
@@ -22,17 +22,19 @@
22
22
  # along with Ratch. If not, see <http://www.gnu.org/licenses/>.
23
23
 
24
24
  module Ratch
25
+ module Dsl
25
26
 
26
27
  # No fuss access to ARGV. This shows up as #commandline in the ratch api.
27
28
  #
28
29
  # Ratch uses '=' for parameterized flags b/c this make parsing stupid simple
29
30
  # and that's a good thing!!! However you can use value! if need be.
30
31
 
31
- module ArgvUtils
32
+ module Argv
32
33
 
33
34
  def commandline
34
35
  @commandline ||= ArgVector.new(ARGV)
35
36
  end
37
+
36
38
  alias_method :argument_vector, :commandline
37
39
 
38
40
  #
@@ -103,5 +105,8 @@ module Ratch
103
105
  end
104
106
 
105
107
  end
108
+
106
109
  end
110
+
107
111
  end
112
+ end