Project

mont

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
This is still WIP
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
>= 0
< 2.0
~> 10.0
>= 0

Runtime

>= 0
 Project Readme

Mont

A lightweight Ruby MVC framework inspired by Rails.

Featuring

CSRF protection

require_relative '../models/cat'

class DogesController < ControllerBase

  def create
    verify_authenticity_token
    @Doge = Doge.new(name: params["name"], wow_id: params["wow_id"])
    @Doge.save

    render :show
  end

end

Simply include verify_authenticity_token to ensures no none 'GET' action can be done without authenticity token being checked

Session

session['sample_key'] = 'sample_text!'

Persist states by storing cookies in session

Flash

flash[:error] = 'Invalid credentials!'

or

flash.now[:error] = 'Invalid credentials'

Whether you want to alert the user for just this session or the next, Flash will be written into the cookies and will get cleared with each request.

Static Assets

app
└─── public
      ├── doge
      |    └── much-wow.jpg
      └── music
            └── Darude
                ├── Sandstorm.mp3
                └── Rush.mp3

Including contents in your app/public and it will automatically be served as a static assets.

Installation

  1. run gem install mont
  2. run mont new {your preferred app name}
  3. make a controller
# app/controllers/doges_controller.rb

require_relative 'lib/controller_base'
require_relative '../models/doge'

class DogesController < ControllerBase
  def index
    @doges = Doge.all

    render :index
  end
end
  1. construct a route
# config/routes.rb

ROUTER.draw do
  get Regexp.new("^/doges$"), DogesController, :index
  get Regexp.new("^/doges/new$"), DogesController, :new
  post Regexp.new("^/doges$"), DogesController, :create
end
  1. start the server with mont server

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/maestromac/Mont.

License

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