Project

rakuna

0.0
No commit activity in last 3 years
No release in over 3 years
Rakuna provides mixins to simplify Webmachine development
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

rakuna

Compose Interesting Systems from Simple Concepts

Description

rakuna is made up of several very small gems, each of which adds a set of related classes and/or mixins to reduce boilerplate code.

Goals

  • Be simple to use.
  • Be fast.
  • Be obvious to read.

Conventions

  • Overridable methods, not instance variables.
  • Encourage intuitive composition with mixins.
  • Provide and fulfill reasonable Contracts.

Sub-Projects

Installation

gem install rakuna

Usage

require 'rakuna'

Examples

Hello World

# Create a resource!
class ExampleResource < Rakuna::Resource::Basic
  include Rakuna::Provides::Text

  def output
    'Hello, World'
  end
end

# Send all routes to ExampleResource
Webmachine.application.routes do
  add [:*], ExampleResource
end

Webmachine.application.run

Hello World, with GitHub authentication and Redis-backed session storage

# Create a resource!
class ExampleResource < Rakuna::Resource::Basic
  include Rakuna::Provides::HTML
  include Rakuna::Authentication::GitHub::Organization
  include Rakuna::Session::Redis

  def whitelist
    ['my-github-organization']
  end

  def session_id
    username
  end

  def save_avatar
    session.set 'avatar', user.avatar_url
  end

  def output
    session.renew unless session.active?
    "<p>Hello, #{username}! Your avatar is: <img src=\"#{session.get 'avatar'}\" /></p>"
  end
end

# Send all routes to ExampleResource
Webmachine.application.routes do
  add [:*], ExampleResource
end

Webmachine.application.run

Contributing to rakuna

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

License

MIT

Contributors