public
Description: CoolOptions is a simple wrapper around optparse that provides less options and more convenience.
Homepage: http://cooloptions.rubyforge.org
Clone URL: git://github.com/ntalbott/cooloptions.git
name age message
file .tm_last_run_ruby Thu Nov 30 16:11:17 -0800 2006 git-svn-id: https://terralien.devguard.com/svn/... [nathaniel]
file History.txt Wed Jan 10 14:52:04 -0800 2007 r8746@joshua: ntalbott | 2007-01-10 17:48:51 ... [nathaniel]
file Manifest.txt Sat Dec 09 11:58:52 -0800 2006 r8694@joshua: ntalbott | 2006-12-09 12:45:58 ... [nathaniel]
file README.txt Wed Jan 10 14:52:04 -0800 2007 r8746@joshua: ntalbott | 2007-01-10 17:48:51 ... [nathaniel]
file Rakefile Sat Dec 09 17:16:58 -0800 2006 r8700@joshua: ntalbott | 2006-12-09 20:15:23 ... [nathaniel]
file cooloptions.tmproj Wed Jan 10 14:52:04 -0800 2007 r8746@joshua: ntalbott | 2007-01-10 17:48:51 ... [nathaniel]
directory lib/ Wed Jan 10 14:52:04 -0800 2007 r8746@joshua: ntalbott | 2007-01-10 17:48:51 ... [nathaniel]
directory samples/ Wed Jan 10 14:52:04 -0800 2007 r8746@joshua: ntalbott | 2007-01-10 17:48:51 ... [nathaniel]
directory test/ Wed Jan 10 14:52:04 -0800 2007 r8746@joshua: ntalbott | 2007-01-10 17:48:51 ... [nathaniel]
README.txt
= CoolOptions
    by Nathaniel Talbott <nathaniel@terralien.com>
    http://cooloptions.rubyforge.org/

== DESCRIPTION:
  
CoolOptions is a simple wrapper around optparse that provides less options and more convenience.

As a huge fan of optparse due to its flexibility, self-documenting nature, and ease of use, I nevertheless found myself 
doing almost the exact same thing with it over and over again, and decided to write a thin wrapper around it to handle 
the common cases. Thus CoolOptions was born.

== SYNOPSIS:

=== Declaration:

  options = CoolOptions.parse!("[options] PROJECTNAME") do |o|
    o.desc 'Sets up a new Rails project.'
    o.on "repository URL",         "Remote subversion repository."          
    o.on "svk",                    "Use svk.",                              true
    o.on "project-path PATH",      "Root of project workspaces.",           File.expand_path("~/svk")
    o.on "l)repository-path PATH", "Remote repository path.",               "/"
    o.on "mirror-path SVKPATH",    "SVK mirror path.",                      "//"
    o.on "local-pa(t)h SVKPATH",   "SVK local path.",                       "//local"
    o.on "create-structure",       "Create trunk/tags/branches structure.", true
    o.on "finish",                 "Prep and commit the new project.",      true

    o.after do |r|
      r.project_path = File.expand_path(r.project_path)
      o.error("Invalid path.") unless File.exist?(r.project_path)
      r.project_name = ARGV.shift
      o.error("Project name is required.") unless r.project_name
      o.error("Project name is too funky.") unless /^\w+$/ =~ r.project_name
    end
  end
  
=== Usage:

  $ ./new_rails_project --no-svk -r http://terralien.com/svn/terralien/ myproject
  
=== Result:
  
  p options.svk                 # => false
  p options.project_path        # => '/Users/ntalbott/svk'
  p options.repository          # => 'http://terralien.com/svn/terralien/'
  p options.create_structure    # => true
  p options.project_name        # => 'myproject'

=== Also:

  $ ./new_rails_project --help                                                               
  Usage: t.rb [options] PROJECTNAME
      -s, --[no-]svk                   Use svk.
                                       Default is: true
      -p, --project-path PATH          Root of project workspaces.
                                       Default is: /Users/ntalbott/svk
      -r, --repository URL             Remote subversion repository.
      -l, --repository-path PATH       Remote repository path.
                                       Default is: /
      -m, --mirror-path SVKPATH        SVK mirror path.
                                       Default is: //
      -t, --local-path SVKPATH         SVK local path.
                                       Default is: //local
      -c, --[no-]create-structure      Create trunk/tags/branches structure.
                                       Default is: true
      -f, --[no-]finish                Prep and commit the new project.
                                       Default is: true
      -h, --help                       This help info.

== REQUIREMENTS:

optparse & ostruct (included in Ruby standard library).

== DOWNLOAD:

Via gems or from the
{Rubyforge project page}[http://rubyforge.org/projects/cooloptions].

== INSTALL:

  sudo gem install cooloptions

== CONTRIBUTE:

Drop me an email (see above) and/or
{check out the source}[http://terralien.com/svn/projects/cooloptions/trunk].

== LICENSE:

The RUBY License

Copyright (c) 2006 Nathaniel Talbott and Terralien, Inc. All Rights Reserved.