drydock 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +12 -0
- data/README.rdoc +39 -35
- data/Rakefile +11 -6
- data/bin/example +22 -17
- data/doc/classes/Drydock.html +101 -101
- data/doc/classes/Drydock/Command.html +26 -18
- data/doc/classes/Drydock/InvalidArgument.html +11 -11
- data/doc/classes/Drydock/MissingArgument.html +6 -6
- data/doc/classes/Drydock/NoCommandsDefined.html +6 -6
- data/doc/classes/Drydock/UnknownCommand.html +11 -11
- data/doc/created.rid +1 -1
- data/doc/files/CHANGES_txt.html +25 -2
- data/doc/files/LICENSE_txt.html +2 -2
- data/doc/files/README_rdoc.html +14 -6
- data/doc/files/bin/example.html +19 -33
- data/doc/files/lib/drydock_rb.html +2 -2
- data/doc/fr_class_index.html +1 -1
- data/doc/fr_file_index.html +1 -1
- data/doc/fr_method_index.html +59 -61
- data/doc/index.html +1 -1
- data/drydock.gemspec +1 -1
- data/lib/drydock.rb +11 -0
- metadata +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
2
|
<html lang='en'>
|
3
3
|
<head>
|
4
|
-
<title>File: drydock.rb [
|
4
|
+
<title>File: drydock.rb [A seaworthy DSL for writing command line apps]</title>
|
5
5
|
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
6
|
<link href='../.././rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
7
|
<script type='text/javascript'>
|
@@ -31,7 +31,7 @@
|
|
31
31
|
</div>
|
32
32
|
<div class='last-update'>
|
33
33
|
Last Update:
|
34
|
-
<span class='datetime'>
|
34
|
+
<span class='datetime'>Sat Feb 14 14:08:44 -0500 2009</span>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<div id='content'>
|
data/doc/fr_class_index.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
2
|
<html lang='en'>
|
3
3
|
<head>
|
4
|
-
<title>Classes [
|
4
|
+
<title>Classes [A seaworthy DSL for writing command line apps]</title>
|
5
5
|
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
6
|
<link href='rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
7
|
<base target='docwin'>
|
data/doc/fr_file_index.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
2
|
<html lang='en'>
|
3
3
|
<head>
|
4
|
-
<title>Files [
|
4
|
+
<title>Files [A seaworthy DSL for writing command line apps]</title>
|
5
5
|
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
6
|
<link href='rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
7
|
<base target='docwin'>
|
data/doc/fr_method_index.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
2
|
<html lang='en'>
|
3
3
|
<head>
|
4
|
-
<title>Methods [
|
4
|
+
<title>Methods [A seaworthy DSL for writing command line apps]</title>
|
5
5
|
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
6
|
<link href='rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
7
|
<base target='docwin'>
|
@@ -4331,36 +4331,35 @@
|
|
4331
4331
|
|
4332
4332
|
Element.addMethods();
|
4333
4333
|
var search_index = [
|
4334
|
-
{ method: 'after', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4335
|
-
{ method: 'alias_command', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4336
|
-
{ method: 'before', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4337
|
-
{ method: 'call', module: 'drydock::command', html: '<a href="classes/Drydock/Command.html#
|
4338
|
-
{ method: 'command', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4339
|
-
{ method: 'command_alias', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4340
|
-
{ method: 'commands', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4341
|
-
{ method: 'debug', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4342
|
-
{ method: 'debug?', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4343
|
-
{ method: 'default', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4344
|
-
{ method: 'get_current_option_parser', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4345
|
-
{ method: 'global_option', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4346
|
-
{ method: 'global_usage', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4347
|
-
{ method: 'has_run?', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4348
|
-
{ method: 'ignore', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4349
|
-
{ method: 'message', module: 'drydock::nocommandsdefined', html: '<a href="classes/Drydock/NoCommandsDefined.html#
|
4350
|
-
{ method: 'message', module: 'drydock::
|
4351
|
-
{ method: 'message', module: 'drydock::
|
4352
|
-
{ method: 'message', module: 'drydock::
|
4353
|
-
{ method: 'new', module: 'drydock::
|
4354
|
-
{ method: 'new', module: 'drydock::
|
4355
|
-
{ method: 'new', module: 'drydock::
|
4356
|
-
{ method: 'option', module: 'drydock', html: '<a href="classes/Drydock.html#
|
4357
|
-
{ method: '
|
4358
|
-
{ method: 'run
|
4359
|
-
{ method: 'run
|
4360
|
-
{ method: '
|
4361
|
-
{ method: '
|
4362
|
-
{ method: '
|
4363
|
-
{ method: 'usage', module: 'drydock', html: '<a href="classes/Drydock.html#M000009"><span class="method_name">usage</span> <span class="module_name">(Drydock)</span></a>' },
|
4334
|
+
{ method: 'after', module: 'drydock', html: '<a href="classes/Drydock.html#M000006"><span class="method_name">after</span> <span class="module_name">(Drydock)</span></a>' },
|
4335
|
+
{ method: 'alias_command', module: 'drydock', html: '<a href="classes/Drydock.html#M000014"><span class="method_name">alias_command</span> <span class="module_name">(Drydock)</span></a>' },
|
4336
|
+
{ method: 'before', module: 'drydock', html: '<a href="classes/Drydock.html#M000005"><span class="method_name">before</span> <span class="module_name">(Drydock)</span></a>' },
|
4337
|
+
{ method: 'call', module: 'drydock::command', html: '<a href="classes/Drydock/Command.html#M000027"><span class="method_name">call</span> <span class="module_name">(Drydock::Command)</span></a>' },
|
4338
|
+
{ method: 'command', module: 'drydock', html: '<a href="classes/Drydock.html#M000013"><span class="method_name">command</span> <span class="module_name">(Drydock)</span></a>' },
|
4339
|
+
{ method: 'command_alias', module: 'drydock', html: '<a href="classes/Drydock.html#M000015"><span class="method_name">command_alias</span> <span class="module_name">(Drydock)</span></a>' },
|
4340
|
+
{ method: 'commands', module: 'drydock', html: '<a href="classes/Drydock.html#M000016"><span class="method_name">commands</span> <span class="module_name">(Drydock)</span></a>' },
|
4341
|
+
{ method: 'debug', module: 'drydock', html: '<a href="classes/Drydock.html#M000001"><span class="method_name">debug</span> <span class="module_name">(Drydock)</span></a>' },
|
4342
|
+
{ method: 'debug?', module: 'drydock', html: '<a href="classes/Drydock.html#M000002"><span class="method_name">debug?</span> <span class="module_name">(Drydock)</span></a>' },
|
4343
|
+
{ method: 'default', module: 'drydock', html: '<a href="classes/Drydock.html#M000003"><span class="method_name">default</span> <span class="module_name">(Drydock)</span></a>' },
|
4344
|
+
{ method: 'get_current_option_parser', module: 'drydock', html: '<a href="classes/Drydock.html#M000009"><span class="method_name">get_current_option_parser</span> <span class="module_name">(Drydock)</span></a>' },
|
4345
|
+
{ method: 'global_option', module: 'drydock', html: '<a href="classes/Drydock.html#M000011"><span class="method_name">global_option</span> <span class="module_name">(Drydock)</span></a>' },
|
4346
|
+
{ method: 'global_usage', module: 'drydock', html: '<a href="classes/Drydock.html#M000007"><span class="method_name">global_usage</span> <span class="module_name">(Drydock)</span></a>' },
|
4347
|
+
{ method: 'has_run?', module: 'drydock', html: '<a href="classes/Drydock.html#M000019"><span class="method_name">has_run?</span> <span class="module_name">(Drydock)</span></a>' },
|
4348
|
+
{ method: 'ignore', module: 'drydock', html: '<a href="classes/Drydock.html#M000010"><span class="method_name">ignore</span> <span class="module_name">(Drydock)</span></a>' },
|
4349
|
+
{ method: 'message', module: 'drydock::nocommandsdefined', html: '<a href="classes/Drydock/NoCommandsDefined.html#M000025"><span class="method_name">message</span> <span class="module_name">(Drydock::NoCommandsDefined)</span></a>' },
|
4350
|
+
{ method: 'message', module: 'drydock::missingargument', html: '<a href="classes/Drydock/MissingArgument.html#M000029"><span class="method_name">message</span> <span class="module_name">(Drydock::MissingArgument)</span></a>' },
|
4351
|
+
{ method: 'message', module: 'drydock::invalidargument', html: '<a href="classes/Drydock/InvalidArgument.html#M000024"><span class="method_name">message</span> <span class="module_name">(Drydock::InvalidArgument)</span></a>' },
|
4352
|
+
{ method: 'message', module: 'drydock::unknowncommand', html: '<a href="classes/Drydock/UnknownCommand.html#M000022"><span class="method_name">message</span> <span class="module_name">(Drydock::UnknownCommand)</span></a>' },
|
4353
|
+
{ method: 'new', module: 'drydock::command', html: '<a href="classes/Drydock/Command.html#M000026"><span class="method_name">new</span> <span class="module_name">(Drydock::Command)</span></a>' },
|
4354
|
+
{ method: 'new', module: 'drydock::unknowncommand', html: '<a href="classes/Drydock/UnknownCommand.html#M000021"><span class="method_name">new</span> <span class="module_name">(Drydock::UnknownCommand)</span></a>' },
|
4355
|
+
{ method: 'new', module: 'drydock::invalidargument', html: '<a href="classes/Drydock/InvalidArgument.html#M000023"><span class="method_name">new</span> <span class="module_name">(Drydock::InvalidArgument)</span></a>' },
|
4356
|
+
{ method: 'option', module: 'drydock', html: '<a href="classes/Drydock.html#M000012"><span class="method_name">option</span> <span class="module_name">(Drydock)</span></a>' },
|
4357
|
+
{ method: 'run!', module: 'drydock', html: '<a href="classes/Drydock.html#M000020"><span class="method_name">run!</span> <span class="module_name">(Drydock)</span></a>' },
|
4358
|
+
{ method: 'run=', module: 'drydock', html: '<a href="classes/Drydock.html#M000018"><span class="method_name">run=</span> <span class="module_name">(Drydock)</span></a>' },
|
4359
|
+
{ method: 'run?', module: 'drydock', html: '<a href="classes/Drydock.html#M000017"><span class="method_name">run?</span> <span class="module_name">(Drydock)</span></a>' },
|
4360
|
+
{ method: 'stdin', module: 'drydock', html: '<a href="classes/Drydock.html#M000004"><span class="method_name">stdin</span> <span class="module_name">(Drydock)</span></a>' },
|
4361
|
+
{ method: 'to_s', module: 'drydock::command', html: '<a href="classes/Drydock/Command.html#M000028"><span class="method_name">to_s</span> <span class="module_name">(Drydock::Command)</span></a>' },
|
4362
|
+
{ method: 'usage', module: 'drydock', html: '<a href="classes/Drydock.html#M000008"><span class="method_name">usage</span> <span class="module_name">(Drydock)</span></a>' },
|
4364
4363
|
]
|
4365
4364
|
$(document).observe('dom:loaded', function() {
|
4366
4365
|
// Setup search-during-typing.
|
@@ -4423,36 +4422,35 @@
|
|
4423
4422
|
</form>
|
4424
4423
|
<ol class='methods' id='search-results' style='display: none'></ol>
|
4425
4424
|
<ol class='methods' id='index-entries'>
|
4426
|
-
<li><a href="classes/Drydock.html#
|
4427
|
-
<li><a href="classes/Drydock.html#
|
4428
|
-
<li><a href="classes/Drydock.html#
|
4429
|
-
<li><a href="classes/Drydock/Command.html#
|
4430
|
-
<li><a href="classes/Drydock.html#
|
4431
|
-
<li><a href="classes/Drydock.html#
|
4432
|
-
<li><a href="classes/Drydock.html#
|
4433
|
-
<li><a href="classes/Drydock.html#
|
4434
|
-
<li><a href="classes/Drydock.html#
|
4435
|
-
<li><a href="classes/Drydock.html#
|
4436
|
-
<li><a href="classes/Drydock.html#
|
4437
|
-
<li><a href="classes/Drydock.html#
|
4438
|
-
<li><a href="classes/Drydock.html#
|
4439
|
-
<li><a href="classes/Drydock.html#
|
4440
|
-
<li><a href="classes/Drydock.html#
|
4441
|
-
<li><a href="classes/Drydock/NoCommandsDefined.html#
|
4442
|
-
<li><a href="classes/Drydock/
|
4443
|
-
<li><a href="classes/Drydock/
|
4444
|
-
<li><a href="classes/Drydock/
|
4445
|
-
<li><a href="classes/Drydock/
|
4446
|
-
<li><a href="classes/Drydock/
|
4447
|
-
<li><a href="classes/Drydock/
|
4448
|
-
<li><a href="classes/Drydock.html#
|
4449
|
-
<li><a href="
|
4450
|
-
<li><a href="classes/Drydock.html#
|
4451
|
-
<li><a href="classes/Drydock.html#
|
4452
|
-
<li><a href="classes/Drydock.html#
|
4453
|
-
<li><a href="classes/Drydock.html#
|
4454
|
-
<li><a href="classes/Drydock
|
4455
|
-
<li><a href="classes/Drydock.html#M000009"><span class="method_name">usage</span> <span class="module_name">(Drydock)</span></a></li>
|
4425
|
+
<li><a href="classes/Drydock.html#M000006"><span class="method_name">after</span> <span class="module_name">(Drydock)</span></a></li>
|
4426
|
+
<li><a href="classes/Drydock.html#M000014"><span class="method_name">alias_command</span> <span class="module_name">(Drydock)</span></a></li>
|
4427
|
+
<li><a href="classes/Drydock.html#M000005"><span class="method_name">before</span> <span class="module_name">(Drydock)</span></a></li>
|
4428
|
+
<li><a href="classes/Drydock/Command.html#M000027"><span class="method_name">call</span> <span class="module_name">(Drydock::Command)</span></a></li>
|
4429
|
+
<li><a href="classes/Drydock.html#M000013"><span class="method_name">command</span> <span class="module_name">(Drydock)</span></a></li>
|
4430
|
+
<li><a href="classes/Drydock.html#M000015"><span class="method_name">command_alias</span> <span class="module_name">(Drydock)</span></a></li>
|
4431
|
+
<li><a href="classes/Drydock.html#M000016"><span class="method_name">commands</span> <span class="module_name">(Drydock)</span></a></li>
|
4432
|
+
<li><a href="classes/Drydock.html#M000001"><span class="method_name">debug</span> <span class="module_name">(Drydock)</span></a></li>
|
4433
|
+
<li><a href="classes/Drydock.html#M000002"><span class="method_name">debug?</span> <span class="module_name">(Drydock)</span></a></li>
|
4434
|
+
<li><a href="classes/Drydock.html#M000003"><span class="method_name">default</span> <span class="module_name">(Drydock)</span></a></li>
|
4435
|
+
<li><a href="classes/Drydock.html#M000009"><span class="method_name">get_current_option_parser</span> <span class="module_name">(Drydock)</span></a></li>
|
4436
|
+
<li><a href="classes/Drydock.html#M000011"><span class="method_name">global_option</span> <span class="module_name">(Drydock)</span></a></li>
|
4437
|
+
<li><a href="classes/Drydock.html#M000007"><span class="method_name">global_usage</span> <span class="module_name">(Drydock)</span></a></li>
|
4438
|
+
<li><a href="classes/Drydock.html#M000019"><span class="method_name">has_run?</span> <span class="module_name">(Drydock)</span></a></li>
|
4439
|
+
<li><a href="classes/Drydock.html#M000010"><span class="method_name">ignore</span> <span class="module_name">(Drydock)</span></a></li>
|
4440
|
+
<li><a href="classes/Drydock/NoCommandsDefined.html#M000025"><span class="method_name">message</span> <span class="module_name">(Drydock::NoCommandsDefined)</span></a></li>
|
4441
|
+
<li><a href="classes/Drydock/MissingArgument.html#M000029"><span class="method_name">message</span> <span class="module_name">(Drydock::MissingArgument)</span></a></li>
|
4442
|
+
<li><a href="classes/Drydock/InvalidArgument.html#M000024"><span class="method_name">message</span> <span class="module_name">(Drydock::InvalidArgument)</span></a></li>
|
4443
|
+
<li><a href="classes/Drydock/UnknownCommand.html#M000022"><span class="method_name">message</span> <span class="module_name">(Drydock::UnknownCommand)</span></a></li>
|
4444
|
+
<li><a href="classes/Drydock/Command.html#M000026"><span class="method_name">new</span> <span class="module_name">(Drydock::Command)</span></a></li>
|
4445
|
+
<li><a href="classes/Drydock/UnknownCommand.html#M000021"><span class="method_name">new</span> <span class="module_name">(Drydock::UnknownCommand)</span></a></li>
|
4446
|
+
<li><a href="classes/Drydock/InvalidArgument.html#M000023"><span class="method_name">new</span> <span class="module_name">(Drydock::InvalidArgument)</span></a></li>
|
4447
|
+
<li><a href="classes/Drydock.html#M000012"><span class="method_name">option</span> <span class="module_name">(Drydock)</span></a></li>
|
4448
|
+
<li><a href="classes/Drydock.html#M000020"><span class="method_name">run!</span> <span class="module_name">(Drydock)</span></a></li>
|
4449
|
+
<li><a href="classes/Drydock.html#M000018"><span class="method_name">run=</span> <span class="module_name">(Drydock)</span></a></li>
|
4450
|
+
<li><a href="classes/Drydock.html#M000017"><span class="method_name">run?</span> <span class="module_name">(Drydock)</span></a></li>
|
4451
|
+
<li><a href="classes/Drydock.html#M000004"><span class="method_name">stdin</span> <span class="module_name">(Drydock)</span></a></li>
|
4452
|
+
<li><a href="classes/Drydock/Command.html#M000028"><span class="method_name">to_s</span> <span class="module_name">(Drydock::Command)</span></a></li>
|
4453
|
+
<li><a href="classes/Drydock.html#M000008"><span class="method_name">usage</span> <span class="module_name">(Drydock)</span></a></li>
|
4456
4454
|
</ol>
|
4457
4455
|
</div>
|
4458
4456
|
</body>
|
data/doc/index.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2
2
|
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
3
3
|
<head>
|
4
|
-
<title>
|
4
|
+
<title>A seaworthy DSL for writing command line apps</title>
|
5
5
|
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
6
|
</head>
|
7
7
|
<frameset border='1' bordercolor='gray' cols='20%, *' frameborder='1'>
|
data/drydock.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = %q{drydock}
|
3
|
-
s.version = "0.3.
|
3
|
+
s.version = "0.3.3"
|
4
4
|
s.specification_version = 1 if s.respond_to? :specification_version=
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
|
data/lib/drydock.rb
CHANGED
@@ -24,6 +24,12 @@ module Drydock
|
|
24
24
|
#
|
25
25
|
class Command
|
26
26
|
attr_reader :cmd, :alias
|
27
|
+
|
28
|
+
# The default constructor sets the short name of the command
|
29
|
+
# and stores a reference to the block (if supplied).
|
30
|
+
# You don't need to override this method to add functionality
|
31
|
+
# to your custom Command classes. Define an +init+ method instead.
|
32
|
+
# It will be called just before the block is executed.
|
27
33
|
# +cmd+ is the short name of this command.
|
28
34
|
# +b+ is the block associated to this command.
|
29
35
|
def initialize(cmd, &b)
|
@@ -33,6 +39,8 @@ module Drydock
|
|
33
39
|
|
34
40
|
# Execute the block.
|
35
41
|
#
|
42
|
+
# Calls self.init before calling the block. Implement this method when
|
43
|
+
#
|
36
44
|
# +cmd_str+ is the short name used to evoke this command. It will equal @cmd
|
37
45
|
# unless an alias was used used to evoke this command.
|
38
46
|
# +argv+ an array of unnamed arguments. If ignore :options was declared this
|
@@ -45,6 +53,9 @@ module Drydock
|
|
45
53
|
global_options.merge(options).each_pair do |n,v|
|
46
54
|
self.send("#{n}=", v)
|
47
55
|
end
|
56
|
+
|
57
|
+
self.init if respond_to? :init
|
58
|
+
|
48
59
|
block_args = [self, argv, stdin] # TODO: review order
|
49
60
|
@b.call(*block_args[0..(@b.arity-1)]) # send only as many args as defined
|
50
61
|
end
|