tags:

views:

16

answers:

1

I want to create some Gems with parameters lists when i run: my_app --help.

Just like all the gems (rake, rails etc).

Example:

Usage:
  rails new APP_PATH [options]

Options:
  -J, [--skip-prototype]      # Skip Prototype files
  -T, [--skip-test-unit]      # Skip Test::Unit files
      [--dev]                 # Setup the application with Gemfile pointing to your Rails checkout
  -G, [--skip-git]            # Skip Git ignores and keeps
  -b, [--builder=BUILDER]     # Path to an application builder (can be a filesystem path or URL)
  -m, [--template=TEMPLATE]   # Path to an application template (can be a filesystem path or URL)
      [--edge]                # Setup the application with Gemfile pointing to Rails repository
      [--skip-gemfile]        # Don't create a Gemfile
  -d, [--database=DATABASE]   # Preconfigure for selected database (options: 

In this way I could just use it by:

gem install my_gem
my_gem --help
my_gem delete files file1.jpg file2.jpg
my_gem update
etc...

Is there some kind of gem framework for this or does one have to start from scratch?

+1  A: 

There's a lot of options (haaaa...)

A standard one is in Ruby's stdlib: http://ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html

Rails uses Thor, which might suit your needs better. http://rubygems.org/gems/thor

qrush