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,5 +1,16 @@
1
1
  DRYDOCK, CHANGES
2
2
 
3
+ TODO:
4
+ * Fix '-' '_' ambiguity for option names
5
+ * Calls valid? method (if present) before calling command block.
6
+
7
+
8
+ #### 0.3.3 (2009-02-14) ###############################
9
+
10
+ * NEW: init method hook for subclasses of Drydock::Command
11
+ * UPDATED: Rdocs
12
+
13
+
3
14
  #### 0.3 (2009-02-05) ###############################
4
15
 
5
16
  * Added support for custom Drydock::Commands objects
@@ -10,6 +21,7 @@ DRYDOCK, CHANGES
10
21
  * Started adding tests
11
22
  * Improved documentation
12
23
 
24
+
13
25
  #### 0.2 (2008-12-27) ###############################
14
26
 
15
27
  * Initial release
@@ -22,45 +22,49 @@ Or for GitHub fans:
22
22
 
23
23
  See bin/example for more.
24
24
 
25
- require 'drydock'
26
-
27
- default :welcome
28
-
29
- before do
30
- # You can execute a block before the requests command is executed. Instance
31
- # variables defined here will be available to all commands.
32
- end
33
-
34
- command :welcome do
35
- # Example: ruby bin/example
36
-
37
- puts "Welcome to Drydock. You have the following commands:"
38
-
39
- # The commands method returns a hash of Drydock::Command objects
40
- puts commands.keys.inject([]) { |list, command| list << command.to_s }.sort.join(', ')
41
- end
42
-
43
- usage "Example: #{$0} findcar -f"
44
- option :f, :faster, "A boolean value. Go even faster!"
45
- command :hurry do |obj|
46
- # +obj+ is an instance of Drydock::Command. The options you define are available
47
- # via accessors in this object.
25
+ require 'drydock'
26
+
27
+ default :welcome
28
+
29
+ before do
30
+ # You can execute a block before the requests command is executed. Instance
31
+ # variables defined here will be available to all commands.
32
+ end
33
+
34
+ command :welcome do
35
+ # Example: ruby bin/example
36
+
37
+ puts "Welcome to Drydock. You have the following commands:"
38
+
39
+ # The commands method returns a hash of Drydock::Command objects
40
+ puts commands.keys.inject([]) { |list, command| list << command.to_s }.sort.join(', ')
41
+ end
48
42
 
49
- puts "Are you hurrying?"
50
- puts !obj.faster ? "Sort of" : "Yes! I'm literally going as fast as possible"
51
- end
43
+ usage "Example: #{$0} laugh [-f]"
44
+ option :f, :faster, "A boolean value. Go even faster!"
45
+ command :laugh do |obj|
46
+ # +obj+ is an instance of Drydock::Command. The options you define are available
47
+ # via accessors in this object.
48
+
49
+ answer = !obj.faster ? "Sort of" : "Yes! I'm literally laughing as fast as possible."
50
+
51
+ puts "Captain Stubing: Are you laughing?"
52
+ puts "Dr. Bricker: " << answer
53
+ end
54
+
55
+ class JohnWestSmokedOysters < Drydock::Command; end;
56
+ # You can write your own command classes by inheriting from Drydock::Command
57
+ # and referencing it in the command definition.
58
+
59
+ command :oysters => JohnWestSmokedOysters do |obj|
60
+ p obj # => #<JohnWestSmokedOysters:0x42179c ... >
61
+ end
52
62
 
53
- class JohnWestSmokedOysters < Drydock::Command; end;
54
- # You can write your own command classes by inheriting from Drydock::Command
55
- # and referencing it in the command definition.
56
-
57
- command :oysters => JohnWestSmokedOysters do |obj|
58
- p obj # => #<JohnWestSmokedOysters:0x42179c ... >
59
- end
60
-
61
63
  == More Information
62
64
 
63
- http://www.youtube.com/watch?v=m_wFEB4Oxlo
65
+ * http://github.com/delano/drydock
66
+ * http://drydock.rubyforge.org/ (rdocs)
67
+ * http://www.youtube.com/watch?v=m_wFEB4Oxlo
64
68
 
65
69
  == Credits
66
70
 
data/Rakefile CHANGED
@@ -11,7 +11,12 @@ task :default => :test
11
11
 
12
12
  desc 'Run specs with unit test style output'
13
13
  task :test do |t|
14
- sh "ruby tests/*_test.rb"
14
+ sh "ruby test/*_test.rb"
15
+ end
16
+
17
+ desc 'Run bin/example and tryouts'
18
+ task :tryouts do |t|
19
+ sh "ruby bin/example"
15
20
  end
16
21
 
17
22
  # PACKAGE =============================================================
@@ -40,20 +45,20 @@ end
40
45
 
41
46
  desc 'Publish website to rubyforge'
42
47
  task 'publish:doc' => 'doc/index.html' do
43
- sh 'scp -rp doc/* rubyforge.org:/var/www/gforge-projects/drydock/'
48
+ sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
44
49
  end
45
- puts "rubyforge add_release drydock drydock #{@spec.version} pkg/drydock-#{@spec.version}.gem "
50
+
46
51
  task 'publish:gem' => [:package] do |t|
47
52
  sh <<-end
48
- rubyforge add_release -o Any -a CHANGES.txt -f -n README.rdoc drydock drydock #{@spec.version} pkg/drydock-#{@spec.version}.gem &&
49
- rubyforge add_file -o Any -a CHANGES.txt -f -n README.rdoc drydock drydock #{@spec.version} pkg/drydock-#{@spec.version}.tgz
53
+ rubyforge add_release -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
54
+ rubyforge add_file -o Any -a CHANGES.txt -f -n README.rdoc #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
50
55
  end
51
56
  end
52
57
 
53
58
 
54
59
  Rake::RDocTask.new do |t|
55
60
  t.rdoc_dir = 'doc'
56
- t.title = "Drydock, A seaworthy DSL for command-line apps."
61
+ t.title = @spec.summary
57
62
  t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
58
63
  t.options << '--charset' << 'utf-8'
59
64
  t.rdoc_files.include('LICENSE.txt')
@@ -1,5 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Seafaring Drydock Examples
4
+ #
5
+ # This is a functioning script so you can copy it, run it,
6
+ # and just generally be a longshoreman about things. This is
7
+ # a Drydock after all.
8
+ #
9
+ # If you're reading this via the Rdocs you won't see the code. Try:
10
+ #
11
+ # http://github.com/delano/drydock/blob/master/bin/example
12
+
3
13
  $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..')), 'lib'
4
14
 
5
15
  require 'drydock'
@@ -17,29 +27,24 @@ end
17
27
 
18
28
  command :welcome do
19
29
  # Example: ruby bin/example
20
-
21
- puts "Meatwad: Science is a mystery to man, isn't it Frylock?"
22
- print "Frylock: At least we have some commands: "
30
+
31
+ puts "Welcome to Drydock. You have the following commands:"
23
32
 
24
33
  # The commands method returns a hash of Drydock::Command objects
25
34
  puts commands.keys.inject([]) { |list, command| list << command.to_s }.sort.join(', ')
26
35
  end
27
36
 
37
+ usage "Example: #{$0} laugh [-f]"
38
+ option :f, :faster, "A boolean value. Go even faster!"
39
+ command :laugh do |obj|
40
+ # +obj+ is an instance of Drydock::Command. The options you define are available
41
+ # via accessors in this object.
28
42
 
29
- option :f, :found, "A boolean value. Did you find the car?"
30
- command :findcar do |obj|
31
- # +obj+ is the Drylock::Command object instance. It contains accessors for all options.
32
- # Example: ruby bin/example -f findcar
33
-
34
- puts "Frylock: So, did they ever find your car?"
35
-
36
- # The keys to the hash are the long string from the option definition.
37
- # If only the short string is provided, those will be used instead (i.e. :f).
38
- puts (!obj.found) ? "Carl: No" :
39
- "Carl: Oh, they found part of it, hangin' from a trestle near the turnpike."
40
- end
41
-
43
+ answer = !obj.faster ? "Sort of" : "Yes! I'm literally laughing as fast as possible."
42
44
 
45
+ puts "Captain Stubing: Are you laughing?"
46
+ puts "Dr. Bricker: " << answer
47
+ end
43
48
 
44
49
  global_usage "USAGE: #{File.basename($0)} [global options] command [command options]"
45
50
  global_option :s, :seconds, "Display values in seconds"
@@ -146,7 +151,7 @@ end
146
151
  # return the HTTP response code for the given URI
147
152
  # +uri+ A valid HTTP URI
148
153
  # +duration+ The timeout threshold (in seconds) for the request.
149
- def response_code(uri_str, duration=5)
154
+ def response_code(uri_str, duration=5) #:nodoc:
150
155
  response = :unavailable
151
156
  begin
152
157
  uri = (uri_str.kind_of? URI::HTTP) ? uri_str : URI.parse(uri_str)
@@ -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>Module: Drydock [Drydock, A seaworthy DSL for command-line apps.]</title>
4
+ <title>Module: Drydock [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'>
@@ -47,26 +47,26 @@
47
47
  <h2>Methods</h2>
48
48
  <h3>public instance</h3>
49
49
  <ol>
50
- <li><a href="#M000007">after</a></li>
51
- <li><a href="#M000015">alias_command</a></li>
52
- <li><a href="#M000006">before</a></li>
53
- <li><a href="#M000014">command</a></li>
54
- <li><a href="#M000016">command_alias</a></li>
55
- <li><a href="#M000017">commands</a></li>
56
- <li><a href="#M000002">debug</a></li>
57
- <li><a href="#M000003">debug?</a></li>
58
- <li><a href="#M000004">default</a></li>
59
- <li><a href="#M000010">get_current_option_parser</a></li>
60
- <li><a href="#M000012">global_option</a></li>
61
- <li><a href="#M000008">global_usage</a></li>
62
- <li><a href="#M000020">has_run?</a></li>
63
- <li><a href="#M000011">ignore</a></li>
64
- <li><a href="#M000013">option</a></li>
65
- <li><a href="#M000021">run!</a></li>
66
- <li><a href="#M000019">run=</a></li>
67
- <li><a href="#M000018">run?</a></li>
68
- <li><a href="#M000005">stdin</a></li>
69
- <li><a href="#M000009">usage</a></li>
50
+ <li><a href="#M000006">after</a></li>
51
+ <li><a href="#M000014">alias_command</a></li>
52
+ <li><a href="#M000005">before</a></li>
53
+ <li><a href="#M000013">command</a></li>
54
+ <li><a href="#M000015">command_alias</a></li>
55
+ <li><a href="#M000016">commands</a></li>
56
+ <li><a href="#M000001">debug</a></li>
57
+ <li><a href="#M000002">debug?</a></li>
58
+ <li><a href="#M000003">default</a></li>
59
+ <li><a href="#M000009">get_current_option_parser</a></li>
60
+ <li><a href="#M000011">global_option</a></li>
61
+ <li><a href="#M000007">global_usage</a></li>
62
+ <li><a href="#M000019">has_run?</a></li>
63
+ <li><a href="#M000010">ignore</a></li>
64
+ <li><a href="#M000012">option</a></li>
65
+ <li><a href="#M000020">run!</a></li>
66
+ <li><a href="#M000018">run=</a></li>
67
+ <li><a href="#M000017">run?</a></li>
68
+ <li><a href="#M000004">stdin</a></li>
69
+ <li><a href="#M000008">usage</a></li>
70
70
  </ol>
71
71
  </div>
72
72
  <div id='section'>
@@ -92,8 +92,8 @@
92
92
  </div>
93
93
  <div id='methods'>
94
94
  <h2>Public instance methods</h2>
95
- <div class='public-instance method' id='method-M000007'>
96
- <a name='M000007'> </a>
95
+ <div class='public-instance method' id='method-M000006'>
96
+ <a name='M000006'> </a>
97
97
  <div class='synopsis'>
98
98
  <span class='name'>after</span>
99
99
  <span class='arguments'>(&amp;b)</span>
@@ -105,14 +105,14 @@
105
105
  </p>
106
106
  </div>
107
107
  <div class='source'>
108
- <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
108
+ <a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
109
109
  [show source]
110
110
  </a>
111
- <pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 166</span>&#x000A;166: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;167: <span class="ruby-ivar">@@after_block</span> = <span class="ruby-identifier">b</span>&#x000A;168: <span class="ruby-keyword kw">end</span></pre>
111
+ <pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 177</span>&#x000A;177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">after</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;178: <span class="ruby-ivar">@@after_block</span> = <span class="ruby-identifier">b</span>&#x000A;179: <span class="ruby-keyword kw">end</span></pre>
112
112
  </div>
113
113
  </div>
114
- <div class='public-instance method' id='method-M000015'>
115
- <a name='M000015'> </a>
114
+ <div class='public-instance method' id='method-M000014'>
115
+ <a name='M000014'> </a>
116
116
  <div class='synopsis'>
117
117
  <span class='name'>alias_command</span>
118
118
  <span class='arguments'>(aliaz, cmd)</span>
@@ -132,14 +132,14 @@
132
132
  </p>
133
133
  </div>
134
134
  <div class='source'>
135
- <a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
135
+ <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
136
136
  [show source]
137
137
  </a>
138
- <pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 275</span>&#x000A;275: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alias_command</span>(<span class="ruby-identifier">aliaz</span>, <span class="ruby-identifier">cmd</span>)&#x000A;276: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">commands</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">cmd</span>&#x000A;277: <span class="ruby-ivar">@@commands</span>[<span class="ruby-identifier">aliaz</span>] = <span class="ruby-identifier">commands</span>[<span class="ruby-identifier">cmd</span>]&#x000A;278: <span class="ruby-keyword kw">end</span></pre>
138
+ <pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 286</span>&#x000A;286: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alias_command</span>(<span class="ruby-identifier">aliaz</span>, <span class="ruby-identifier">cmd</span>)&#x000A;287: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">commands</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">cmd</span>&#x000A;288: <span class="ruby-ivar">@@commands</span>[<span class="ruby-identifier">aliaz</span>] = <span class="ruby-identifier">commands</span>[<span class="ruby-identifier">cmd</span>]&#x000A;289: <span class="ruby-keyword kw">end</span></pre>
139
139
  </div>
140
140
  </div>
141
- <div class='public-instance method' id='method-M000006'>
142
- <a name='M000006'> </a>
141
+ <div class='public-instance method' id='method-M000005'>
142
+ <a name='M000005'> </a>
143
143
  <div class='synopsis'>
144
144
  <span class='name'>before</span>
145
145
  <span class='arguments'>(&amp;b)</span>
@@ -151,14 +151,14 @@
151
151
  </p>
152
152
  </div>
153
153
  <div class='source'>
154
- <a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
154
+ <a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
155
155
  [show source]
156
156
  </a>
157
- <pre id='M000006-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 160</span>&#x000A;160: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;161: <span class="ruby-ivar">@@before_block</span> = <span class="ruby-identifier">b</span>&#x000A;162: <span class="ruby-keyword kw">end</span></pre>
157
+ <pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 171</span>&#x000A;171: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;172: <span class="ruby-ivar">@@before_block</span> = <span class="ruby-identifier">b</span>&#x000A;173: <span class="ruby-keyword kw">end</span></pre>
158
158
  </div>
159
159
  </div>
160
- <div class='public-instance method' id='method-M000014'>
161
- <a name='M000014'> </a>
160
+ <div class='public-instance method' id='method-M000013'>
161
+ <a name='M000013'> </a>
162
162
  <div class='synopsis'>
163
163
  <span class='name'>command</span>
164
164
  <span class='arguments'>(*cmds, &amp;b)</span>
@@ -176,26 +176,26 @@
176
176
  <pre>command :task =&gt; CustomCommand do&#x000A; ...&#x000A;end</pre>
177
177
  </div>
178
178
  <div class='source'>
179
- <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
179
+ <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
180
180
  [show source]
181
181
  </a>
182
- <pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 245</span>&#x000A;245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">command</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">cmds</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;246: <span class="ruby-ivar">@@command_index</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>&#x000A;247: <span class="ruby-ivar">@@command_opts_parser</span> <span class="ruby-operator">||=</span> []&#x000A;248: <span class="ruby-ivar">@@command_option_names</span> <span class="ruby-operator">||=</span> []&#x000A;249: <span class="ruby-identifier">cmds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cmd</span><span class="ruby-operator">|</span> &#x000A;250: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>&#x000A;251: <span class="ruby-identifier">c</span> = <span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">first</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;252: <span class="ruby-keyword kw">else</span>&#x000A;253: <span class="ruby-identifier">c</span> = <span class="ruby-constant">Drydock</span><span class="ruby-operator">::</span><span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;254: <span class="ruby-keyword kw">end</span>&#x000A;255: <span class="ruby-identifier">commands</span>[<span class="ruby-identifier">c</span>.<span class="ruby-identifier">cmd</span>] = <span class="ruby-identifier">c</span>&#x000A;256: <span class="ruby-identifier">command_index_map</span>[<span class="ruby-identifier">c</span>.<span class="ruby-identifier">cmd</span>] = <span class="ruby-ivar">@@command_index</span>&#x000A;257: <span class="ruby-ivar">@@command_index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>&#x000A;258: <span class="ruby-keyword kw">end</span>&#x000A;259: &#x000A;260: <span class="ruby-keyword kw">end</span></pre>
182
+ <pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 256</span>&#x000A;256: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">command</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">cmds</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;257: <span class="ruby-ivar">@@command_index</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>&#x000A;258: <span class="ruby-ivar">@@command_opts_parser</span> <span class="ruby-operator">||=</span> []&#x000A;259: <span class="ruby-ivar">@@command_option_names</span> <span class="ruby-operator">||=</span> []&#x000A;260: <span class="ruby-identifier">cmds</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cmd</span><span class="ruby-operator">|</span> &#x000A;261: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Hash</span>&#x000A;262: <span class="ruby-identifier">c</span> = <span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">first</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;263: <span class="ruby-keyword kw">else</span>&#x000A;264: <span class="ruby-identifier">c</span> = <span class="ruby-constant">Drydock</span><span class="ruby-operator">::</span><span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;265: <span class="ruby-keyword kw">end</span>&#x000A;266: <span class="ruby-identifier">commands</span>[<span class="ruby-identifier">c</span>.<span class="ruby-identifier">cmd</span>] = <span class="ruby-identifier">c</span>&#x000A;267: <span class="ruby-identifier">command_index_map</span>[<span class="ruby-identifier">c</span>.<span class="ruby-identifier">cmd</span>] = <span class="ruby-ivar">@@command_index</span>&#x000A;268: <span class="ruby-ivar">@@command_index</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>&#x000A;269: <span class="ruby-keyword kw">end</span>&#x000A;270: &#x000A;271: <span class="ruby-keyword kw">end</span></pre>
183
183
  </div>
184
184
  </div>
185
- <div class='public-instance method' id='method-M000016'>
186
- <a name='M000016'> </a>
185
+ <div class='public-instance method' id='method-M000015'>
186
+ <a name='M000015'> </a>
187
187
  <div class='synopsis'>
188
188
  <span class='name'>command_alias</span>
189
189
  <span class='arguments'>(aliaz, cmd)</span>
190
190
  </div>
191
191
  <div class='description'>
192
192
  <p>
193
- Alias for <a href="Drydock.html#M000015">alias_command</a>
193
+ Alias for <a href="Drydock.html#M000014">alias_command</a>
194
194
  </p>
195
195
  </div>
196
196
  </div>
197
- <div class='public-instance method' id='method-M000017'>
198
- <a name='M000017'> </a>
197
+ <div class='public-instance method' id='method-M000016'>
198
+ <a name='M000016'> </a>
199
199
  <div class='synopsis'>
200
200
  <span class='name'>commands</span>
201
201
  <span class='arguments'>()</span>
@@ -207,14 +207,14 @@
207
207
  </p>
208
208
  </div>
209
209
  <div class='source'>
210
- <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
210
+ <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
211
211
  [show source]
212
212
  </a>
213
- <pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 282</span>&#x000A;282: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commands</span>&#x000A;283: <span class="ruby-ivar">@@commands</span> <span class="ruby-operator">||=</span> {}&#x000A;284: <span class="ruby-keyword kw">end</span></pre>
213
+ <pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 293</span>&#x000A;293: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commands</span>&#x000A;294: <span class="ruby-ivar">@@commands</span> <span class="ruby-operator">||=</span> {}&#x000A;295: <span class="ruby-keyword kw">end</span></pre>
214
214
  </div>
215
215
  </div>
216
- <div class='public-instance method' id='method-M000002'>
217
- <a name='M000002'> </a>
216
+ <div class='public-instance method' id='method-M000001'>
217
+ <a name='M000001'> </a>
218
218
  <div class='synopsis'>
219
219
  <span class='name'>debug</span>
220
220
  <span class='arguments'>(toggle=false)</span>
@@ -229,14 +229,14 @@
229
229
  </p>
230
230
  </div>
231
231
  <div class='source'>
232
- <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
232
+ <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
233
233
  [show source]
234
234
  </a>
235
- <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 127</span>&#x000A;127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug</span>(<span class="ruby-identifier">toggle</span>=<span class="ruby-keyword kw">false</span>)&#x000A;128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Symbol</span>&#x000A;129: <span class="ruby-ivar">@@debug</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:on</span>&#x000A;130: <span class="ruby-ivar">@@debug</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:off</span>&#x000A;131: <span class="ruby-keyword kw">else</span>&#x000A;132: <span class="ruby-ivar">@@debug</span> = (<span class="ruby-operator">!</span><span class="ruby-ivar">@@debug</span>)&#x000A;133: <span class="ruby-keyword kw">end</span>&#x000A;134: <span class="ruby-keyword kw">end</span></pre>
235
+ <pre id='M000001-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 138</span>&#x000A;138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug</span>(<span class="ruby-identifier">toggle</span>=<span class="ruby-keyword kw">false</span>)&#x000A;139: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Symbol</span>&#x000A;140: <span class="ruby-ivar">@@debug</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:on</span>&#x000A;141: <span class="ruby-ivar">@@debug</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:off</span>&#x000A;142: <span class="ruby-keyword kw">else</span>&#x000A;143: <span class="ruby-ivar">@@debug</span> = (<span class="ruby-operator">!</span><span class="ruby-ivar">@@debug</span>)&#x000A;144: <span class="ruby-keyword kw">end</span>&#x000A;145: <span class="ruby-keyword kw">end</span></pre>
236
236
  </div>
237
237
  </div>
238
- <div class='public-instance method' id='method-M000003'>
239
- <a name='M000003'> </a>
238
+ <div class='public-instance method' id='method-M000002'>
239
+ <a name='M000002'> </a>
240
240
  <div class='synopsis'>
241
241
  <span class='name'>debug?</span>
242
242
  <span class='arguments'>()</span>
@@ -247,14 +247,14 @@
247
247
  </p>
248
248
  </div>
249
249
  <div class='source'>
250
- <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
250
+ <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
251
251
  [show source]
252
252
  </a>
253
- <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 136</span>&#x000A;136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug?</span>&#x000A;137: <span class="ruby-ivar">@@debug</span>&#x000A;138: <span class="ruby-keyword kw">end</span></pre>
253
+ <pre id='M000002-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 147</span>&#x000A;147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug?</span>&#x000A;148: <span class="ruby-ivar">@@debug</span>&#x000A;149: <span class="ruby-keyword kw">end</span></pre>
254
254
  </div>
255
255
  </div>
256
- <div class='public-instance method' id='method-M000004'>
257
- <a name='M000004'> </a>
256
+ <div class='public-instance method' id='method-M000003'>
257
+ <a name='M000003'> </a>
258
258
  <div class='synopsis'>
259
259
  <span class='name'>default</span>
260
260
  <span class='arguments'>(cmd)</span>
@@ -266,14 +266,14 @@
266
266
  <pre>default :task</pre>
267
267
  </div>
268
268
  <div class='source'>
269
- <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
269
+ <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
270
270
  [show source]
271
271
  </a>
272
- <pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 144</span>&#x000A;144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">cmd</span>)&#x000A;145: <span class="ruby-ivar">@@default_command</span> = <span class="ruby-identifier">canonize</span>(<span class="ruby-identifier">cmd</span>)&#x000A;146: <span class="ruby-keyword kw">end</span></pre>
272
+ <pre id='M000003-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 155</span>&#x000A;155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">default</span>(<span class="ruby-identifier">cmd</span>)&#x000A;156: <span class="ruby-ivar">@@default_command</span> = <span class="ruby-identifier">canonize</span>(<span class="ruby-identifier">cmd</span>)&#x000A;157: <span class="ruby-keyword kw">end</span></pre>
273
273
  </div>
274
274
  </div>
275
- <div class='public-instance method' id='method-M000010'>
276
- <a name='M000010'> </a>
275
+ <div class='public-instance method' id='method-M000009'>
276
+ <a name='M000009'> </a>
277
277
  <div class='synopsis'>
278
278
  <span class='name'>get_current_option_parser</span>
279
279
  <span class='arguments'>()</span>
@@ -285,14 +285,14 @@
285
285
  </p>
286
286
  </div>
287
287
  <div class='source'>
288
- <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
288
+ <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
289
289
  [show source]
290
290
  </a>
291
- <pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 184</span>&#x000A;184: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_current_option_parser</span>&#x000A;185: <span class="ruby-ivar">@@command_opts_parser</span> <span class="ruby-operator">||=</span> []&#x000A;186: <span class="ruby-ivar">@@command_index</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>&#x000A;187: (<span class="ruby-ivar">@@command_opts_parser</span>[<span class="ruby-ivar">@@command_index</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span>)&#x000A;188: <span class="ruby-keyword kw">end</span></pre>
291
+ <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 195</span>&#x000A;195: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_current_option_parser</span>&#x000A;196: <span class="ruby-ivar">@@command_opts_parser</span> <span class="ruby-operator">||=</span> []&#x000A;197: <span class="ruby-ivar">@@command_index</span> <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>&#x000A;198: (<span class="ruby-ivar">@@command_opts_parser</span>[<span class="ruby-ivar">@@command_index</span>] <span class="ruby-operator">||=</span> <span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span>)&#x000A;199: <span class="ruby-keyword kw">end</span></pre>
292
292
  </div>
293
293
  </div>
294
- <div class='public-instance method' id='method-M000012'>
295
- <a name='M000012'> </a>
294
+ <div class='public-instance method' id='method-M000011'>
295
+ <a name='M000011'> </a>
296
296
  <div class='synopsis'>
297
297
  <span class='name'>global_option</span>
298
298
  <span class='arguments'>(*args, &amp;b)</span>
@@ -303,14 +303,14 @@
303
303
  </p>
304
304
  </div>
305
305
  <div class='source'>
306
- <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
306
+ <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
307
307
  [show source]
308
308
  </a>
309
- <pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 203</span>&#x000A;203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">global_option</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;204: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">global_opts_parser</span>)&#x000A;205: <span class="ruby-identifier">global_option_names</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">option_parser</span>(<span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;206: <span class="ruby-keyword kw">end</span></pre>
309
+ <pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 214</span>&#x000A;214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">global_option</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;215: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">global_opts_parser</span>)&#x000A;216: <span class="ruby-identifier">global_option_names</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">option_parser</span>(<span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;217: <span class="ruby-keyword kw">end</span></pre>
310
310
  </div>
311
311
  </div>
312
- <div class='public-instance method' id='method-M000008'>
313
- <a name='M000008'> </a>
312
+ <div class='public-instance method' id='method-M000007'>
313
+ <a name='M000007'> </a>
314
314
  <div class='synopsis'>
315
315
  <span class='name'>global_usage</span>
316
316
  <span class='arguments'>(msg)</span>
@@ -322,14 +322,14 @@
322
322
  </p>
323
323
  </div>
324
324
  <div class='source'>
325
- <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
325
+ <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
326
326
  [show source]
327
327
  </a>
328
- <pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 172</span>&#x000A;172: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">global_usage</span>(<span class="ruby-identifier">msg</span>)&#x000A;173: <span class="ruby-ivar">@@global_options</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>&#x000A;174: <span class="ruby-identifier">global_opts_parser</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-node">&quot;USAGE: #{msg}&quot;</span>&#x000A;175: <span class="ruby-keyword kw">end</span></pre>
328
+ <pre id='M000007-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 183</span>&#x000A;183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">global_usage</span>(<span class="ruby-identifier">msg</span>)&#x000A;184: <span class="ruby-ivar">@@global_options</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span>&#x000A;185: <span class="ruby-identifier">global_opts_parser</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-node">&quot;USAGE: #{msg}&quot;</span>&#x000A;186: <span class="ruby-keyword kw">end</span></pre>
329
329
  </div>
330
330
  </div>
331
- <div class='public-instance method' id='method-M000020'>
332
- <a name='M000020'> </a>
331
+ <div class='public-instance method' id='method-M000019'>
332
+ <a name='M000019'> </a>
333
333
  <div class='synopsis'>
334
334
  <span class='name'>has_run?</span>
335
335
  <span class='arguments'>()</span>
@@ -340,14 +340,14 @@
340
340
  </p>
341
341
  </div>
342
342
  <div class='source'>
343
- <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
343
+ <a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
344
344
  [show source]
345
345
  </a>
346
- <pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 299</span>&#x000A;299: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_run?</span>&#x000A;300: <span class="ruby-ivar">@@has_run</span>&#x000A;301: <span class="ruby-keyword kw">end</span></pre>
346
+ <pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 310</span>&#x000A;310: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_run?</span>&#x000A;311: <span class="ruby-ivar">@@has_run</span>&#x000A;312: <span class="ruby-keyword kw">end</span></pre>
347
347
  </div>
348
348
  </div>
349
- <div class='public-instance method' id='method-M000011'>
350
- <a name='M000011'> </a>
349
+ <div class='public-instance method' id='method-M000010'>
350
+ <a name='M000010'> </a>
351
351
  <div class='synopsis'>
352
352
  <span class='name'>ignore</span>
353
353
  <span class='arguments'>(what=:nothing)</span>
@@ -368,14 +368,14 @@
368
368
  </p>
369
369
  </div>
370
370
  <div class='source'>
371
- <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
371
+ <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
372
372
  [show source]
373
373
  </a>
374
- <pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 198</span>&#x000A;198: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ignore</span>(<span class="ruby-identifier">what</span>=<span class="ruby-identifier">:nothing</span>)&#x000A;199: <span class="ruby-ivar">@@command_opts_parser</span>[<span class="ruby-ivar">@@command_index</span>] = <span class="ruby-identifier">:ignore</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:options</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">what</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:all</span>&#x000A;200: <span class="ruby-keyword kw">end</span></pre>
374
+ <pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 209</span>&#x000A;209: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ignore</span>(<span class="ruby-identifier">what</span>=<span class="ruby-identifier">:nothing</span>)&#x000A;210: <span class="ruby-ivar">@@command_opts_parser</span>[<span class="ruby-ivar">@@command_index</span>] = <span class="ruby-identifier">:ignore</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">what</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:options</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">what</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:all</span>&#x000A;211: <span class="ruby-keyword kw">end</span></pre>
375
375
  </div>
376
376
  </div>
377
- <div class='public-instance method' id='method-M000013'>
378
- <a name='M000013'> </a>
377
+ <div class='public-instance method' id='method-M000012'>
378
+ <a name='M000012'> </a>
379
379
  <div class='synopsis'>
380
380
  <span class='name'>option</span>
381
381
  <span class='arguments'>(*args, &amp;b)</span>
@@ -403,14 +403,14 @@
403
403
  </p>
404
404
  </div>
405
405
  <div class='source'>
406
- <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
406
+ <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
407
407
  [show source]
408
408
  </a>
409
- <pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 227</span>&#x000A;227: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">option</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;228: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">get_current_option_parser</span>)&#x000A;229: <span class="ruby-identifier">current_command_option_names</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">option_parser</span>(<span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;230: <span class="ruby-keyword kw">end</span></pre>
409
+ <pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 238</span>&#x000A;238: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">option</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;239: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">get_current_option_parser</span>)&#x000A;240: <span class="ruby-identifier">current_command_option_names</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">option_parser</span>(<span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;241: <span class="ruby-keyword kw">end</span></pre>
410
410
  </div>
411
411
  </div>
412
- <div class='public-instance method' id='method-M000021'>
413
- <a name='M000021'> </a>
412
+ <div class='public-instance method' id='method-M000020'>
413
+ <a name='M000020'> </a>
414
414
  <div class='synopsis'>
415
415
  <span class='name'>run!</span>
416
416
  <span class='arguments'>(argv=[], stdin=STDIN)</span>
@@ -420,19 +420,19 @@
420
420
  Execute the given command. By default, <a href="Drydock.html">Drydock</a>
421
421
  automatically executes itself and provides handlers for known errors. You
422
422
  can override this functionality by calling <tt><a
423
- href="Drydock.html#M000021">Drydock.run!</a></tt> yourself. <a
423
+ href="Drydock.html#M000020">Drydock.run!</a></tt> yourself. <a
424
424
  href="Drydock.html">Drydock</a> will only call <tt>run!</tt> once.
425
425
  </p>
426
426
  </div>
427
427
  <div class='source'>
428
- <a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
428
+ <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
429
429
  [show source]
430
430
  </a>
431
- <pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 307</span>&#x000A;307: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run!</span>(<span class="ruby-identifier">argv</span>=[], <span class="ruby-identifier">stdin</span>=<span class="ruby-constant">STDIN</span>)&#x000A;308: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">has_run?</span>&#x000A;309: <span class="ruby-ivar">@@has_run</span> = <span class="ruby-keyword kw">true</span>&#x000A;310: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoCommandsDefined</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">commands</span>.<span class="ruby-identifier">empty?</span>&#x000A;311: <span class="ruby-ivar">@@global_options</span>, <span class="ruby-identifier">cmd_name</span>, <span class="ruby-ivar">@@command_options</span>, <span class="ruby-identifier">argv</span> = <span class="ruby-identifier">process_arguments</span>(<span class="ruby-identifier">argv</span>)&#x000A;312: &#x000A;313: <span class="ruby-identifier">cmd_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">default_command</span>&#x000A;314: &#x000A;315: <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnknownCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd_name</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">command?</span>(<span class="ruby-identifier">cmd_name</span>)&#x000A;316: &#x000A;317: <span class="ruby-identifier">stdin</span> = (<span class="ruby-keyword kw">defined?</span> <span class="ruby-ivar">@@stdin_block</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@@stdin_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">stdin</span>, []) <span class="ruby-operator">:</span> <span class="ruby-identifier">stdin</span>&#x000A;318: <span class="ruby-ivar">@@before_block</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span> <span class="ruby-ivar">@@before_block</span>&#x000A;319: &#x000A;320: <span class="ruby-identifier">call_command</span>(<span class="ruby-identifier">cmd_name</span>, <span class="ruby-identifier">argv</span>, <span class="ruby-identifier">stdin</span>)&#x000A;321: &#x000A;322: <span class="ruby-ivar">@@after_block</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span> <span class="ruby-ivar">@@after_block</span>&#x000A;323: &#x000A;324: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>&#x000A;325: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Drydock</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidArgument</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">args</span>)&#x000A;326: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingArgument</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>&#x000A;327: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Drydock</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingArgument</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">args</span>)&#x000A;328: <span class="ruby-keyword kw">end</span></pre>
431
+ <pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 318</span>&#x000A;318: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run!</span>(<span class="ruby-identifier">argv</span>=[], <span class="ruby-identifier">stdin</span>=<span class="ruby-constant">STDIN</span>)&#x000A;319: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">has_run?</span>&#x000A;320: <span class="ruby-ivar">@@has_run</span> = <span class="ruby-keyword kw">true</span>&#x000A;321: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoCommandsDefined</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">commands</span>.<span class="ruby-identifier">empty?</span>&#x000A;322: <span class="ruby-ivar">@@global_options</span>, <span class="ruby-identifier">cmd_name</span>, <span class="ruby-ivar">@@command_options</span>, <span class="ruby-identifier">argv</span> = <span class="ruby-identifier">process_arguments</span>(<span class="ruby-identifier">argv</span>)&#x000A;323: &#x000A;324: <span class="ruby-identifier">cmd_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">default_command</span>&#x000A;325: &#x000A;326: <span class="ruby-identifier">raise</span> <span class="ruby-constant">UnknownCommand</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd_name</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">command?</span>(<span class="ruby-identifier">cmd_name</span>)&#x000A;327: &#x000A;328: <span class="ruby-identifier">stdin</span> = (<span class="ruby-keyword kw">defined?</span> <span class="ruby-ivar">@@stdin_block</span>) <span class="ruby-operator">?</span> <span class="ruby-ivar">@@stdin_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">stdin</span>, []) <span class="ruby-operator">:</span> <span class="ruby-identifier">stdin</span>&#x000A;329: <span class="ruby-ivar">@@before_block</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span> <span class="ruby-ivar">@@before_block</span>&#x000A;330: &#x000A;331: <span class="ruby-identifier">call_command</span>(<span class="ruby-identifier">cmd_name</span>, <span class="ruby-identifier">argv</span>, <span class="ruby-identifier">stdin</span>)&#x000A;332: &#x000A;333: <span class="ruby-ivar">@@after_block</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span> <span class="ruby-ivar">@@after_block</span>&#x000A;334: &#x000A;335: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidOption</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>&#x000A;336: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Drydock</span><span class="ruby-operator">::</span><span class="ruby-constant">InvalidArgument</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">args</span>)&#x000A;337: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">OptionParser</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingArgument</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>&#x000A;338: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Drydock</span><span class="ruby-operator">::</span><span class="ruby-constant">MissingArgument</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">ex</span>.<span class="ruby-identifier">args</span>)&#x000A;339: <span class="ruby-keyword kw">end</span></pre>
432
432
  </div>
433
433
  </div>
434
- <div class='public-instance method' id='method-M000019'>
435
- <a name='M000019'> </a>
434
+ <div class='public-instance method' id='method-M000018'>
435
+ <a name='M000018'> </a>
436
436
  <div class='synopsis'>
437
437
  <span class='name'>run=</span>
438
438
  <span class='arguments'>(v)</span>
@@ -444,14 +444,14 @@
444
444
  <pre>Drydock.run = false</pre>
445
445
  </div>
446
446
  <div class='source'>
447
- <a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
447
+ <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
448
448
  [show source]
449
449
  </a>
450
- <pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 294</span>&#x000A;294: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run=</span>(<span class="ruby-identifier">v</span>)&#x000A;295: <span class="ruby-ivar">@@run</span> = (<span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span> &#x000A;296: <span class="ruby-keyword kw">end</span></pre>
450
+ <pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 305</span>&#x000A;305: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run=</span>(<span class="ruby-identifier">v</span>)&#x000A;306: <span class="ruby-ivar">@@run</span> = (<span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>) <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span> &#x000A;307: <span class="ruby-keyword kw">end</span></pre>
451
451
  </div>
452
452
  </div>
453
- <div class='public-instance method' id='method-M000018'>
454
- <a name='M000018'> </a>
453
+ <div class='public-instance method' id='method-M000017'>
454
+ <a name='M000017'> </a>
455
455
  <div class='synopsis'>
456
456
  <span class='name'>run?</span>
457
457
  <span class='arguments'>()</span>
@@ -462,14 +462,14 @@
462
462
  </p>
463
463
  </div>
464
464
  <div class='source'>
465
- <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
465
+ <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
466
466
  [show source]
467
467
  </a>
468
- <pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 287</span>&#x000A;287: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run?</span>&#x000A;288: <span class="ruby-ivar">@@run</span>&#x000A;289: <span class="ruby-keyword kw">end</span></pre>
468
+ <pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 298</span>&#x000A;298: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run?</span>&#x000A;299: <span class="ruby-ivar">@@run</span>&#x000A;300: <span class="ruby-keyword kw">end</span></pre>
469
469
  </div>
470
470
  </div>
471
- <div class='public-instance method' id='method-M000005'>
472
- <a name='M000005'> </a>
471
+ <div class='public-instance method' id='method-M000004'>
472
+ <a name='M000004'> </a>
473
473
  <div class='synopsis'>
474
474
  <span class='name'>stdin</span>
475
475
  <span class='arguments'>(&amp;b)</span>
@@ -486,14 +486,14 @@
486
486
  </p>
487
487
  </div>
488
488
  <div class='source'>
489
- <a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
489
+ <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
490
490
  [show source]
491
491
  </a>
492
- <pre id='M000005-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 154</span>&#x000A;154: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdin</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;155: <span class="ruby-ivar">@@stdin_block</span> = <span class="ruby-identifier">b</span>&#x000A;156: <span class="ruby-keyword kw">end</span></pre>
492
+ <pre id='M000004-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 165</span>&#x000A;165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stdin</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)&#x000A;166: <span class="ruby-ivar">@@stdin_block</span> = <span class="ruby-identifier">b</span>&#x000A;167: <span class="ruby-keyword kw">end</span></pre>
493
493
  </div>
494
494
  </div>
495
- <div class='public-instance method' id='method-M000009'>
496
- <a name='M000009'> </a>
495
+ <div class='public-instance method' id='method-M000008'>
496
+ <a name='M000008'> </a>
497
497
  <div class='synopsis'>
498
498
  <span class='name'>usage</span>
499
499
  <span class='arguments'>(msg)</span>
@@ -505,10 +505,10 @@
505
505
  </p>
506
506
  </div>
507
507
  <div class='source'>
508
- <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
508
+ <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
509
509
  [show source]
510
510
  </a>
511
- <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 179</span>&#x000A;179: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">usage</span>(<span class="ruby-identifier">msg</span>)&#x000A;180: <span class="ruby-identifier">get_current_option_parser</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-node">&quot;USAGE: #{msg}&quot;</span>&#x000A;181: <span class="ruby-keyword kw">end</span></pre>
511
+ <pre id='M000008-source'> <span class="ruby-comment cmt"># File lib/drydock.rb, line 190</span>&#x000A;190: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">usage</span>(<span class="ruby-identifier">msg</span>)&#x000A;191: <span class="ruby-identifier">get_current_option_parser</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-node">&quot;USAGE: #{msg}&quot;</span>&#x000A;192: <span class="ruby-keyword kw">end</span></pre>
512
512
  </div>
513
513
  </div>
514
514
  </div>