Files | Admin

Notes:

Release Name: 0.3.3

Notes:
= Drydock - v0.3

Inspired by github-gem and bmizerany-frylock.

== Overview

Drydock is a seaworthy DSL for command line apps. It is contained in a single .rb which can be copied directly into your project. 

== Install

One of:

* gem install drydock
* copy lib/drydock.rb into your lib directory. 

Or for GitHub fans:

* git clone git://github.com/delano/drydock.git
* gem install delano-drydock

== Examples

See bin/example for more. 

  require 'drydock'

  default :welcome

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

  command :welcome do
  # Example: ruby bin/example
    
    puts "Welcome to Drydock. You have the following commands:"
    
    # The commands method returns a hash of Drydock::Command objects
    puts commands.keys.inject([]) { |list, command| list << command.to_s }.sort.join(', ')
  end
  
  usage "Example: #{$0} laugh [-f]"
  option :f, :faster, "A boolean value. Go even faster!"
  command :laugh do |obj|
  # +obj+ is an instance of Drydock::Command. The options you define are available
  # via accessors in this object. 

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

    puts "Captain Stubing: Are you laughing?"
    puts "Dr. Bricker: " << answer
  end
  
  class JohnWestSmokedOysters < Drydock::Command; end;
  # You can write your own command classes by inheriting from Drydock::Command
  # and referencing it in the command definition.

  command :oysters => JohnWestSmokedOysters do |obj|
    p obj  # => #<JohnWestSmokedOysters:0x42179c ... >
  end
  
== More Information

* http://github.com/delano/drydock
* http://drydock.rubyforge.org/ (rdocs)
* http://www.youtube.com/watch?v=m_wFEB4Oxlo

== Credits

* Delano Mandelbaum (delano@solutious.com)
* Bernie Kopell (bernie@solutious.com)


== License

See LICENSE.txt



Changes: DRYDOCK, CHANGES TODO: * Fix '-' '_' ambiguity for option names * Calls valid? method (if present) before calling command block. #### 0.3.3 (2009-02-14) ############################### * NEW: init method hook for subclasses of Drydock::Command * UPDATED: Rdocs #### 0.3 (2009-02-05) ############################### * Added support for custom Drydock::Commands objects * Global and command-specific options are now available as attributes of the Drydock::Commands class instance. * Automatic execution * Now in a single file (lib/drydock.rb) * Started adding tests * Improved documentation #### 0.2 (2008-12-27) ############################### * Initial release * Forked from bmizerany/frylock