Project

airship

0.01
No commit activity in last 3 years
No release in over 3 years
Airship is the Sinatra/Padrino extension.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Airship

Build Status

Airship is the Sinatra/Padrino extension.

Installation

Add this line to your application's Gemfile:

gem 'airship'

And then execute:

$ bundle

Or install it yourself as:

$ gem install airship

Usage

Attachment

Airship::Attachment enables to use :to option with verbs and filters

with Sinatra

class Sample::App < Sinatra::Base
  register Airship::Attachment::Sinatra

  def before_index
    @hello = :Hello
  end

  def index
    "#{@hello} World"
  end

  def show(name, type)
    "#{name} is #{type}"
  end

  before "/", to: :before_index

  get "/", to: :index
  get "/show/:name/:type", to: :show

end

with Padrino

class Sample::App < Padrino::Application
  register Airship::Attachment::Padrino

  def before_index
    @hello = :Hello
  end

  def index
    "#{@hello} World"
  end

  def show(name, type)
    "#{name} is #{type}"
  end

  before :index, to: :before_index
  get :index, to: :index
  get :show, map: "/show/:name/:type", to: :show

end

Management

Airship::Management provides yet another DSL built upon the Sinatra/Padrino library.

with Sinatra

class Sample::App < Sinatra::Base
  register Airship::Management::Sinatra

  index do
    "GET /"
  end

  show do
    "GET /:id"
  end

  edit do
    "GET /:id/edit"
  end

  update do
    "POST /:id/update"
  end

  destroy do
    "DELETE /:id/delete"
  end
end

with Padrino

class Sample::App < Padrino::Application
  register Airship::Management::Padrino

  index do
    "GET /"
  end

  show do
    "GET /:id"
  end

  edit do
    "GET /:id/edit"
  end

  update do
    "POST /:id/update"
  end

  destroy do
    "DELETE /:id/delete"
  end

  controller :resources do
    index do
      "GET /resources"
    end
  
    show do
      "GET /resources/:id"
    end
  
    edit do
      "GET /resources/:id/edit"
    end
  
    update do
      "POST /resources/:id/update"
    end
  
    destroy do
      "DELETE /resources/:id/delete"
    end
  end
end

Contributing

  1. Fork it ( https://github.com/namusyaka/airship/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request