appkernel

DESCRIPTION:

AppKernel is a microframework for capturing your application in terms of minute, self-validating functions. Once defined, these functions can be used in rails, cocoa, an sms gateway, or wherever you want to take them.

FEATURES:

  • Package the bits of your application in terms of what it does, not the entities it contains.

  • Get a command line interface for free (that’s better than vanilla script/console)

  • Transparent conversion between options and the strings that represent them.

SYNOPSIS:

module Foo

include AppKernel::Function

function :Hello do
  option :to, :index => 1, :required => true

  validate do
   @to.check(@to != "spam", "I don't like spam!")
  end

  execute do
    "Hello #{@to}!"
  end
end

Hello("George") #=> "Hello, George!"
Hello(:to => "George") #=> "Hello, George!"
apply(Hello, "George").success? #=> true
apply(Hello, "George").return_value => "Hello, George!"

#Error Reporting

Hello("spam") #=> "Exception!! I don't like spam!"
apply(Hello, "spam").success? #=> false
apply(Hello, "spam").return_value #=> nil
apply(Hello, "spam").errors[:to] #=> "I don't like spam"

end

INSTALL:

sudo gem install appkernel

LICENSE:

(The MIT License)

Copyright © 2009 Charles Lowell <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.