Melodiest

Melodiest is Sinatra application boilerplate. It provides generator and useful modules for developing application.

Installation

gem install melodiest

with Bundler, put this code in your Gemfile:

gem 'melodiest'

How to Use

Command

generate app in current directory

melodiest -n my_app

generate app in target directory

melodiest -n my_app -d target/dir

Example Code

Because Melodiest is already required Sinatra, you don't have to require 'sinatra' anymore, just require 'melodiest'.

Melodiest::Application is subclass from Sinatra::Application and by default is using configuration from Melodiest::Setting.setup method.

# my_app.rb

require 'melodiest/auth/http'

class App < Melodiest::Application
  configure do
    # Load up database and such
  end

  helpers Melodiest::Auth::Http
end

# app/routes/my_routes.rb

get "/" do
  "hello world!"
end

get "/protected" do
  authorized! "myhttpauthusername", "myhttpauthpassword"
  "welcome!"
end

Run the server

bundle exec rackup

Default Configuration

Modules

Available modules from Melodiest

  • Melodiest::Auth::Http