ratch 0.2.2 → 0.2.3

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 (73) hide show
  1. data/COPYING +674 -0
  2. data/README +5 -5
  3. data/bin/lt +11 -11
  4. data/bin/ratch +3 -2
  5. data/demo/README +1 -0
  6. data/demo/WILMA +1 -0
  7. data/demo/doc/rdoc/created.rid +1 -1
  8. data/demo/doc/rdoc/files/README.html +1 -1
  9. data/demo/doc/rdoc/files/lib/foo/foo_rb.html +1 -1
  10. data/demo/doc/rdoc/index.html +3 -3
  11. data/demo/p.rb +9 -0
  12. data/demo/r.rb +6 -0
  13. data/demo/t.rb +3 -0
  14. data/demo/task/config.yaml +2 -0
  15. data/demo/{util → task}/one +0 -0
  16. data/demo/task/rdoc +88 -0
  17. data/demo/task/rdoc-old +182 -0
  18. data/demo/task/simplebuild +15 -0
  19. data/demo/task/stats +6 -0
  20. data/demo/task/task +6 -0
  21. data/demo/{util → task}/tryme +0 -0
  22. data/lib/ratch/argvutils.rb +57 -14
  23. data/lib/ratch/batch.rb +73 -21
  24. data/lib/ratch/batchable.rb +56 -26
  25. data/lib/ratch/batchfile.rb +95 -0
  26. data/lib/ratch/buildable.rb +117 -42
  27. data/lib/ratch/configutils.rb +43 -13
  28. data/lib/ratch/consoleutils.rb +76 -19
  29. data/lib/ratch/emailutils.rb +24 -0
  30. data/lib/ratch/facets/multiglob.rb +160 -0
  31. data/lib/ratch/fileutils.rb +40 -8
  32. data/lib/ratch/options.rb +43 -4
  33. data/lib/ratch/taskable.rb +48 -12
  34. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/announce +0 -0
  35. data/lib/ratch/toolset/ruby/crosstest +305 -0
  36. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/extest +0 -0
  37. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/install +0 -0
  38. data/lib/ratch/toolset/ruby/isotest +293 -0
  39. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/load +0 -0
  40. data/lib/ratch/toolset/ruby/loadtest +28 -0
  41. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/notes +0 -0
  42. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/publish +0 -0
  43. data/lib/ratch/toolset/ruby/rdoc +88 -0
  44. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/setup +0 -0
  45. data/{data/ratch/rubyproject → lib/ratch/toolset/ruby}/stats +0 -0
  46. data/lib/ratch/toolset/ruby/syntax +29 -0
  47. data/lib/ratch/toolset/ruby/test +26 -0
  48. data/lib/ratch/uploadutils.rb +25 -4
  49. data/log/history.rd +10 -0
  50. data/log/recent.rd +8 -0
  51. data/log/todo.rd +2 -0
  52. data/man/ratch.man +73 -0
  53. data/meta/MANIFEST +45 -31
  54. data/meta/{RATCH-0.2.2.roll → ratch-0.2.3.roll} +3 -3
  55. data/task/clobber/package +10 -0
  56. data/task/config.yaml +4 -0
  57. data/task/man +14 -0
  58. data/task/publish +1 -1
  59. data/task/rdoc +6 -0
  60. metadata +64 -40
  61. data/LICENSE +0 -344
  62. data/data/ratch/rubyproject/rdoc +0 -42
  63. data/demo/util/conf/rdoc +0 -4
  64. data/demo/util/rdoc +0 -39
  65. data/dev/install +0 -89
  66. data/dev/install.0 +0 -49
  67. data/dev/install.1 +0 -63
  68. data/dev/ludo +0 -25
  69. data/dev/oldtaskable.rb +0 -573
  70. data/dev/taskable-simple.rb +0 -42
  71. data/dev/taskable.rb +0 -120
  72. data/lib/ratch/t.rb +0 -0
  73. data/lib/ratch/taskutils.rb +0 -41
data/README CHANGED
@@ -5,7 +5,7 @@
5
5
  Ratch is a Ruby-based Batch file system. It provides a Ruby-based DSL
6
6
  for creating utility/task scripts. It is similar in function to build tools,
7
7
  like Make, Ant, Maven, Rake, et al. But unlike these it stears clear
8
- of monolithic ? and instead more closely follows the "UNIX-way".
8
+ of monolithic design and instead more closely follows the "UNIX-way".
9
9
 
10
10
 
11
11
  == Installation
@@ -26,12 +26,12 @@ For Windows users the last line will be:
26
26
  == Usage
27
27
 
28
28
  Basic usage simply entails writing a script that utilizes Ratch's syntax.
29
+ See lib/ratch/toolset/ruby for examples.
29
30
 
30
31
 
31
- == License
32
+ == Copying
32
33
 
33
- Copyright (c) 2007 Thomas Sawyer (Trans)
34
-
35
- GPL 3 ???
34
+ Copyright (c) 2007 T. Sawyer (Psi T. Corp)
36
35
 
36
+ Ratch is distributed under the terms of the GPLv3.
37
37
 
data/bin/lt CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  # scan task scripts for descriptions
4
4
 
5
- def script_desc( dir )
5
+ def script_desc(dir)
6
6
  help = {}
7
- files = Dir.glob( File.join( dir, '*' ) )
7
+ files = Dir.glob(File.join(dir,'**/*'))
8
8
  files.each do |fname|
9
- next if FileTest.directory?( fname )
10
- next unless FileTest.executable?( fname )
9
+ next if FileTest.directory?(fname)
10
+ next unless FileTest.executable?(fname)
11
11
  desc = ''
12
12
  File.open(fname) do |f|
13
13
  line = ''
@@ -23,25 +23,25 @@ def script_desc( dir )
23
23
  end
24
24
  end
25
25
  end
26
- help[File.basename(fname)] = desc
26
+ help[fname] = desc
27
27
  end
28
28
  help
29
29
  end
30
30
 
31
- def show( dir )
32
- tasks = script_desc( dir )
31
+ def show(dir)
32
+ tasks = script_desc(dir)
33
33
  max = tasks.keys.max{ |a,b| a.size <=> b.size }.size
34
34
  if dir == ''
35
35
  max += 4 + 2
36
36
  else
37
37
  max += dir.size + 2
38
38
  end
39
+ tasks = tasks.sort_by{|k,v| k }
39
40
  tasks.each do |name, sum|
40
- #sum = Sake.help_summary( type )
41
41
  if dir == ''
42
- cmd = "sake #{name}"
42
+ cmd = "ratch #{name}"
43
43
  else
44
- cmd = File.join( dir.chomp('/'), name )
44
+ cmd = name
45
45
  end
46
46
  puts "%-#{max}s # %s" % [cmd, sum]
47
47
  end
@@ -49,7 +49,7 @@ end
49
49
 
50
50
  dir = ARGV[0] || '.'
51
51
 
52
- if File.directory?( dir )
52
+ if File.directory?(dir)
53
53
  show( dir )
54
54
  else
55
55
  puts "#{dir} is not a directory"
data/bin/ratch CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  #require 'shellwords'
4
4
  require 'rbconfig' # replace with facets/rbsystem in future ?
5
+ #require 'ratch/batchfile'
5
6
  require 'ratch/batch'
6
7
 
7
8
  module Ratch
@@ -48,7 +49,7 @@ module Ratch
48
49
 
49
50
  end
50
51
 
51
- #load($0 = ARGV.shift)
52
+ load($0 = ARGV.shift)
52
53
 
53
- Ratch::RatchCommand.start(ARGV.shift)
54
+ #Ratch::RatchCommand.start(ARGV.shift)
54
55
 
data/demo/README CHANGED
@@ -6,3 +6,4 @@ The Ruby Batch System
6
6
 
7
7
  This is Foo business.
8
8
 
9
+
data/demo/WILMA ADDED
@@ -0,0 +1 @@
1
+ Here
@@ -1 +1 @@
1
- Sun, 19 Aug 2007 08:19:45 -0700
1
+ Sun, 11 Nov 2007 10:50:18 -0500
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Tue Jul 24 12:24:03 -0700 2007</td>
59
+ <td>Sun Nov 11 10:49:16 -0500 2007</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Sat Jul 28 14:20:30 -0700 2007</td>
59
+ <td>Sun Nov 11 10:29:00 -0500 2007</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -5,12 +5,12 @@
5
5
 
6
6
  <!--
7
7
 
8
- Foo
8
+ RDoc Documentation
9
9
 
10
10
  -->
11
11
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
12
  <head>
13
- <title>Foo</title>
13
+ <title>RDoc Documentation</title>
14
14
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
15
  </head>
16
16
  <frameset rows="20%, 80%">
@@ -19,6 +19,6 @@
19
19
  <frame src="fr_class_index.html" name="Classes" />
20
20
  <frame src="fr_method_index.html" name="Methods" />
21
21
  </frameset>
22
- <frame src="files/README.html" name="docwin" />
22
+ <frame src="files/lib/foo/foo_rb.html" name="docwin" />
23
23
  </frameset>
24
24
  </html>
data/demo/p.rb ADDED
@@ -0,0 +1,9 @@
1
+
2
+
3
+ f = Functor.new do |op,x|
4
+ x.send(op,x)
5
+ end
6
+
7
+ p f + 1
8
+ p f + 2
9
+
data/demo/r.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'facets/functor'
2
+
3
+ script = File.read($0 = './t.rb')
4
+
5
+ eval(script, binding, $0)
6
+
data/demo/t.rb ADDED
@@ -0,0 +1,3 @@
1
+
2
+ load('./p.rb')
3
+
@@ -0,0 +1,2 @@
1
+
2
+
File without changes
data/demo/task/rdoc ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate rdocs
4
+ #
5
+ # Generate Rdoc documentation. Settings are
6
+ # the same as the rdoc command's options.
7
+
8
+ main :rdoc do
9
+ config, output, input = *rdoc_configuration
10
+
11
+ file output => input do
12
+ rdoc_target(config)
13
+ end
14
+
15
+ file 'README' do
16
+ puts "OH YEH README"
17
+ end
18
+
19
+ build output
20
+ end
21
+
22
+ # Document target.
23
+
24
+ def rdoc_target(config)
25
+ output = config['op']
26
+ input = config.delete('include')
27
+
28
+ # Check for 'doc' directory.
29
+ # (Helps to ensure we're in the right place.)
30
+ #dir!(File.dirname(site))
31
+
32
+ # Remove old rdocs.
33
+ rm_r(output) if exist?(output) and safe?(output)
34
+
35
+ #input = input.collect{ |i| glob(i) }.flatten
36
+ vector = [input, config]
37
+ rdoc(vector.to_console)
38
+
39
+ insert_ads(output)
40
+ end
41
+
42
+ # Collect RDocs configuration.
43
+
44
+ def rdoc_configuration
45
+ config = configuration['rdoc'] || {}
46
+
47
+ config = {
48
+ 'template' => 'html',
49
+ 'op' => 'doc/rdoc',
50
+ 'merge' => true,
51
+ 'inline-source' => true,
52
+ 'exclude' => [],
53
+ 'include' => ['lib', '[A-Z]*']
54
+ }.merge(config)
55
+
56
+ if config['output']
57
+ config['op'] = config.delete('output')
58
+ end
59
+
60
+ output = config['op']
61
+
62
+ input = config['include'].collect do |i|
63
+ dir?(i) ? File.join(i,'**','*') : i
64
+ end
65
+
66
+ return config, output, input
67
+ end
68
+
69
+ # Insert an ad if available.
70
+
71
+ def insert_ads(site)
72
+ adfile = configuration['ad_file'] || 'meta/site_ad.html'
73
+ return unless adfile && File.file?(adfile)
74
+ adtext = File.read(adfile)
75
+ #puts
76
+ dirs = Dir.glob(File.join(site,'*/'))
77
+ dirs.each do |dir|
78
+ files = Dir.glob(File.join(dir, '**/*.html'))
79
+ files.each do |file|
80
+ html = file_read(file)
81
+ bodi = html.index('<body>')
82
+ html[bodi + 7] = "\n" + adtext
83
+ #print "Augmenting #{file}..."
84
+ file_write(file, html) unless dryrun?
85
+ #puts "[done]"
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/env ratch
2
+
3
+ # generate rdocs
4
+ #
5
+ # Geneate RDoc documentation. This uses the rdoc config entry.
6
+ # most entires are shodows of the argument the rdoc command
7
+ # takes. Three execptions -- you can use 'output' instead of
8
+ # 'op' if you prefer. You can sopecify 'chdir', from which
9
+ # rdoc will work relative. And you can specify 'groups'.
10
+ # Groups allow you to document groups of files separetely.
11
+ # Using groups, any file not part of a group will be document
12
+ # on it's own.
13
+ #
14
+ # Eg.
15
+ #
16
+ # rdoc:
17
+ # title : Foo Aop
18
+ # main : README
19
+ # output: doc/rdoc
20
+ # chdir : lib
21
+ #
22
+ # rdoc:
23
+ # doc/rdoc:
24
+ # title : Foo Aop
25
+ # main : README
26
+ # chdir : lib/core
27
+ # doc/rdoc/aop:
28
+ # title : Foo Aop
29
+ # main : README
30
+ # chdir : lib/core
31
+ #
32
+ #
33
+ # You can also specify more than one rdoc process by using
34
+ # an array of such entries.
35
+
36
+ # Load RDoc configuration.
37
+ rdoc_configs = configuration['rdoc']
38
+ rdoc_configs = [configs] unless Array===configs
39
+
40
+ targets = rdoc_configs.collect{ |config| config['output'] }
41
+
42
+
43
+
44
+ main :rdoc => targets do
45
+ puts "RDoc complete."
46
+ end
47
+
48
+
49
+ file configuration['rdoc'] do |config|
50
+ if config['groups']
51
+ rdoc_groups(config)
52
+ else
53
+ rdoc_target(config)
54
+ end
55
+ end
56
+ end
57
+
58
+ #
59
+
60
+ rdoc_configs.each do |config|
61
+
62
+
63
+
64
+ file config['output'] do |config|
65
+ if config['groups']
66
+ rdoc_groups(config)
67
+ else
68
+ rdoc_target(config)
69
+ end
70
+ end
71
+
72
+ end
73
+
74
+ # Docuement groups of targets.
75
+
76
+ def rdoc_groups(config)
77
+ site = config.delete('output') || config.delete('op') || 'doc/rdoc'
78
+ tdir = config['chdir']
79
+
80
+ groups = config.delete('groups')
81
+ groups = TrueClass===groups ? [] : groups
82
+
83
+ # the rest
84
+ rest = []
85
+ chdir(tdir){rest=glob('**/*').select{|f| File.file?(f)}}
86
+ rest = rest - groups.flatten
87
+ groups.concat(rest.collect{ |r| [r] })
88
+
89
+ title = config['title'].to_s
90
+
91
+ # rdoc each group
92
+ groups.each do |group|
93
+ gf1st = File.basename(group.first)
94
+ gname = gf1st.chomp(File.extname(gf1st))
95
+ gsite = File.join(site,gname) # *
96
+ gtitle = "#{title} #{gname.capitalize}".strip
97
+
98
+ gconfig = config.merge('title' => gtitle, 'op' => gsite, 'files' => group)
99
+
100
+ rdoc_target(gconfig)
101
+ end
102
+ end
103
+
104
+ # Document target.
105
+
106
+ def rdoc_target(config)
107
+ config = {
108
+ 'template' => 'html',
109
+ 'merge' => true,
110
+ 'inline-source' => true,
111
+ 'files' => '**/*'
112
+ }.merge(config)
113
+
114
+ site = config.delete('output') || config.delete('op') || 'doc/rdoc'
115
+ tgdir = config.delete('chdir')
116
+ files = config.delete('files')
117
+
118
+ config['op'] = File.expand_path(site)
119
+
120
+ config['main'] = File.expand_path(config['main']) if config['main']
121
+
122
+ # Helps to ensure we're in the right place.
123
+ #dir!(File.dirname(site))
124
+
125
+ # Remove all old rdocs.
126
+ rm_r(site) if dir?(site) and safe?(site)
127
+
128
+ # Prepare command arguments.
129
+ vector = [files, config] #.flatten.compact
130
+
131
+ # Create Documentation.
132
+ cd(tgdir) do
133
+ rdoc(vector.to_console)
134
+ end
135
+
136
+ insert_ads(site)
137
+ end
138
+
139
+ # Insert ads.
140
+
141
+ def insert_ads(site)
142
+ adfile = configuration['ad_file'] || 'meta/site_ad.html'
143
+ return unless adfile && File.file?(adfile)
144
+ adtext = File.read(adfile)
145
+ #puts
146
+ dirs = Dir.glob(File.join(site,'*/'))
147
+ dirs.each do |dir|
148
+ files = Dir.glob(File.join(dir, '**/*.html'))
149
+ files.each do |file|
150
+ html = file_read(file)
151
+ bodi = html.index('<body>')
152
+ html[bodi + 7] = "\n" + adtext
153
+ #print "Augmenting #{file}..."
154
+ file_write(file, html) unless dryrun?
155
+ #puts "[done]"
156
+ end
157
+ end
158
+ end
159
+
160
+
161
+ class RDocGroup
162
+
163
+ attr_accessor :title
164
+ attr_accessor :main
165
+
166
+ def initialize(config, group)
167
+ populate(config)
168
+ @group = group
169
+ end
170
+
171
+ def name
172
+ @name ||= (
173
+ name = File.basename(group.first)
174
+ name.chomp(File.extname(name))
175
+ )
176
+ end
177
+
178
+ def output
179
+ site = config.delete('output') || config.delete('op') || 'doc/rdoc'
180
+ end
181
+
182
+ end