proutils 0.3.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 (62) hide show
  1. data/CHANGES +17 -0
  2. data/COPYING +674 -0
  3. data/README +78 -0
  4. data/RELEASE +7 -0
  5. data/TODO +4 -0
  6. data/bin/icli +278 -0
  7. data/bin/mint +139 -0
  8. data/bin/rtar +69 -0
  9. data/bin/xact +121 -0
  10. data/data/mint/cherry/_scaffold.rb +4 -0
  11. data/data/mint/roll/name-1.0.0.roll +26 -0
  12. data/data/mint/ruby/README +17 -0
  13. data/data/mint/ruby/README.first +10 -0
  14. data/data/mint/ruby/README.license +403 -0
  15. data/data/mint/ruby/meta/MANIFEST +2 -0
  16. data/data/mint/ruby/meta/name-1.0.0.roll +26 -0
  17. data/data/mint/ruby/script/finish_scaffold +8 -0
  18. data/data/mint/ruby/script/setup +1600 -0
  19. data/data/mint/website/css/clean.css +5 -0
  20. data/data/mint/website/index.html +0 -0
  21. data/demo/demo_rtar/Lorem_ipsum.txt +233 -0
  22. data/demo/demo_rtar/lib/demo_rock/tryme.rb +2 -0
  23. data/demo/demo_rtar/meta/data +6 -0
  24. data/demo/demo_rtar/web/index.html +13 -0
  25. data/demo/demo_rtar/web/rocklobster.jpg +0 -0
  26. data/demo/mint/loremipsum.txt +9 -0
  27. data/demo/mint/tryme.rb +33 -0
  28. data/lib/proutils/icli/abstract_host.rb +71 -0
  29. data/lib/proutils/icli/gforge.rb +668 -0
  30. data/lib/proutils/icli/rubyforge.rb +26 -0
  31. data/lib/proutils/icli/tool.rb +128 -0
  32. data/lib/proutils/icli/uploadutils.rb +410 -0
  33. data/lib/proutils/mint/copier.rb +324 -0
  34. data/lib/proutils/mint/fileutils.rb +47 -0
  35. data/lib/proutils/mint/help.txt +0 -0
  36. data/lib/proutils/rtar/rtar.rb +309 -0
  37. data/lib/proutils/rtar/vendor/archive/tar/minitar/command.rb +814 -0
  38. data/lib/proutils/rtar/vendor/archive/tar/minitar.rb +979 -0
  39. data/lib/proutils/xact/extract.rb +211 -0
  40. data/lib/proutils/xact/save.rb +151 -0
  41. data/meta/MANIFEST +100 -0
  42. data/meta/config.yaml +12 -0
  43. data/meta/icli.yaml +16 -0
  44. data/meta/project.yaml +27 -0
  45. data/meta/proutils.roll +3 -0
  46. data/test/fixture.rb +6 -0
  47. data/test/lib/test_exacto.rb +54 -0
  48. data/work/ANN +14 -0
  49. data/work/icli/icli +223 -0
  50. data/work/icli/rake.rb +82 -0
  51. data/work/icli/utils/consoleutils.rb +67 -0
  52. data/work/icli/utils/emailutils.rb +85 -0
  53. data/work/icli/utils/fileutils.rb +47 -0
  54. data/work/mint/command-old.rb +48 -0
  55. data/work/mint/lazyfile.rb +97 -0
  56. data/work/mint/part.rb +316 -0
  57. data/work/mint/scaffold-old.rb +420 -0
  58. data/work/rtar/index.html +68 -0
  59. data/work/rtar/old-index.html +63 -0
  60. data/work/xact/xact-ginsu +5 -0
  61. data/work/xact/xact-ruby.rb +155 -0
  62. metadata +178 -0
@@ -0,0 +1,420 @@
1
+ # = ratchets/architect/scaffold.rb
2
+ #
3
+ # TODO Use ProjectInfo class rather than faking it? (trans)
4
+
5
+ # The Architect tool provides a means for building up new
6
+ # project layout, including all the typical standard
7
+ # directories and files, or other pre-packaged project parts.
8
+ #
9
+ # New project layouts are automatically built to standard
10
+ # specifications and can be wrapped in additional subversion
11
+ # and/or website layers.
12
+ #
13
+ # Project parts can be retrived from remote sources and will
14
+ # be automitacally decompressed and merged into the project.
15
+ # If a scaffold.rb file is included in the parts package then
16
+ # conditional building can take place.
17
+ #
18
+ # WARNING! This is a very new feature and should be used with
19
+ # the expectaton that it is not 100% bug-free, and will certainly
20
+ # warrent design changes in the future.
21
+
22
+ require 'rbconfig'
23
+ require 'tmpdir'
24
+ require 'ostruct'
25
+ require 'rbconfig'
26
+ require 'fileutils'
27
+ require 'yaml'
28
+ #require 'facets/core/array/to_path.rb'
29
+
30
+
31
+ module ProUtils
32
+
33
+ def self.scaffold(type,opts)
34
+ Scaffold.new(type,opts).create
35
+ end
36
+
37
+ # Scaffold class creates the project scaffolding.
38
+ #
39
+ class Scaffold
40
+ include FileUtils
41
+
42
+ def initialize( type, opts={} )
43
+ @type = type.downcase
44
+ # dry run?
45
+ if opts['dryrun'] || opts['noharm'] || opts['n']
46
+ extend FileUtils::DryRun
47
+ else
48
+ extend FileUtils
49
+ end
50
+ # use typical svn layout
51
+ @svn = opts['svn'] || opts['subversion']
52
+
53
+ scaffold_script = File.join(scaffolds_directory, 'scaffold.rb')
54
+ if File.file?(scaffold_script)
55
+ extend Module.new do
56
+ eval File.read(scaffold_script)
57
+ end
58
+ end
59
+
60
+ unless File.directory?(scaffold_directory)
61
+ puts "Unknown scaffolding type."
62
+ exit -1
63
+ end
64
+ end
65
+
66
+ def data_directory
67
+ @scaffolds_directory ||= File.join(Config::CONFIG['datadir'], 'architect')
68
+ end
69
+
70
+ def scaffolds_directory
71
+ @scaffolds_directory ||= File.join(data_directory, 'scaffolds')
72
+ end
73
+
74
+ def scaffold_directory
75
+ File.join(scaffolds_directory, @type, 'scaffold')
76
+ end
77
+
78
+ # Create a new conventional project layout.
79
+ #
80
+ # Generates a project directory layout within the current
81
+ # directory. The scaffolding includes all the standard
82
+ # features such as directories lib/ bin/ doc/
83
+ # and files such as README.
84
+ #
85
+ # To use this task you need to first create an new empty
86
+ # directory and change into it. This command will not
87
+ # create a new project directory for you. As a safegaurd,
88
+ # this command will not generate scaffolding in a directory
89
+ # with files already present, unless you use the -f (force)
90
+ # option.
91
+ #
92
+ # You can specify a subversion layout by setting +svn+ to
93
+ # true. You can also specify a web layout via the by setting
94
+ # +web+ to true.
95
+ #
96
+ def create
97
+ pre_create
98
+ setup
99
+ pre_build
100
+ build
101
+ post_build
102
+ cleanup
103
+ post_create
104
+ puts "Project ready."
105
+ end
106
+
107
+ def pre_create; end
108
+
109
+ def setup
110
+ # project file
111
+ if file = project_file?
112
+ file = File.expand_path(file)
113
+ else
114
+ file = form()
115
+ file = File.expand_path(file)
116
+ if ENV['EDITOR']
117
+ `#{ENV['EDITOR']} #{file}`
118
+ end
119
+ end
120
+
121
+ @project_file = file
122
+ @project = YAML::load(File.open(@project_file)) # TODO need to lowercase all keys
123
+ @name = @project['name'] || @project['project']
124
+
125
+ if @svn
126
+ mkdir_p 'branches'
127
+ mkdir_p 'tags'
128
+ mkdir_p 'trunk'
129
+ cd 'trunk'
130
+ end
131
+
132
+ #mkdir_p @name
133
+ #cd name
134
+ end
135
+
136
+ def pre_build; end
137
+
138
+ #
139
+ def build
140
+ glob_files = Dir.glob(File.join(scaffolds_directory, @type, '**/*'))
141
+ glob_files.each do |file|
142
+ if File.exist?(file)
143
+ answer = ask("Overwrite #{file}?", 'Yn')
144
+ case answer.downcase
145
+ when 'y', 'yes'
146
+ cp(file, '.')
147
+ action_print "replace", file
148
+ else
149
+ action_print "skip", file
150
+ end
151
+ else
152
+ mkdir_p(File.dirname(file))
153
+ cp(file, '.')
154
+ action_print "write", file
155
+ end
156
+ end
157
+ end
158
+
159
+ def post_build; end
160
+
161
+ def cleanup
162
+ #if @project_file
163
+ # move project file to source folder if differnt
164
+ mv(@project_file,'.') unless Dir.pwd == File.dirname(@project_file)
165
+ #else
166
+ # # create project information file
167
+ # form()
168
+ #end
169
+ end
170
+
171
+ def post_create; end
172
+
173
+ private
174
+
175
+ # Creates a ProjectInfo file in the current directory.
176
+ # It will not overwrite a ProjectInfo file if one is already
177
+ # present. The file can be named ProjectInfo, PROJECT or
178
+ # project.yaml.
179
+
180
+ def form( opts={} )
181
+ #opts = OpenStruct.new(opts)
182
+
183
+ name = opts['name'] || 'ProjectInfo'
184
+
185
+ if name !~ /project(info)?(.yaml|.yml)?/i
186
+ raise ArgumentError, "not a recognized project information file name"
187
+ end
188
+
189
+ f = nil
190
+ files = Dir.glob("{[Pp]roject,PROJECT}{INFO,[Ii]nfo,.yml,.yaml,}")
191
+ if f = files[0]
192
+ puts "Project file '#{f}' already exists."
193
+ return
194
+ end
195
+
196
+ file = File.join(datadir, 'scaffolds', 'project.yaml')
197
+ install(file, name)
198
+
199
+ unless opts['noharm']
200
+ File.open(name,'a') do |f|
201
+ date = Time.now.strftime("%Y-%m-%d")
202
+ f << "created: #{date}"
203
+ end
204
+ end
205
+
206
+ unless opts['quiet']
207
+ puts "Created '#{name}'."
208
+ puts "Please edit to suit your project."
209
+ end
210
+
211
+ return name
212
+ end
213
+
214
+ # Is there a project information file?
215
+ def project_file?
216
+ f = nil
217
+ files = Dir.glob("{[Pp]roject,PROJECT}{INFO,[Ii]nfo,.yml,.yaml,}")
218
+ return files[0]
219
+ end
220
+
221
+ # Project contains content?
222
+ def project_content?
223
+ content = Dir.entries('.') - ['.', '..']
224
+ content -= [project_file?]
225
+ return !content.empty?
226
+ end
227
+
228
+ # Action print
229
+ def action_print(action, file)
230
+ action = (' ' * (12 - action.size)) + action
231
+ puts "#{action} #{file}"
232
+ end
233
+
234
+ end
235
+
236
+ end
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ =begin
255
+ def create( opts={} )
256
+ #opts = OpenStruct.new(opts)
257
+
258
+ if project_content? and not opts['force']
259
+ puts "Directory already has content. Use -f option to force new scaffolding."
260
+ return
261
+ end
262
+
263
+ # change 'standard' to 'ruby' in case other languages may
264
+ # be supported in future?
265
+ type = opts['type'] || 'standard'
266
+ web = opts['web']
267
+ svn = opts['svn'] || opts['subversion']
268
+
269
+ type = 'standard' if type == 'std'
270
+
271
+ if file = project_file?
272
+ file = File.expand_path(file)
273
+ else
274
+ file = form()
275
+ file = File.expand_path(file)
276
+ if ENV['EDITOR']
277
+ `#{ENV['EDITOR']} #{file}`
278
+ end
279
+ end
280
+ proj = YAML::load(File.open(file))
281
+
282
+ # set scaffolding dir
283
+ dir = File.join( datadir, 'scaffolds' )
284
+
285
+ if web
286
+ from = File.join(dir, 'website', '.')
287
+ cp_r(from, '.')
288
+ cd('src')
289
+ end
290
+
291
+ if svn
292
+ mkdir_p('branches')
293
+ mkdir_p('tags')
294
+ mkdir_p('trunk')
295
+ cd('trunk')
296
+ end
297
+
298
+ build
299
+ end
300
+ =end
301
+
302
+
303
+ # def seed( keys, &yld )
304
+ # keys = (keys||yld).to_openobject
305
+ #
306
+ # name = keys.name
307
+ # type = keys.type
308
+ # site = keys.site
309
+ # meta = keys.meta
310
+ # web = keys.web
311
+ #
312
+ # raise ArgumentError, "missing field -- name or type" unless name
313
+ #
314
+ # if site
315
+ # url = File.join(site, name)
316
+ # scaffold(url, keys)
317
+ # else
318
+ # case name.to_s.downcase
319
+ # when 'std', 'standard', 'svn', 'subversion'
320
+ # new_project(keys)
321
+ # when 'project', 'projectinfo', 'project.yaml', 'project.yml'
322
+ # projectinfo_template(name, meta)
323
+ # #when 'setup', 'setup.rb'
324
+ # # setup_rb
325
+ # else
326
+ # url = File.join( Ratchets.datadir, 'scaffolding', name )
327
+ # scaffold(url, keys)
328
+ # end
329
+ # end
330
+ # end
331
+ #
332
+ # private
333
+
334
+
335
+ # def new_project( keys, &yld )
336
+ # keys = (keys||yld).to_openobject
337
+ #
338
+ # type = keys.type || keys.name
339
+ # meta = keys.meta
340
+ # web = keys.web
341
+ #
342
+ # raise ArgumentError, "Must supply new project type." unless type
343
+ #
344
+ # content = Dir.entries('.') - [ '.', '..' ]
345
+ # if not content.empty? and not project.force?
346
+ # puts "Directory already has content. Use -f option to force new scaffolding."
347
+ # return nil
348
+ # end
349
+ #
350
+ # local_store = File.join( Ratchets.datadir, 'scaffolding' )
351
+ #
352
+ # type = 'standard' if type == 'std'
353
+ # type = 'subversion' if type == 'svn'
354
+ #
355
+ # if web
356
+ # from = File.join( local_store, 'website', '.' )
357
+ # FileUtils.cp_r( from, '.' )
358
+ # Dir.chdir( 'src' )
359
+ # end
360
+ #
361
+ # if type == 'subversion' or type == 'svn'
362
+ # mkdir_p( 'branches' )
363
+ # mkdir_p( 'tags' )
364
+ # mkdir_p( 'trunk' )
365
+ # Dir.chdir( 'trunk' )
366
+ # end
367
+ #
368
+ # # copies typical project layout
369
+ # from = File.join( local_store, 'standard', '.' )
370
+ # FileUtils.cp_r( from, '.' )
371
+ #
372
+ # # create project.yaml template.
373
+ # projectinfo_template(nil,meta)
374
+ #
375
+ # puts "Project ready."
376
+ # end
377
+
378
+ =begin
379
+ # Generate pre-built targets in project's target folder.
380
+
381
+ def targets( keys, &yld ) #( folder, targets=nil )
382
+ keys = (keys||yld).to_openobject
383
+
384
+ folder = keys.folder || 'script'
385
+ targets = keys.targets || keys.target
386
+
387
+ match = File.join(File.dirname(__FILE__), 'targets', '*')
388
+ files = Dir.glob(match)
389
+ names = files.collect{ |f| File.basename(f).chomp('.rb') }
390
+ cross = Hash[*names.zip(files).flatten]
391
+
392
+ case targets
393
+ when String
394
+ targets = targets.split(',')
395
+ when Array
396
+ targets = [targets].flatten
397
+ else
398
+ targets = names
399
+ end
400
+
401
+ # only specific targets that exist?
402
+ #targets = (AUTOTARGETS & targets)
403
+
404
+ unless (diff=(targets-names)).empty?
405
+ puts "project: unknown targets " + diff.join(',')
406
+ return
407
+ end
408
+
409
+ mkdir_p(folder)
410
+ targets.each do |name|
411
+ file1 = cross[name]
412
+ file2 = File.join(folder, name)
413
+ unless (File.exist?(file2) or project.dryrun?)
414
+ install(file1, file2, :mode=>0754)
415
+ end
416
+ end
417
+
418
+ return folder
419
+ end
420
+ =end
@@ -0,0 +1,68 @@
1
+ <html>
2
+ <head>
3
+ <title>Rock Your Ruby</title>
4
+ <LINK REL="SHORTCUT ICON" HREF="img/ruby.gif"/>
5
+ <style>
6
+ body { margin: 0; padding: 0; font-family: sans-serif; font-size: 10pt; background: white; }
7
+
8
+ a { color: red; text-decoration: none; font-size: 11pt; font-weight: normal;
9
+ line-height: 15pt; }
10
+
11
+ hr { margin: 0 auto; width: 760px; }
12
+
13
+ li { font-family: monospace ; }
14
+
15
+ span.red { color: red; }
16
+
17
+ div#canvas { margin: 0 auto; width: 600px; }
18
+
19
+ div#art { background: url(img/Ruby_on_White.jpg) no-repeat; color: white;
20
+ padding: 10px; text-align: justify; height: 560px; }
21
+
22
+ div#header { text-align: left; margin: 10px; }
23
+
24
+ div#title { color: #FF0000; font-family: monospace; font-size: 56pt;
25
+ letter-spacing: 10pt; font-weight: bold; }
26
+
27
+ div#subtitle { color: white; font-size: 10pt; padding-left: 10px; font-weight: bold;
28
+ letter-spacing: 1px; }
29
+
30
+ div#menu { margin: 20px; margin-top: 180px; text-align: right; width: 190px; }
31
+ div#menu a { font-size: 12pt; font-weight: normal; color: red; }
32
+ div#menu a:hover { text-decoration: underline; }
33
+
34
+ div#copy { margin: 0 auto; width: 600px; font-family: sans-serif; font-size: 8pt; color: tan; }
35
+ div#copy a { color: red; font-size: 8pt; }
36
+
37
+
38
+ </style>
39
+ </head>
40
+ <body>
41
+
42
+ <div id="canvas">
43
+
44
+ <div id="art">
45
+
46
+ <div id="header">
47
+ <div id="title">rock</div>
48
+ <div id="subtitle">ruby | recursive archival</div>
49
+ </div>
50
+
51
+ <div id="menu">
52
+ <a href="overview.html">overview</a> <br/>
53
+ <a href="http://rubyforge.org/frs/?group_id=1856">download</a> &nbsp; <br/>
54
+ <a href="http://rubyforge.org/projects/rock">devsite</a> &nbsp;&nbsp; <br/>
55
+ <a href="api/index.html">apidocs</a> &nbsp;&nbsp; <br/>
56
+ </div>
57
+
58
+ </div>
59
+
60
+ <div id="copy">
61
+ &nbsp;<a href="http://rock.rubyforge.org">rock</a> copyright &copy; 2006 thomas sawyer (trans), all rights reserved.
62
+ </div>
63
+
64
+ </div>
65
+
66
+ </body>
67
+ </html>
68
+
@@ -0,0 +1,63 @@
1
+ <html>
2
+ <head>
3
+ <title>Rock 'n' Roll</title>
4
+ <LINK REL="SHORTCUT ICON" HREF="img/r45.jpg"/>
5
+ <style>
6
+ body { margin: 0; padding: 0; font-family: sans-serif;
7
+ background: white; }
8
+
9
+ a { color: red; text-decoration: none; font-size: 10pt;
10
+ font-weight: bold; }
11
+
12
+ hr { margin: 0 auto; width: 760px; }
13
+
14
+ li { font-family: monospace ; }
15
+
16
+ span.red { color: red; }
17
+
18
+ div#front { margin: auto auto; width: 700px;
19
+ text-align: center; color: white;
20
+ padding: 10px; padding-right: 60px; }
21
+
22
+ div#title { text-align: center; margin-top: 35px; margin-bottom: 45px; }
23
+
24
+ span#title { color: red; font-family: monospace; font-size: 42pt;
25
+ letter-spacing: 10pt; font-weight: bold; }
26
+
27
+ div#menu { float: right; width: 300px; margin-top: 100px;
28
+ text-align: center; color: orange; }
29
+
30
+ div#copy { margin: 0 auto; width: 800px; padding-right: 60px;
31
+ font-size: 8pt; color: tan; text-align: center; }
32
+
33
+ div#copy a { color: tan; font-size: 8pt; }
34
+
35
+ </style>
36
+ </head>
37
+ <body>
38
+
39
+ <div id="front">
40
+
41
+ <br/>
42
+
43
+ <div id="menu">
44
+ <h2>A Side</h2>
45
+ <a href="http://rock.rubyforge.org/rock.html">Rock</a>
46
+ <br/><br/>
47
+ <h2>B Side</h2>
48
+ <a href="http://roll.rubyforge.org/roll.html">Roll</a>
49
+ </div>
50
+
51
+ <img src="img/jukebox.jpg"/>
52
+
53
+ <div id="title">
54
+ <span id="title">Rock 'n' Roll</span>
55
+ </div>
56
+
57
+ </div>
58
+
59
+ <div id="copy">
60
+ <span class="red">RubyRock</span> and <span class="red">RubyRoll</span> Copyright &copy; 2005 Thomas Sawyer, all rights reserved.
61
+ </div>
62
+
63
+ </html>
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/ruby
2
+
3
+ load 'exacto.rb'
4
+
5
+ GinsuCommand.start
@@ -0,0 +1,155 @@
1
+ module Rivets
2
+ module CLI
3
+
4
+ #
5
+
6
+ class Ginsu
7
+
8
+ def self.start ; new.start ; end
9
+
10
+ def initialize(argv=ARGV)
11
+ @args, @keys = Console::Arguments.new(argv).parameters
12
+ end
13
+
14
+ def start
15
+ files = @args[0]
16
+ ExtractAndSave.test_extract(files)
17
+ end
18
+ end
19
+
20
+ # Runs extracted code via a pipe.
21
+ # The binary for this is called exrb.
22
+
23
+ class XactRuby #Excerb
24
+
25
+ # Shortcut for typical usage.
26
+
27
+ def self.run
28
+ new.run
29
+ end
30
+
31
+ attr_reader :exacto, :file, :handle, :argv
32
+
33
+ def initialize( argv=ARGV )
34
+ argv = argv.dup
35
+
36
+ if argv.delete('--help')
37
+ help
38
+ exit 0
39
+ end
40
+
41
+ if i = argv.index('-h')
42
+ handle = argv[i+1].strip
43
+ argv[i+1,1] = nil
44
+ argv.delete('-h')
45
+ else
46
+ handle = 'test'
47
+ end
48
+
49
+ if i = argv.index('-P')
50
+ argv.delete('-P')
51
+ file = argv.pop
52
+ puts exact(handle)
53
+ exit 0
54
+ end
55
+
56
+ file = argv.pop
57
+
58
+ @argv = argv
59
+ @handle = handle
60
+ @file = File.expand_path(file)
61
+ @exacto = Extractor.new(file)
62
+ end
63
+
64
+ # Extract the code.
65
+
66
+ def exact
67
+ return *@exacto.extract_block(handle)
68
+ end
69
+
70
+ # This runs the commented code block via a pipe.
71
+ # This has an advantage in that all the parameters
72
+ # that can be passed to ruby can also be passed to exrb.
73
+
74
+ def run
75
+ excode, offset = exact
76
+
77
+ code = "\n"
78
+ # code << special_requirements
79
+ code << "require '#{file}'\n"
80
+ code << "eval(<<'_____#{handle}_____', TOPLEVEL_BINDING, '#{file}', #{offset})\n"
81
+ code << excode
82
+ code << "\n_____#{handle}_____\n\n"
83
+
84
+ cmd = ['ruby', *argv].join(' ')
85
+
86
+ result = IO.popen(cmd,"w+") do |ruby|
87
+ ruby.puts code
88
+ ruby.close_write
89
+ puts ruby.read
90
+ end
91
+ end
92
+
93
+ # # Any special requirements based on handle?
94
+ #
95
+ # def special_requirements
96
+ # case handle
97
+ # when 'test/unit'
98
+ # "require 'test/unit'"
99
+ # when 'rspec'
100
+ # "require 'rspec'"
101
+ # else
102
+ # ''
103
+ # end + "\n"
104
+ # end
105
+
106
+ # Show help.
107
+
108
+ def help
109
+ helpstr = `ruby --help`
110
+ helpstr.sub!('ruby', 'exrb')
111
+ puts helpstr
112
+ puts
113
+ puts " -h handle of comment block to run"
114
+ puts " -P display the code block to be run"
115
+ end
116
+
117
+
118
+ # OLD CODE
119
+ #
120
+ # # This runs the commented code block directly.
121
+ # # This has an advantage in that the line numbers
122
+ # # can be maintained.
123
+ #
124
+ # def run_eval( fname, block='test' )
125
+ # code, offset = extract_block( fname )
126
+ #
127
+ # require 'test/unit' if block == 'test'
128
+ # require fname
129
+ #
130
+ # eval code, TOPLEVEL_BINDING, File.basename(fname), offset
131
+ # end
132
+ #
133
+ # # This runs the commented code block via a pipe.
134
+ # # This has an advantage in that all the parameters
135
+ # # that can be passed to ruby can be passed to rubyinline.
136
+ #
137
+ # def run_pipe( fname, block='test' )
138
+ # code, offset = extract_block( fname, block )
139
+ #
140
+ # code = "require 'test/unit'\n\n" + code if block == 'test'
141
+ # code = "require '#{fname}'\n\n" + code
142
+ #
143
+ # cmd = ['ruby', *ARGV].join(' ')
144
+ #
145
+ # result = IO.popen(cmd,"w+") do |ruby|
146
+ # ruby.puts code
147
+ # ruby.close_write
148
+ # puts ruby.read
149
+ # end
150
+ # end
151
+
152
+ end
153
+
154
+ end
155
+ end