Skip to content
This repository

Manage your application's gem dependencies with less pain

tree: a8de418f67

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile


Map options to a class. Simply create a class with the appropriate annotations, and have options automatically map to functions and parameters.


class MyApp
  extend Hermes                                                           # [1]

  map "-L" => :list                                                       # [2]

  desc "install APP_NAME", "install one of the available apps"            # [3]
  method_options :force => :boolean                                       # [4]
  def install(name, opts)
    ... code ...
    if opts[:force]
      # do something

  desc "list [SEARCH]", "list all of the available apps, limited by SEARCH"
  def list(search = "")
    # list everything



Hermes automatically maps commands as follows:

app install name --force

That gets converted to:"name", :force => true)

[1] Use extend Hermes to turn a class into an option mapper

[2] Map additional non-valid identifiers to specific methods. In this case, convert -L to :list

[3] Describe the method immediately below. The first parameter is the usage information, and the second parameter is the description.

[4] Provide any additional options. These will be marshaled from -- and - params. In this case, a --force and a -f option is added.

Types for method_options

true if the option is passed
A key/value option that MUST be provided
A key/value option that MAY be provided
Something went wrong with that request. Please try again.