Sha256: 6ba3fa61ab83064019727ab251bae6b015b755c521352eea9472f6a78025b3df

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

= Martin

An ode to the Rat Pack (Dean Martin) with a Sinatra style DSL for creating command line interfaces to your applications

== Example

calc.rb
  class Calculator
      def add(*nums)
          nums.reduce(:+)
      end
  end

app.rb
  require File.dirname(__FILE__) + 'calc'
  require 'martin'
  
  configure do
      @calc = Calculator.new
  end
  
  command /add (\d+) to (\d+)/ do |a, b|
      puts @calc.add(a.to_i, b.to_i)
  end
  
  error do |input|
      puts 'Error: command ' + input.split.first + ' not found.'
  end
  
And that's it! Now run `ruby app add 15 to 25` and the application 
should return `40`
  
== Note on Patches/Pull Requests
 
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
  future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.

== Copyright

Copyright (c) 2010 Ryan Lewis. See LICENSE for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
martin-0.1.1 README.rdoc