drydock 0.3.2 → 0.3.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.
- 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>Class: Drydock::Command [
|
4
|
+
<title>Class: Drydock::Command [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'>
|
@@ -62,12 +62,12 @@
|
|
62
62
|
<h2>Methods</h2>
|
63
63
|
<h3>public class</h3>
|
64
64
|
<ol>
|
65
|
-
<li><a href="#
|
65
|
+
<li><a href="#M000026">new</a></li>
|
66
66
|
</ol>
|
67
67
|
<h3>public instance</h3>
|
68
68
|
<ol>
|
69
|
-
<li><a href="#
|
70
|
-
<li><a href="#
|
69
|
+
<li><a href="#M000027">call</a></li>
|
70
|
+
<li><a href="#M000028">to_s</a></li>
|
71
71
|
</ol>
|
72
72
|
</div>
|
73
73
|
<div id='section'>
|
@@ -90,28 +90,33 @@
|
|
90
90
|
</div>
|
91
91
|
<div id='methods'>
|
92
92
|
<h2>Public class methods</h2>
|
93
|
-
<div class='public-class method' id='method-
|
94
|
-
<a name='
|
93
|
+
<div class='public-class method' id='method-M000026'>
|
94
|
+
<a name='M000026'> </a>
|
95
95
|
<div class='synopsis'>
|
96
96
|
<span class='name'>new</span>
|
97
97
|
<span class='arguments'>(cmd, &b)</span>
|
98
98
|
</div>
|
99
99
|
<div class='description'>
|
100
100
|
<p>
|
101
|
-
|
102
|
-
|
101
|
+
The default constructor sets the short name of the command and stores a
|
102
|
+
reference to the block (if supplied). You don’t need to override this
|
103
|
+
method to add functionality to your custom <a
|
104
|
+
href="Command.html">Command</a> classes. Define an <tt>init</tt> method
|
105
|
+
instead. It will be called just before the block is executed. <tt>cmd</tt>
|
106
|
+
is the short name of this command. <tt>b</tt> is the block associated to
|
107
|
+
this command.
|
103
108
|
</p>
|
104
109
|
</div>
|
105
110
|
<div class='source'>
|
106
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
111
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
|
107
112
|
[show source]
|
108
113
|
</a>
|
109
|
-
<pre id='
|
114
|
+
<pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 35</span>
35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">cmd</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
36: <span class="ruby-ivar">@cmd</span> = (<span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Symbol</span>)) <span class="ruby-operator">?</span> <span class="ruby-identifier">cmd</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">to_sym</span>
37: <span class="ruby-ivar">@b</span> = <span class="ruby-identifier">b</span>
38: <span class="ruby-keyword kw">end</span></pre>
|
110
115
|
</div>
|
111
116
|
</div>
|
112
117
|
<h2>Public instance methods</h2>
|
113
|
-
<div class='public-instance method' id='method-
|
114
|
-
<a name='
|
118
|
+
<div class='public-instance method' id='method-M000027'>
|
119
|
+
<a name='M000027'> </a>
|
115
120
|
<div class='synopsis'>
|
116
121
|
<span class='name'>call</span>
|
117
122
|
<span class='arguments'>(cmd_str=nil, argv=[], stdin=[], global_options={}, options={})</span>
|
@@ -121,6 +126,9 @@
|
|
121
126
|
Execute the block.
|
122
127
|
</p>
|
123
128
|
<p>
|
129
|
+
Calls self.init before calling the block. Implement this method when
|
130
|
+
</p>
|
131
|
+
<p>
|
124
132
|
<tt>cmd_str</tt> is the short name used to evoke this command. It will
|
125
133
|
equal @cmd unless an alias was used used to evoke this command.
|
126
134
|
<tt>argv</tt> an array of unnamed arguments. If ignore :options was
|
@@ -132,14 +140,14 @@
|
|
132
140
|
</p>
|
133
141
|
</div>
|
134
142
|
<div class='source'>
|
135
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
143
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
|
136
144
|
[show source]
|
137
145
|
</a>
|
138
|
-
<pre id='
|
146
|
+
<pre id='M000027-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 51</span>
51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">cmd_str</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">argv</span>=[], <span class="ruby-identifier">stdin</span>=[], <span class="ruby-identifier">global_options</span>={}, <span class="ruby-identifier">options</span>={})
52: <span class="ruby-ivar">@alias</span> = <span class="ruby-identifier">cmd_str</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-ivar">@cmd</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">cmd_str</span>
53: <span class="ruby-identifier">global_options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>).<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">n</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
54: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{n}="</span>, <span class="ruby-identifier">v</span>)
55: <span class="ruby-keyword kw">end</span>
56: 
57: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:init</span>
58: 
59: <span class="ruby-identifier">block_args</span> = [<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">argv</span>, <span class="ruby-identifier">stdin</span>] <span class="ruby-comment cmt"># TODO: review order</span>
60: <span class="ruby-ivar">@b</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">block_args</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span>(<span class="ruby-ivar">@b</span>.<span class="ruby-identifier">arity</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)]) <span class="ruby-comment cmt"># send only as many args as defined</span>
61: <span class="ruby-keyword kw">end</span></pre>
|
139
147
|
</div>
|
140
148
|
</div>
|
141
|
-
<div class='public-instance method' id='method-
|
142
|
-
<a name='
|
149
|
+
<div class='public-instance method' id='method-M000028'>
|
150
|
+
<a name='M000028'> </a>
|
143
151
|
<div class='synopsis'>
|
144
152
|
<span class='name'>to_s</span>
|
145
153
|
<span class='arguments'>()</span>
|
@@ -150,10 +158,10 @@
|
|
150
158
|
</p>
|
151
159
|
</div>
|
152
160
|
<div class='source'>
|
153
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
161
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
|
154
162
|
[show source]
|
155
163
|
</a>
|
156
|
-
<pre id='
|
164
|
+
<pre id='M000028-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 64</span>
64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
65: <span class="ruby-ivar">@cmd</span>.<span class="ruby-identifier">to_s</span>
66: <span class="ruby-keyword kw">end</span></pre>
|
157
165
|
</div>
|
158
166
|
</div>
|
159
167
|
</div>
|
@@ -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>Class: Drydock::InvalidArgument [
|
4
|
+
<title>Class: Drydock::InvalidArgument [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'>
|
@@ -45,11 +45,11 @@
|
|
45
45
|
<h2>Methods</h2>
|
46
46
|
<h3>public class</h3>
|
47
47
|
<ol>
|
48
|
-
<li><a href="#
|
48
|
+
<li><a href="#M000023">new</a></li>
|
49
49
|
</ol>
|
50
50
|
<h3>public instance</h3>
|
51
51
|
<ol>
|
52
|
-
<li><a href="#
|
52
|
+
<li><a href="#M000024">message</a></li>
|
53
53
|
</ol>
|
54
54
|
</div>
|
55
55
|
<div id='section'>
|
@@ -67,31 +67,31 @@
|
|
67
67
|
</div>
|
68
68
|
<div id='methods'>
|
69
69
|
<h2>Public class methods</h2>
|
70
|
-
<div class='public-class method' id='method-
|
71
|
-
<a name='
|
70
|
+
<div class='public-class method' id='method-M000023'>
|
71
|
+
<a name='M000023'> </a>
|
72
72
|
<div class='synopsis'>
|
73
73
|
<span class='name'>new</span>
|
74
74
|
<span class='arguments'>(args)</span>
|
75
75
|
</div>
|
76
76
|
<div class='source'>
|
77
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
77
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
|
78
78
|
[show source]
|
79
79
|
</a>
|
80
|
-
<pre id='
|
80
|
+
<pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 87</span>
87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)
88: <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span> <span class="ruby-operator">||</span> []
89: <span class="ruby-keyword kw">end</span></pre>
|
81
81
|
</div>
|
82
82
|
</div>
|
83
83
|
<h2>Public instance methods</h2>
|
84
|
-
<div class='public-instance method' id='method-
|
85
|
-
<a name='
|
84
|
+
<div class='public-instance method' id='method-M000024'>
|
85
|
+
<a name='M000024'> </a>
|
86
86
|
<div class='synopsis'>
|
87
87
|
<span class='name'>message</span>
|
88
88
|
<span class='arguments'>()</span>
|
89
89
|
</div>
|
90
90
|
<div class='source'>
|
91
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
91
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
|
92
92
|
[show source]
|
93
93
|
</a>
|
94
|
-
<pre id='
|
94
|
+
<pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 90</span>
90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>
91: <span class="ruby-node">"Unknown option: #{@args.join(", ")}"</span>
92: <span class="ruby-keyword kw">end</span></pre>
|
95
95
|
</div>
|
96
96
|
</div>
|
97
97
|
</div>
|
@@ -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>Class: Drydock::MissingArgument [
|
4
|
+
<title>Class: Drydock::MissingArgument [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'>
|
@@ -45,23 +45,23 @@
|
|
45
45
|
<h2>Methods</h2>
|
46
46
|
<h3>public instance</h3>
|
47
47
|
<ol>
|
48
|
-
<li><a href="#
|
48
|
+
<li><a href="#M000029">message</a></li>
|
49
49
|
</ol>
|
50
50
|
</div>
|
51
51
|
<div id='section'>
|
52
52
|
<div id='methods'>
|
53
53
|
<h2>Public instance methods</h2>
|
54
|
-
<div class='public-instance method' id='method-
|
55
|
-
<a name='
|
54
|
+
<div class='public-instance method' id='method-M000029'>
|
55
|
+
<a name='M000029'> </a>
|
56
56
|
<div class='synopsis'>
|
57
57
|
<span class='name'>message</span>
|
58
58
|
<span class='arguments'>()</span>
|
59
59
|
</div>
|
60
60
|
<div class='source'>
|
61
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
61
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
|
62
62
|
[show source]
|
63
63
|
</a>
|
64
|
-
<pre id='
|
64
|
+
<pre id='M000029-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 95</span>
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>
96: <span class="ruby-node">"Option requires a value: #{@args.join(", ")}"</span>
97: <span class="ruby-keyword kw">end</span></pre>
|
65
65
|
</div>
|
66
66
|
</div>
|
67
67
|
</div>
|
@@ -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>Class: Drydock::NoCommandsDefined [
|
4
|
+
<title>Class: Drydock::NoCommandsDefined [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'>
|
@@ -45,23 +45,23 @@
|
|
45
45
|
<h2>Methods</h2>
|
46
46
|
<h3>public instance</h3>
|
47
47
|
<ol>
|
48
|
-
<li><a href="#
|
48
|
+
<li><a href="#M000025">message</a></li>
|
49
49
|
</ol>
|
50
50
|
</div>
|
51
51
|
<div id='section'>
|
52
52
|
<div id='methods'>
|
53
53
|
<h2>Public instance methods</h2>
|
54
|
-
<div class='public-instance method' id='method-
|
55
|
-
<a name='
|
54
|
+
<div class='public-instance method' id='method-M000025'>
|
55
|
+
<a name='M000025'> </a>
|
56
56
|
<div class='synopsis'>
|
57
57
|
<span class='name'>message</span>
|
58
58
|
<span class='arguments'>()</span>
|
59
59
|
</div>
|
60
60
|
<div class='source'>
|
61
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
61
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
|
62
62
|
[show source]
|
63
63
|
</a>
|
64
|
-
<pre id='
|
64
|
+
<pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 81</span>
81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>
82: <span class="ruby-value str">"No commands defined"</span>
83: <span class="ruby-keyword kw">end</span></pre>
|
65
65
|
</div>
|
66
66
|
</div>
|
67
67
|
</div>
|
@@ -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>Class: Drydock::UnknownCommand [
|
4
|
+
<title>Class: Drydock::UnknownCommand [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'>
|
@@ -45,11 +45,11 @@
|
|
45
45
|
<h2>Methods</h2>
|
46
46
|
<h3>public class</h3>
|
47
47
|
<ol>
|
48
|
-
<li><a href="#
|
48
|
+
<li><a href="#M000021">new</a></li>
|
49
49
|
</ol>
|
50
50
|
<h3>public instance</h3>
|
51
51
|
<ol>
|
52
|
-
<li><a href="#
|
52
|
+
<li><a href="#M000022">message</a></li>
|
53
53
|
</ol>
|
54
54
|
</div>
|
55
55
|
<div id='section'>
|
@@ -67,31 +67,31 @@
|
|
67
67
|
</div>
|
68
68
|
<div id='methods'>
|
69
69
|
<h2>Public class methods</h2>
|
70
|
-
<div class='public-class method' id='method-
|
71
|
-
<a name='
|
70
|
+
<div class='public-class method' id='method-M000021'>
|
71
|
+
<a name='M000021'> </a>
|
72
72
|
<div class='synopsis'>
|
73
73
|
<span class='name'>new</span>
|
74
74
|
<span class='arguments'>(name)</span>
|
75
75
|
</div>
|
76
76
|
<div class='source'>
|
77
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
77
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
|
78
78
|
[show source]
|
79
79
|
</a>
|
80
|
-
<pre id='
|
80
|
+
<pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 73</span>
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)
74: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">:unknown</span>
75: <span class="ruby-keyword kw">end</span></pre>
|
81
81
|
</div>
|
82
82
|
</div>
|
83
83
|
<h2>Public instance methods</h2>
|
84
|
-
<div class='public-instance method' id='method-
|
85
|
-
<a name='
|
84
|
+
<div class='public-instance method' id='method-M000022'>
|
85
|
+
<a name='M000022'> </a>
|
86
86
|
<div class='synopsis'>
|
87
87
|
<span class='name'>message</span>
|
88
88
|
<span class='arguments'>()</span>
|
89
89
|
</div>
|
90
90
|
<div class='source'>
|
91
|
-
<a class='source-toggle' href='#' onclick="toggleCode('
|
91
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
|
92
92
|
[show source]
|
93
93
|
</a>
|
94
|
-
<pre id='
|
94
|
+
<pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 76</span>
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>
77: <span class="ruby-node">"Unknown command: #{@name}"</span>
78: <span class="ruby-keyword kw">end</span></pre>
|
95
95
|
</div>
|
96
96
|
</div>
|
97
97
|
</div>
|
data/doc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Sat, 14 Feb 2009 14:11:12 -0500
|
data/doc/files/CHANGES_txt.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>File: CHANGES.txt [
|
4
|
+
<title>File: CHANGES.txt [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'>
|
@@ -41,6 +41,29 @@
|
|
41
41
|
DRYDOCK, CHANGES
|
42
42
|
</p>
|
43
43
|
<p>
|
44
|
+
TODO:
|
45
|
+
</p>
|
46
|
+
<ul>
|
47
|
+
<li>Fix ’-’ ‘_’ ambiguity for option names
|
48
|
+
|
49
|
+
</li>
|
50
|
+
<li>Calls valid? method (if present) before calling command block.
|
51
|
+
|
52
|
+
</li>
|
53
|
+
</ul>
|
54
|
+
<p>
|
55
|
+
#### 0.3.3 (2009-02-14) ###############################
|
56
|
+
</p>
|
57
|
+
<ul>
|
58
|
+
<li>NEW: init method hook for subclasses of <a
|
59
|
+
href="../classes/Drydock/Command.html">Drydock::Command</a>
|
60
|
+
|
61
|
+
</li>
|
62
|
+
<li>UPDATED: Rdocs
|
63
|
+
|
64
|
+
</li>
|
65
|
+
</ul>
|
66
|
+
<p>
|
44
67
|
#### 0.3 (2009-02-05) ###############################
|
45
68
|
</p>
|
46
69
|
<ul>
|
data/doc/files/LICENSE_txt.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>File: LICENSE.txt [
|
4
|
+
<title>File: LICENSE.txt [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'>Fri Feb 06 13:02:40 -0500 2009</span>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<div id='content'>
|
data/doc/files/README_rdoc.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>File: README.rdoc [
|
4
|
+
<title>File: README.rdoc [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'>Fri Feb 06
|
34
|
+
<span class='datetime'>Fri Feb 06 13:05:47 -0500 2009</span>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<div id='content'>
|
@@ -75,12 +75,20 @@
|
|
75
75
|
<p>
|
76
76
|
See <a href="bin/example.html">bin/example</a> for more.
|
77
77
|
</p>
|
78
|
-
<pre>require 'drydock'

default :welcome

before do
# You can execute a block before the requests command is executed. Instance
# variables defined here will be available to all commands.
end

command :welcome do
# Example: ruby bin/example


|
78
|
+
<pre>require 'drydock'

default :welcome

before do
# You can execute a block before the requests command is executed. Instance
# variables defined here will be available to all commands.
end

command :welcome do
# Example: ruby bin/example

 puts "Welcome to Drydock. You have the following commands:"

 # The commands method returns a hash of Drydock::Command objects
 puts commands.keys.inject([]) { |list, command| list << command.to_s }.sort.join(', ')
end

usage "Example: #{$0} laugh [-f]"
option :f, :faster, "A boolean value. Go even faster!"
command :laugh do |obj|
# +obj+ is an instance of Drydock::Command. The options you define are available
# via accessors in this object.

 answer = !obj.faster ? "Sort of" : "Yes! I'm literally laughing as fast as possible."

 puts "Captain Stubing: Are you laughing?"
 puts "Dr. Bricker: " << answer
end

class JohnWestSmokedOysters < Drydock::Command; end;
# You can write your own command classes by inheriting from Drydock::Command
# and referencing it in the command definition.

command :oysters => JohnWestSmokedOysters do |obj|
 p obj # => #<JohnWestSmokedOysters:0x42179c ... >
end</pre>
|
79
79
|
<h2>More Information</h2>
|
80
|
-
<
|
81
|
-
<a
|
80
|
+
<ul>
|
81
|
+
<li><a href="http://github.com/delano/drydock">github.com/delano/drydock</a>
|
82
|
+
|
83
|
+
</li>
|
84
|
+
<li><a href="http://drydock.rubyforge.org/">drydock.rubyforge.org/</a> (rdocs)
|
85
|
+
|
86
|
+
</li>
|
87
|
+
<li><a
|
82
88
|
href="http://www.youtube.com/watch?v=m_wFEB4Oxlo">www.youtube.com/watch?v=m_wFEB4Oxlo</a>
|
83
|
-
|
89
|
+
|
90
|
+
</li>
|
91
|
+
</ul>
|
84
92
|
<h2>Credits</h2>
|
85
93
|
<ul>
|
86
94
|
<li>Delano Mandelbaum (delano@solutious.com)
|
data/doc/files/bin/example.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>File: example [
|
4
|
+
<title>File: example [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,17 +31,28 @@
|
|
31
31
|
</div>
|
32
32
|
<div class='last-update'>
|
33
33
|
Last Update:
|
34
|
-
<span class='datetime'>Fri Feb 06
|
34
|
+
<span class='datetime'>Fri Feb 06 13:02:43 -0500 2009</span>
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<div id='content'>
|
38
38
|
<div id='text'>
|
39
|
-
<div id='
|
40
|
-
<
|
41
|
-
<
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
<div id='description'>
|
40
|
+
<p>
|
41
|
+
Seafaring <a href="../../classes/Drydock.html">Drydock</a> Examples
|
42
|
+
</p>
|
43
|
+
<p>
|
44
|
+
This is a functioning script so you can copy it, run it, and just generally
|
45
|
+
be a longshoreman about things. This is a <a
|
46
|
+
href="../../classes/Drydock.html">Drydock</a> after all.
|
47
|
+
</p>
|
48
|
+
<p>
|
49
|
+
If you’re reading this via the Rdocs you won’t see the code.
|
50
|
+
Try:
|
51
|
+
</p>
|
52
|
+
<p>
|
53
|
+
<a
|
54
|
+
href="http://github.com/delano/drydock/blob/master/bin/example">github.com/delano/drydock/blob/master/bin/example</a>
|
55
|
+
</p>
|
45
56
|
</div>
|
46
57
|
<div id='context'>
|
47
58
|
<div id='requires'>
|
@@ -56,31 +67,6 @@
|
|
56
67
|
</div>
|
57
68
|
</div>
|
58
69
|
<div id='section'>
|
59
|
-
<div id='methods'>
|
60
|
-
<h2>Public instance methods</h2>
|
61
|
-
<div class='public-instance method' id='method-M000001'>
|
62
|
-
<a name='M000001'> </a>
|
63
|
-
<div class='synopsis'>
|
64
|
-
<span class='name'>response_code</span>
|
65
|
-
<span class='arguments'>(uri_str, duration=5)</span>
|
66
|
-
</div>
|
67
|
-
<div class='description'>
|
68
|
-
<p>
|
69
|
-
<a href="example.html#M000001">response_code</a>
|
70
|
-
</p>
|
71
|
-
<p>
|
72
|
-
return the HTTP response code for the given URI <tt>uri</tt> A valid HTTP
|
73
|
-
URI <tt>duration</tt> The timeout threshold (in seconds) for the request.
|
74
|
-
</p>
|
75
|
-
</div>
|
76
|
-
<div class='source'>
|
77
|
-
<a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
|
78
|
-
[show source]
|
79
|
-
</a>
|
80
|
-
<pre id='M000001-source'> <span class="ruby-comment cmt"># File bin/example, line 149</span>
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">response_code</span>(<span class="ruby-identifier">uri_str</span>, <span class="ruby-identifier">duration</span>=<span class="ruby-value">5</span>)
150: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">:unavailable</span>
151: <span class="ruby-keyword kw">begin</span> 
152: <span class="ruby-identifier">uri</span> = (<span class="ruby-identifier">uri_str</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">URI</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri_str</span> <span class="ruby-operator">:</span> <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">uri_str</span>) 
153: <span class="ruby-identifier">timeout</span>(<span class="ruby-identifier">duration</span>) <span class="ruby-keyword kw">do</span>
154: <span class="ruby-identifier">response</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get_response</span>(<span class="ruby-identifier">uri</span>).<span class="ruby-identifier">code</span>
155: <span class="ruby-keyword kw">end</span> 
156: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">ex</span>
157: <span class="ruby-keyword kw">end</span>
158: <span class="ruby-identifier">response</span>
159: <span class="ruby-keyword kw">end</span></pre>
|
81
|
-
</div>
|
82
|
-
</div>
|
83
|
-
</div>
|
84
70
|
</div>
|
85
71
|
</div>
|
86
72
|
</div>
|