ratch 0.4.1 → 1.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.
- data/COPYING +17 -669
- data/HISTORY +6 -0
- data/MANIFEST +36 -0
- data/METADATA +14 -0
- data/NEWS +7 -0
- data/README +67 -17
- data/bin/ratch +5 -78
- data/demo/tryme-task.ratch +12 -0
- data/demo/tryme1.ratch +6 -0
- data/lib/ratch/core_ext.rb +6 -0
- data/lib/ratch/core_ext/facets.rb +1 -0
- data/lib/ratch/core_ext/filetest.rb +52 -0
- data/lib/ratch/core_ext/object.rb +8 -0
- data/lib/ratch/core_ext/pathname.rb +38 -0
- data/lib/ratch/core_ext/string.rb +44 -0
- data/lib/ratch/{dsl/console.rb → core_ext/to_console.rb} +2 -76
- data/lib/ratch/core_ext/to_list.rb +29 -0
- data/lib/ratch/dsl.rb +494 -49
- data/lib/ratch/index.rb +4 -0
- data/lib/ratch/io.rb +116 -0
- data/lib/ratch/pathglob.rb +73 -0
- data/lib/ratch/plugin.rb +55 -0
- data/lib/ratch/runmode.rb +69 -0
- data/lib/ratch/script.rb +52 -0
- data/lib/ratch/service.rb +33 -0
- data/lib/ratch/task.rb +249 -0
- data/lib/ratch/task2.rb +298 -0
- data/test/README +1 -0
- data/test/test_helper.rb +4 -0
- data/test/test_task.rb +46 -0
- metadata +90 -150
- data/CHANGES +0 -22
- data/TODO +0 -2
- data/bin/lt +0 -56
- data/bin/ludo +0 -14
- data/bin/manifest +0 -451
- data/bin/ratch-find +0 -21
- data/demo/WILMA +0 -1
- data/demo/XR +0 -9
- data/demo/lib/foo/foo.rb +0 -7
- data/demo/p.rb +0 -9
- data/demo/r.rb +0 -6
- data/demo/t.rb +0 -3
- data/demo/task/config.yaml +0 -4
- data/demo/task/one +0 -6
- data/demo/task/simplebuild +0 -15
- data/demo/task/stats +0 -4
- data/demo/task/task +0 -6
- data/demo/task/tryme +0 -10
- data/lib/ratch/dsl/argv.rb +0 -112
- data/lib/ratch/dsl/batch.rb +0 -232
- data/lib/ratch/dsl/build.rb +0 -174
- data/lib/ratch/dsl/email.rb +0 -108
- data/lib/ratch/dsl/file.rb +0 -205
- data/lib/ratch/dsl/meta.rb +0 -125
- data/lib/ratch/dsl/options.rb +0 -98
- data/lib/ratch/dsl/setup.rb +0 -124
- data/lib/ratch/dsl/sign.rb +0 -243
- data/lib/ratch/dsl/stage.rb +0 -147
- data/lib/ratch/dsl/task.rb +0 -139
- data/lib/ratch/dsl/upload.rb +0 -436
- data/lib/ratch/dsl/zip.rb +0 -59
- data/lib/ratch/extra/email.rb +0 -5
- data/lib/ratch/extra/stage.rb +0 -5
- data/lib/ratch/extra/zip.rb +0 -5
- data/lib/ratch/manager.rb +0 -53
- data/lib/ratch/manifest.rb +0 -540
- data/lib/ratch/metadata/information.rb +0 -258
- data/lib/ratch/metadata/package.rb +0 -108
- data/lib/ratch/metadata/project.rb +0 -523
- data/lib/ratch/metadata/release.rb +0 -108
- data/lib/ratch/support/errors.rb +0 -4
- data/lib/ratch/support/filename.rb +0 -18
- data/lib/ratch/support/filetest.rb +0 -29
- data/lib/ratch/toolset/ruby/announce +0 -224
- data/lib/ratch/toolset/ruby/compile +0 -49
- data/lib/ratch/toolset/ruby/install +0 -77
- data/lib/ratch/toolset/ruby/notes +0 -185
- data/lib/ratch/toolset/ruby/pack/gem +0 -93
- data/lib/ratch/toolset/ruby/pack/tgz +0 -46
- data/lib/ratch/toolset/ruby/pack/zip +0 -46
- data/lib/ratch/toolset/ruby/publish +0 -57
- data/lib/ratch/toolset/ruby/release +0 -8
- data/lib/ratch/toolset/ruby/setup +0 -1616
- data/lib/ratch/toolset/ruby/stamp +0 -33
- data/lib/ratch/toolset/ruby/stats +0 -138
- data/lib/ratch/toolset/ruby/test/crosstest +0 -305
- data/lib/ratch/toolset/ruby/test/extest +0 -129
- data/lib/ratch/toolset/ruby/test/isotest +0 -293
- data/lib/ratch/toolset/ruby/test/load +0 -39
- data/lib/ratch/toolset/ruby/test/loadtest +0 -28
- data/lib/ratch/toolset/ruby/test/syntax +0 -29
- data/lib/ratch/toolset/ruby/test/test +0 -26
- data/lib/ratch/toolset/sandbox/query +0 -11
- data/man/ratch.man +0 -73
- data/meta/MANIFEST +0 -130
- data/meta/config.yaml +0 -9
- data/meta/icli.yaml +0 -16
- data/meta/project.yaml +0 -20
- data/meta/ratch.roll +0 -2
- data/meta/xProjectInfo +0 -41
- data/task/clobber/package +0 -10
- data/task/man +0 -14
- data/task/publish +0 -57
- data/task/release +0 -9
- data/task/setup +0 -1616
- data/task/stats +0 -138
data/HISTORY
ADDED
data/MANIFEST
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
doc
|
|
2
|
+
test
|
|
3
|
+
test/README
|
|
4
|
+
test/test_helper.rb
|
|
5
|
+
test/test_task.rb
|
|
6
|
+
README
|
|
7
|
+
HISTORY
|
|
8
|
+
METADATA
|
|
9
|
+
demo
|
|
10
|
+
demo/tryme1.ratch
|
|
11
|
+
demo/tryme-task.ratch
|
|
12
|
+
lib
|
|
13
|
+
lib/ratch
|
|
14
|
+
lib/ratch/runmode.rb
|
|
15
|
+
lib/ratch/pathglob.rb
|
|
16
|
+
lib/ratch/core_ext
|
|
17
|
+
lib/ratch/core_ext/pathname.rb
|
|
18
|
+
lib/ratch/core_ext/object.rb
|
|
19
|
+
lib/ratch/core_ext/facets.rb
|
|
20
|
+
lib/ratch/core_ext/filetest.rb
|
|
21
|
+
lib/ratch/core_ext/to_list.rb
|
|
22
|
+
lib/ratch/core_ext/to_console.rb
|
|
23
|
+
lib/ratch/core_ext/string.rb
|
|
24
|
+
lib/ratch/dsl.rb
|
|
25
|
+
lib/ratch/service.rb
|
|
26
|
+
lib/ratch/core_ext.rb
|
|
27
|
+
lib/ratch/io.rb
|
|
28
|
+
lib/ratch/index.rb
|
|
29
|
+
lib/ratch/plugin.rb
|
|
30
|
+
lib/ratch/task.rb
|
|
31
|
+
lib/ratch/task2.rb
|
|
32
|
+
lib/ratch/script.rb
|
|
33
|
+
NEWS
|
|
34
|
+
bin
|
|
35
|
+
bin/ratch
|
|
36
|
+
COPYING
|
data/METADATA
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
project : ratch
|
|
2
|
+
version : 1.0.0
|
|
3
|
+
status : beta
|
|
4
|
+
homepage : http://ratch.rubyforge.org
|
|
5
|
+
author : trans <transfire@gmail.com>
|
|
6
|
+
requires : facets >=2.4.3
|
|
7
|
+
summary : Ruby-based Batch Scripting
|
|
8
|
+
abstract :
|
|
9
|
+
Ratch is a Ruby-based batch scripting language.
|
|
10
|
+
It's a DSL over regular RUby to make the life
|
|
11
|
+
of the batch script writter easier.
|
|
12
|
+
requires:
|
|
13
|
+
- [facets, >=2.4.3]
|
|
14
|
+
|
data/NEWS
ADDED
data/README
CHANGED
|
@@ -1,37 +1,87 @@
|
|
|
1
|
-
= Ratch
|
|
1
|
+
= Ratch -- Ruby-based Batch Scripts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
http://ratch.rubyforge.org
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
== Introduction
|
|
7
|
+
|
|
8
|
+
Ratch is Ruby-based DSL for building batch scripts. It's intent
|
|
9
|
+
is to ease the burdone a batch script writers, by supplementing
|
|
10
|
+
the standard ruby environamet to be more condusive the needs
|
|
11
|
+
of batch scripting.
|
|
12
|
+
|
|
13
|
+
In addition to using Ratch to write stand-alone batch scripts,
|
|
14
|
+
it makes a very powerful library for other applications that
|
|
15
|
+
require batch-like functionality. In general any program that
|
|
16
|
+
access the file system extensively could benifit from it's use.
|
|
4
17
|
|
|
5
|
-
Ratch is a Ruby-based Batch file system. It provides a Ruby-based DSL
|
|
6
|
-
for creating utility/task scripts. It is similar in function to build tools,
|
|
7
|
-
like Make, Ant, Maven, Rake, et al. But unlike these it stears clear
|
|
8
|
-
of monolithic design and instead more closely follows the "UNIX-way".
|
|
9
18
|
|
|
10
19
|
|
|
11
20
|
== Installation
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
Standard installation procedure apply.
|
|
14
23
|
|
|
15
|
-
|
|
24
|
+
$ gem install ratch
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
$ cd ratch-x.y.z
|
|
19
|
-
$ sudo task/setup
|
|
26
|
+
or manually
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
$ tar -xzf ratch-1.0.0.tgz
|
|
29
|
+
$ cd ratch-1.0.0
|
|
30
|
+
$ setup-rb all
|
|
22
31
|
|
|
23
|
-
$ ruby task/setup
|
|
24
32
|
|
|
25
33
|
|
|
26
34
|
== Usage
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
To use for your own scripts, simply add a bang line.
|
|
37
|
+
|
|
38
|
+
#!/usr/bin/env ratch
|
|
39
|
+
|
|
40
|
+
On Windows, of course, you will want to associate the .ratch extension
|
|
41
|
+
name to the ratch executable instead.
|
|
42
|
+
|
|
43
|
+
To use Ratch as a library, simply require 'ratch', and subclass.
|
|
44
|
+
|
|
45
|
+
require 'ratch'
|
|
46
|
+
|
|
47
|
+
class MyClass < Ratch::Service
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
Ratch also provides a delegated service which automatically supplies
|
|
53
|
+
method_missing() to delegate to the given *context*. This is called
|
|
54
|
+
a Ratch Plugin.
|
|
55
|
+
|
|
56
|
+
class MyClass < Ratch::Plugin
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
MyClass.new(context)
|
|
61
|
+
|
|
62
|
+
For details on all the functionality Ratch provides, please refer to
|
|
63
|
+
the API documentation.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
== Development
|
|
68
|
+
|
|
69
|
+
You can use gitweb to browse the 'ratch' repository.
|
|
70
|
+
|
|
71
|
+
To pull the 'ratch' repository anonymously, use:
|
|
72
|
+
|
|
73
|
+
git clone git://rubyforge.org/ratch.git
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Developers: You can push to the 'ratch' repository using:
|
|
77
|
+
|
|
78
|
+
gitosis@rubyforge.org:ratch.git
|
|
79
|
+
|
|
30
80
|
|
|
31
81
|
|
|
32
82
|
== Copying
|
|
33
83
|
|
|
34
|
-
Copyright (c) 2007
|
|
84
|
+
Copyright (c) 2007, 2008 Tiger Ops & Thomas Sawyer
|
|
35
85
|
|
|
36
|
-
Ratch is
|
|
86
|
+
Ratch is licensed under the terms of the MIT license.
|
|
37
87
|
|
data/bin/ratch
CHANGED
|
@@ -1,83 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
$0 = ARGV.shift
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require 'ratch/manager'
|
|
7
|
-
manager = Ratch::Manager.new
|
|
5
|
+
require 'ratch/script'
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
path = ARGV[2]
|
|
7
|
+
script = Ratch::Script.new
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
if setdirectory = manager.toolset?(set)
|
|
14
|
-
if path
|
|
15
|
-
if batchfile = manager.tool?(set, path)
|
|
16
|
-
require 'ratch/dsl'
|
|
17
|
-
self.batch_directory = setdirectory
|
|
18
|
-
load($0 = batchfile)
|
|
19
|
-
else
|
|
20
|
-
puts "no #{set} tool -- #{path}"
|
|
21
|
-
end
|
|
22
|
-
else
|
|
23
|
-
puts manager.tools(set).join("\n")
|
|
24
|
-
end
|
|
25
|
-
else
|
|
26
|
-
puts "no toolset -- #{set}"
|
|
27
|
-
end
|
|
28
|
-
else
|
|
29
|
-
puts manager.toolsets.join("\n")
|
|
30
|
-
end
|
|
9
|
+
script.instance_eval(File.read($0))
|
|
31
10
|
|
|
32
|
-
elsif ARGV.empty?
|
|
33
|
-
|
|
34
|
-
# TODO read stdin for ratch script
|
|
35
|
-
|
|
36
|
-
else
|
|
37
|
-
require 'ratch/dsl'
|
|
38
|
-
load($0 = ARGV.shift)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
# module Ratch
|
|
43
|
-
#
|
|
44
|
-
# class RatchCommand
|
|
45
|
-
#
|
|
46
|
-
# # Quick start.
|
|
47
|
-
#
|
|
48
|
-
# def self.start(file)
|
|
49
|
-
# new.run(file)
|
|
50
|
-
# end
|
|
51
|
-
#
|
|
52
|
-
# # Run task.
|
|
53
|
-
#
|
|
54
|
-
# def run(file)
|
|
55
|
-
# if file
|
|
56
|
-
# BatchFile.new(file).call
|
|
57
|
-
# else
|
|
58
|
-
# help
|
|
59
|
-
# end
|
|
60
|
-
# end
|
|
61
|
-
#
|
|
62
|
-
# # Dispaly help.
|
|
63
|
-
#
|
|
64
|
-
# def help
|
|
65
|
-
# help = <<-END
|
|
66
|
-
# USAGE:
|
|
67
|
-
#
|
|
68
|
-
# ratch [options] <taskfile>
|
|
69
|
-
#
|
|
70
|
-
# OPTIONS:
|
|
71
|
-
#
|
|
72
|
-
# --dryrun --nohram
|
|
73
|
-
#
|
|
74
|
-
# --trace
|
|
75
|
-
#
|
|
76
|
-
# --debug
|
|
77
|
-
# END
|
|
78
|
-
# puts help.gsub(/^\s+/, '')
|
|
79
|
-
# end
|
|
80
|
-
#
|
|
81
|
-
# end
|
|
82
|
-
#
|
|
83
|
-
# end
|
data/demo/tryme1.ratch
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'facets'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module FileTest
|
|
2
|
+
|
|
3
|
+
module_function
|
|
4
|
+
|
|
5
|
+
# Return a cached list of the PATH environment variable.
|
|
6
|
+
# This is a support method used by #bin?
|
|
7
|
+
|
|
8
|
+
def command_paths
|
|
9
|
+
@command_paths ||= ENV['PATH'].split(/[:;]/)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Is a file a command executable?
|
|
13
|
+
#
|
|
14
|
+
# TODO: Make more robust. Probably needs to be fixed for Windows.
|
|
15
|
+
|
|
16
|
+
def bin?(fname)
|
|
17
|
+
is_bin = command_paths.any? do |f|
|
|
18
|
+
FileTest.exist?(File.join(f, fname))
|
|
19
|
+
end
|
|
20
|
+
#is_bin ? File.basename(fname) : false
|
|
21
|
+
is_bin ? fname : false
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Is a path considered reasonably "safe"?
|
|
25
|
+
#
|
|
26
|
+
# TODO: Make more robust.
|
|
27
|
+
|
|
28
|
+
def safe?(path)
|
|
29
|
+
case path
|
|
30
|
+
when *[ '/', '/*', '/**/*' ]
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
true
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Does a path need updating, based on given +sources+?
|
|
37
|
+
# This compares mtimes of give paths. Returns false
|
|
38
|
+
# if the path needs to be updated.
|
|
39
|
+
|
|
40
|
+
def out_of_date?(path, *sources)
|
|
41
|
+
return true unless File.exist?(path)
|
|
42
|
+
|
|
43
|
+
sources = sources.collect{ |source| Dir.glob(source) }.flatten
|
|
44
|
+
mtimes = sources.collect{ |file| File.mtime(file) }
|
|
45
|
+
|
|
46
|
+
return true if mtimes.empty? # TODO: This the way to go here?
|
|
47
|
+
|
|
48
|
+
File.mtime(path) < mtimes.max
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'facets/pathname'
|
|
2
|
+
|
|
3
|
+
class Pathname
|
|
4
|
+
|
|
5
|
+
# Like directory? but return self if true, otherwise nil.
|
|
6
|
+
def dir?
|
|
7
|
+
directory? ? self : nil
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Already in Facets
|
|
11
|
+
#
|
|
12
|
+
# def glob(*opts)
|
|
13
|
+
# flags = 0
|
|
14
|
+
# opts.each do |opt|
|
|
15
|
+
# case opt when Symbol, String
|
|
16
|
+
# flags += File.const_get("FNM_#{opt}".upcase)
|
|
17
|
+
# else
|
|
18
|
+
# flags += opt
|
|
19
|
+
# end
|
|
20
|
+
# end
|
|
21
|
+
# self.class.glob(self.to_s, flags).collect{ |path| self.class.new(path) }
|
|
22
|
+
# end
|
|
23
|
+
#
|
|
24
|
+
# #
|
|
25
|
+
# def first(*opts)
|
|
26
|
+
# flags = 0
|
|
27
|
+
# opts.each do |opt|
|
|
28
|
+
# case opt when Symbol, String
|
|
29
|
+
# flags += File.const_get("FNM_#{opt}".upcase)
|
|
30
|
+
# else
|
|
31
|
+
# flags += opt
|
|
32
|
+
# end
|
|
33
|
+
# end
|
|
34
|
+
# file = self.class.glob(self.to_s, flags).first
|
|
35
|
+
# file ? self.class.new(file) : nil
|
|
36
|
+
# end
|
|
37
|
+
|
|
38
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class String
|
|
2
|
+
|
|
3
|
+
# okay this is a bit much --we should subclass string.
|
|
4
|
+
# but it will do for now and we will work this out
|
|
5
|
+
# when CLIO is up and running.
|
|
6
|
+
attr_accessor :color
|
|
7
|
+
|
|
8
|
+
# Find actual filename (casefolding) and returns it.
|
|
9
|
+
# Returns nil if no file is found.
|
|
10
|
+
|
|
11
|
+
def to_actual_filename
|
|
12
|
+
Dir.glob(self, File::FNM_CASEFOLD).first
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Find actual filename (casefolding) and replace string with it.
|
|
16
|
+
# If file not found, string remains the same and method returns nil.
|
|
17
|
+
|
|
18
|
+
def to_actual_filename!
|
|
19
|
+
filename = to_actual_filename
|
|
20
|
+
replace(filename) if filename
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
def unfold_paragraphs
|
|
25
|
+
blank = false
|
|
26
|
+
text = ''
|
|
27
|
+
split(/\n/).each do |line|
|
|
28
|
+
if /\S/ !~ line
|
|
29
|
+
text << "\n\n"
|
|
30
|
+
blank = true
|
|
31
|
+
else
|
|
32
|
+
if /^(\s+|[*])/ =~ line
|
|
33
|
+
text << (line.rstrip + "\n")
|
|
34
|
+
else
|
|
35
|
+
text << (line.rstrip + " ")
|
|
36
|
+
end
|
|
37
|
+
blank = false
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
return text
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
@@ -1,81 +1,6 @@
|
|
|
1
|
-
# = TITLE:
|
|
2
1
|
#
|
|
3
|
-
# Console
|
|
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
|
-
module Ratch
|
|
25
|
-
module Dsl
|
|
26
|
-
|
|
27
|
-
module Console
|
|
28
|
-
|
|
29
|
-
# Convenient method to get simple console reply.
|
|
30
|
-
|
|
31
|
-
def ask(question, answers=nil)
|
|
32
|
-
print "#{question}"
|
|
33
|
-
print " [#{answers}] " if answers
|
|
34
|
-
until inp = $stdin.gets ; sleep 1 ; end
|
|
35
|
-
inp
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Ask for a password. (FIXME: only for unix so far)
|
|
39
|
-
|
|
40
|
-
def password(prompt=nil)
|
|
41
|
-
msg ||= "Enter Password: "
|
|
42
|
-
inp = ''
|
|
43
|
-
|
|
44
|
-
print "#{prompt} "
|
|
45
|
-
|
|
46
|
-
begin
|
|
47
|
-
system "stty -echo"
|
|
48
|
-
#inp = gets.chomp
|
|
49
|
-
until inp = $stdin.gets
|
|
50
|
-
sleep 1
|
|
51
|
-
end
|
|
52
|
-
ensure
|
|
53
|
-
system "stty echo"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
return inp.chomp
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Internal status report.
|
|
60
|
-
# Only output if dryrun or trace mode.
|
|
61
|
-
|
|
62
|
-
def status(message)
|
|
63
|
-
puts message if dryrun? or trace?
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
|
|
71
2
|
class Array
|
|
72
3
|
|
|
73
|
-
# Not empty?
|
|
74
|
-
|
|
75
|
-
def not_empty?
|
|
76
|
-
!empty?
|
|
77
|
-
end
|
|
78
|
-
|
|
79
4
|
# Convert an array into command line parameters.
|
|
80
5
|
# The array is accepted in the format of Ruby
|
|
81
6
|
# method arguments --ie. [arg1, arg2, ..., hash]
|
|
@@ -85,6 +10,7 @@ class Array
|
|
|
85
10
|
flags = flags.to_console
|
|
86
11
|
flags + ' ' + join(" ")
|
|
87
12
|
end
|
|
13
|
+
|
|
88
14
|
alias_method :to_params, :to_console
|
|
89
15
|
|
|
90
16
|
# def to_console
|
|
@@ -107,7 +33,6 @@ class Array
|
|
|
107
33
|
|
|
108
34
|
end
|
|
109
35
|
|
|
110
|
-
|
|
111
36
|
class Hash
|
|
112
37
|
|
|
113
38
|
# Convert an array into command line parameters.
|
|
@@ -151,3 +76,4 @@ class Hash
|
|
|
151
76
|
alias_method :command_vector, :argumentize
|
|
152
77
|
|
|
153
78
|
end
|
|
79
|
+
|