doc/Tutorial in bahuvrihi-tap-0.11.2 vs doc/Tutorial in bahuvrihi-tap-0.12.0
- old
+ new
@@ -96,21 +96,19 @@
end
end
Simple enough; the name corresponds to the class, configurations (and dependencies, although they aren't show) are written out individually, and the block corresponds to process. There are a few differences, especially relating to process, but for the moment lets gloss over them and see how Goodnight works.
- Goodnight.configurations.to_hash # => {:message => 'goodnight'}
-
goodnight = Goodnight.new
goodnight.message # => 'goodnight'
goodnight.process('moon') # => 'goodnight moon'
hello = Goodnight.new(:message => 'hello')
hello.message # => 'hello'
hello.process('world') # => 'hello world'
-Totally straightforward. Goodnight stores the default configurations, each instance has accessors to the configurations, and the defaults may be overridden during initialization, or later. Class definitions allow validation/transformation blocks to be specified for configurations. These blocks process inputs (ex the string inputs from the command line), quite literally defining the writer for a configuration accessor. A set of standard blocks are available through +c+, an alias for the Tap::Support::Validation module.
+Totally straightforward. Goodnight stores the default configurations, each instance has accessors to the configurations, and the defaults may be overridden during initialization, or later. Class definitions allow validation/transformation blocks to be specified for configurations. These blocks process inputs (ex the string inputs from the command line), quite literally defining the writer for a configuration accessor. A set of standard blocks are available through +c+, an alias for the {Configurable::Validation}[http://tap.rubyforge.org/configurable/classes/Configurable/Validation.html] module.
[lib/goodnight.rb]
# Goodnight::manifest a fancy goodnight moon task
# Says goodnight with a configurable message.
@@ -164,13 +162,13 @@
options:
-h, --help Print this help
--name NAME Specify a name
--use FILE Loads inputs from file
-Take a quick look at the documentation. Class definitions can also map documentation and, in some cases, metadata to the command line; the configurations now have comments and reverse is a switch! Rich mapping allows tasks to act as an script interface, not unlike {OptionParser}[http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html] (surprise, tap uses OptionParser).
+Take a quick look at the documentation. Class definitions map documentation and, in some cases, metadata to the command line; the configurations now have comments and reverse is a switch! Rich mapping allows tasks to act as an script interface, not unlike {OptionParser}[http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html] (check out the {Configurable}[http://tap.rubyforge.org/configurable/] gem and specifically {ConfigParser}[http://tap.rubyforge.org/configurable/classes/ConfigParser.html] for more details).
-For example this is a stand-alone goodnight script:
+This is a stand-alone goodnight script:
[goodnight]
#!/usr/bin/env ruby
@@ -206,11 +204,11 @@
% tap generate root sample
% cd sample
% tap generate task goodnight
-Take a look at the task files an you find something like this:
+Take a look at the task files and you find something like this:
[lib/goodnight.rb]
# Goodnight::manifest <replace with manifest summary>
# <replace with command line description>
@@ -245,10 +243,10 @@
# a more complex test
task.enq("moon")
app.run
assert_equal ["goodnight moon"], app.results(task)
- assert_audit_equal ExpAudit[[nil, "moon"], [task, "goodnight moon"]], app._results(task)[0]
+ assert_audit_equal [[nil, "moon"], [task, "goodnight moon"]], app._results(task)[0]
end
end
Run the test:
\ No newline at end of file