drydock 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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="#M000027">new</a></li>
65
+ <li><a href="#M000026">new</a></li>
66
66
  </ol>
67
67
  <h3>public instance</h3>
68
68
  <ol>
69
- <li><a href="#M000028">call</a></li>
70
- <li><a href="#M000029">to_s</a></li>
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-M000027'>
94
- <a name='M000027'> </a>
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, &amp;b)</span>
98
98
  </div>
99
99
  <div class='description'>
100
100
  <p>
101
- <tt>cmd</tt> is the short name of this command. <tt>b</tt> is the block
102
- associated to this command.
101
+ The default constructor sets the short name of the command and stores a
102
+ reference to the block (if supplied). You don&#8217;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('M000027-source'); return false">
111
+ <a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
107
112
  [show source]
108
113
  </a>
109
- <pre id='M000027-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 29</span>&#x000A;29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">cmd</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;30: <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>&#x000A;31: <span class="ruby-ivar">@b</span> = <span class="ruby-identifier">b</span>&#x000A;32: <span class="ruby-keyword kw">end</span></pre>
114
+ <pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 35</span>&#x000A;35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">cmd</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;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>&#x000A;37: <span class="ruby-ivar">@b</span> = <span class="ruby-identifier">b</span>&#x000A;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-M000028'>
114
- <a name='M000028'> </a>
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('M000028-source'); return false">
143
+ <a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
136
144
  [show source]
137
145
  </a>
138
- <pre id='M000028-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 43</span>&#x000A;43: <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>={})&#x000A;44: <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>&#x000A;45: <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>&#x000A;46: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{n}=&quot;</span>, <span class="ruby-identifier">v</span>)&#x000A;47: <span class="ruby-keyword kw">end</span>&#x000A;48: <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>&#x000A;49: <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>&#x000A;50: <span class="ruby-keyword kw">end</span></pre>
146
+ <pre id='M000027-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 51</span>&#x000A;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>={})&#x000A;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>&#x000A;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>&#x000A;54: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{n}=&quot;</span>, <span class="ruby-identifier">v</span>)&#x000A;55: <span class="ruby-keyword kw">end</span>&#x000A;56: &#x000A;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>&#x000A;58: &#x000A;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>&#x000A;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>&#x000A;61: <span class="ruby-keyword kw">end</span></pre>
139
147
  </div>
140
148
  </div>
141
- <div class='public-instance method' id='method-M000029'>
142
- <a name='M000029'> </a>
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('M000029-source'); return false">
161
+ <a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
154
162
  [show source]
155
163
  </a>
156
- <pre id='M000029-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 53</span>&#x000A;53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>&#x000A;54: <span class="ruby-ivar">@cmd</span>.<span class="ruby-identifier">to_s</span>&#x000A;55: <span class="ruby-keyword kw">end</span></pre>
164
+ <pre id='M000028-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 64</span>&#x000A;64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>&#x000A;65: <span class="ruby-ivar">@cmd</span>.<span class="ruby-identifier">to_s</span>&#x000A;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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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="#M000024">new</a></li>
48
+ <li><a href="#M000023">new</a></li>
49
49
  </ol>
50
50
  <h3>public instance</h3>
51
51
  <ol>
52
- <li><a href="#M000025">message</a></li>
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-M000024'>
71
- <a name='M000024'> </a>
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('M000024-source'); return false">
77
+ <a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
78
78
  [show source]
79
79
  </a>
80
- <pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 76</span>&#x000A;76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)&#x000A;77: <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span> <span class="ruby-operator">||</span> []&#x000A;78: <span class="ruby-keyword kw">end</span></pre>
80
+ <pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 87</span>&#x000A;87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)&#x000A;88: <span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span> <span class="ruby-operator">||</span> []&#x000A;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-M000025'>
85
- <a name='M000025'> </a>
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('M000025-source'); return false">
91
+ <a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
92
92
  [show source]
93
93
  </a>
94
- <pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 79</span>&#x000A;79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;80: <span class="ruby-node">&quot;Unknown option: #{@args.join(&quot;, &quot;)}&quot;</span>&#x000A;81: <span class="ruby-keyword kw">end</span></pre>
94
+ <pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 90</span>&#x000A;90: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;91: <span class="ruby-node">&quot;Unknown option: #{@args.join(&quot;, &quot;)}&quot;</span>&#x000A;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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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="#M000030">message</a></li>
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-M000030'>
55
- <a name='M000030'> </a>
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('M000030-source'); return false">
61
+ <a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
62
62
  [show source]
63
63
  </a>
64
- <pre id='M000030-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 84</span>&#x000A;84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;85: <span class="ruby-node">&quot;Option requires a value: #{@args.join(&quot;, &quot;)}&quot;</span>&#x000A;86: <span class="ruby-keyword kw">end</span></pre>
64
+ <pre id='M000029-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 95</span>&#x000A;95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;96: <span class="ruby-node">&quot;Option requires a value: #{@args.join(&quot;, &quot;)}&quot;</span>&#x000A;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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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="#M000026">message</a></li>
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-M000026'>
55
- <a name='M000026'> </a>
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('M000026-source'); return false">
61
+ <a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
62
62
  [show source]
63
63
  </a>
64
- <pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 70</span>&#x000A;70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;71: <span class="ruby-value str">&quot;No commands defined&quot;</span>&#x000A;72: <span class="ruby-keyword kw">end</span></pre>
64
+ <pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 81</span>&#x000A;81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;82: <span class="ruby-value str">&quot;No commands defined&quot;</span>&#x000A;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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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="#M000022">new</a></li>
48
+ <li><a href="#M000021">new</a></li>
49
49
  </ol>
50
50
  <h3>public instance</h3>
51
51
  <ol>
52
- <li><a href="#M000023">message</a></li>
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-M000022'>
71
- <a name='M000022'> </a>
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('M000022-source'); return false">
77
+ <a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
78
78
  [show source]
79
79
  </a>
80
- <pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 62</span>&#x000A;62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)&#x000A;63: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">:unknown</span>&#x000A;64: <span class="ruby-keyword kw">end</span></pre>
80
+ <pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 73</span>&#x000A;73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>)&#x000A;74: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">:unknown</span>&#x000A;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-M000023'>
85
- <a name='M000023'> </a>
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('M000023-source'); return false">
91
+ <a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
92
92
  [show source]
93
93
  </a>
94
- <pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 65</span>&#x000A;65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;66: <span class="ruby-node">&quot;Unknown command: #{@name}&quot;</span>&#x000A;67: <span class="ruby-keyword kw">end</span></pre>
94
+ <pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 76</span>&#x000A;76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>&#x000A;77: <span class="ruby-node">&quot;Unknown command: #{@name}&quot;</span>&#x000A;78: <span class="ruby-keyword kw">end</span></pre>
95
95
  </div>
96
96
  </div>
97
97
  </div>
@@ -1 +1 @@
1
- Fri, 06 Feb 2009 10:28:08 -0500
1
+ Sat, 14 Feb 2009 14:11:12 -0500
@@ -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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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'>Thu Feb 05 13:19:37 -0500 2009</span>
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 &#8217;-&#8217; &#8216;_&#8217; 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>
@@ -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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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'>Thu Feb 05 13:19:38 -0500 2009</span>
34
+ <span class='datetime'>Fri Feb 06 13:02:40 -0500 2009</span>
35
35
  </div>
36
36
  </div>
37
37
  <div id='content'>
@@ -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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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 10:27:45 -0500 2009</span>
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'&#x000A;&#x000A;default :welcome&#x000A;&#x000A;before do&#x000A;# You can execute a block before the requests command is executed. Instance&#x000A;# variables defined here will be available to all commands.&#x000A;end&#x000A;&#x000A;command :welcome do&#x000A;# Example: ruby bin/example&#x000A;&#x000A; puts &quot;Welcome to Drydock. You have the following commands:&quot;&#x000A;&#x000A; # The commands method returns a hash of Drydock::Command objects&#x000A; puts commands.keys.inject([]) { |list, command| list &lt;&lt; command.to_s }.sort.join(', ')&#x000A;end&#x000A;&#x000A;usage &quot;Example: #{$0} findcar -f&quot;&#x000A;option :f, :faster, &quot;A boolean value. Go even faster!&quot;&#x000A;command :hurry do |obj|&#x000A;# +obj+ is an instance of Drydock::Command. The options you define are available&#x000A;# via accessors in this object.&#x000A;&#x000A; puts &quot;Are you hurrying?&quot;&#x000A; puts !obj.faster ? &quot;Sort of&quot; : &quot;Yes! I'm literally going as fast as possible&quot;&#x000A;end&#x000A;&#x000A;class JohnWestSmokedOysters &lt; Drydock::Command; end;&#x000A;# You can write your own command classes by inheriting from Drydock::Command&#x000A;# and referencing it in the command definition.&#x000A;&#x000A;command :oysters =&gt; JohnWestSmokedOysters do |obj|&#x000A; p obj # =&gt; #&lt;JohnWestSmokedOysters:0x42179c ... &gt;&#x000A;end</pre>
78
+ <pre>require 'drydock'&#x000A;&#x000A;default :welcome&#x000A;&#x000A;before do&#x000A;# You can execute a block before the requests command is executed. Instance&#x000A;# variables defined here will be available to all commands.&#x000A;end&#x000A;&#x000A;command :welcome do&#x000A;# Example: ruby bin/example&#x000A;&#x000A; puts &quot;Welcome to Drydock. You have the following commands:&quot;&#x000A;&#x000A; # The commands method returns a hash of Drydock::Command objects&#x000A; puts commands.keys.inject([]) { |list, command| list &lt;&lt; command.to_s }.sort.join(', ')&#x000A;end&#x000A;&#x000A;usage &quot;Example: #{$0} laugh [-f]&quot;&#x000A;option :f, :faster, &quot;A boolean value. Go even faster!&quot;&#x000A;command :laugh do |obj|&#x000A;# +obj+ is an instance of Drydock::Command. The options you define are available&#x000A;# via accessors in this object.&#x000A;&#x000A; answer = !obj.faster ? &quot;Sort of&quot; : &quot;Yes! I'm literally laughing as fast as possible.&quot;&#x000A;&#x000A; puts &quot;Captain Stubing: Are you laughing?&quot;&#x000A; puts &quot;Dr. Bricker: &quot; &lt;&lt; answer&#x000A;end&#x000A;&#x000A;class JohnWestSmokedOysters &lt; Drydock::Command; end;&#x000A;# You can write your own command classes by inheriting from Drydock::Command&#x000A;# and referencing it in the command definition.&#x000A;&#x000A;command :oysters =&gt; JohnWestSmokedOysters do |obj|&#x000A; p obj # =&gt; #&lt;JohnWestSmokedOysters:0x42179c ... &gt;&#x000A;end</pre>
79
79
  <h2>More Information</h2>
80
- <p>
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
- </p>
89
+
90
+ </li>
91
+ </ul>
84
92
  <h2>Credits</h2>
85
93
  <ul>
86
94
  <li>Delano Mandelbaum (delano@solutious.com)
@@ -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 [Drydock, A seaworthy DSL for command-line apps.]</title>
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 10:27:45 -0500 2009</span>
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='method-list'>
40
- <h2>Methods</h2>
41
- <h3>public instance</h3>
42
- <ol>
43
- <li><a href="#M000001">response_code</a></li>
44
- </ol>
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&#8217;re reading this via the Rdocs you won&#8217;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>&#x000A;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>)&#x000A;150: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">:unavailable</span>&#x000A;151: <span class="ruby-keyword kw">begin</span> &#x000A;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>) &#x000A;153: <span class="ruby-identifier">timeout</span>(<span class="ruby-identifier">duration</span>) <span class="ruby-keyword kw">do</span>&#x000A;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>&#x000A;155: <span class="ruby-keyword kw">end</span> &#x000A;156: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>&#x000A;157: <span class="ruby-keyword kw">end</span>&#x000A;158: <span class="ruby-identifier">response</span>&#x000A;159: <span class="ruby-keyword kw">end</span></pre>
81
- </div>
82
- </div>
83
- </div>
84
70
  </div>
85
71
  </div>
86
72
  </div>