Rollerskates Code Climate Build Status Coverage Status

You all have heard about rails, right? (obviously). Rails is a gigantic framework capable of supporting massive projects. Like its name, it can support massive trains (trains) with tons of weight (requirements). Here is rollerskates, a micro MVC built with ruby and is just capable of getting you from here to there.

Installation

Add this line to your application's Gemfile:

gem 'rollerskates'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rollerskates

Usage

Setup

Ensure that your folder structure follow this pattern:

app_name

Application.rb

Set up your application this way:

require 'rollerskates'

module Todolist
    class Application < Rollerskates::Application
    end
end

Allow your application class to inherit form Rollerskates::Application class

Config.ru

Set up your routes this way:

require "/config/application.rb"
TodoApplication = Todolist::Application.new
use Rack::MethodOverride
require "/config/routes.rb"
run TodoApplication

Routes

TodoApplication.pot.prepare do
  get "/", to: "welcome#index"
  resources :lists
  resources :items, only: :index
end

resources can also accomodate the only option.

Controllers

class ItemsController < Rollerskates::BaseController
  def index
    @items = Item.all
  end

  def new
  end

  def show
    @item = Item.find(params["id"])
    render :show_full
  end
end

Just like rails, controller action can take optional render. If the view to render is not stated explicitly, Rollerskates will render a view with the corresponding contoller action name.

Models

class Item < Rollerskates::BaseRecord
  property :name, type: :text, nullable: false
  property :status, type: :boolean, nullable: false

  create_table
end

Rolletskates automatically adds the id, created_at and updated_at fields and thus need not to be specified in the model. Other properties, however should be specified as above.

Views

Files in the view folder should be organized according to the controller and action name.

Testing

The tests could be run automatically by using

$ rspec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/andela-fsenjobi/rollerskates. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.