https://github.com/namusyaka/airship
Airship is the Sinatra/Padrino extension.
https://github.com/namusyaka/airship
Last synced: about 2 months ago
JSON representation
Airship is the Sinatra/Padrino extension.
- Host: GitHub
- URL: https://github.com/namusyaka/airship
- Owner: namusyaka
- License: mit
- Created: 2014-05-09T16:41:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-10T06:15:33.000Z (about 11 years ago)
- Last Synced: 2025-03-01T15:37:25.816Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 140 KB
- Stars: 19
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Airship
[](https://travis-ci.org/namusyaka/airship)
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
```ruby
class Sample::App < Sinatra::Base
register Airship::Attachment::Sinatradef before_index
@hello = :Hello
enddef index
"#{@hello} World"
enddef show(name, type)
"#{name} is #{type}"
endbefore "/", to: :before_index
get "/", to: :index
get "/show/:name/:type", to: :showend
```#### with Padrino
```ruby
class Sample::App < Padrino::Application
register Airship::Attachment::Padrinodef before_index
@hello = :Hello
enddef index
"#{@hello} World"
enddef show(name, type)
"#{name} is #{type}"
endbefore :index, to: :before_index
get :index, to: :index
get :show, map: "/show/:name/:type", to: :showend
```### Management
Airship::Management provides yet another DSL built upon the Sinatra/Padrino library.
#### with Sinatra
```ruby
class Sample::App < Sinatra::Base
register Airship::Management::Sinatraindex do
"GET /"
endshow do
"GET /:id"
endedit do
"GET /:id/edit"
endupdate do
"POST /:id/update"
enddestroy do
"DELETE /:id/delete"
end
end
```#### with Padrino
```ruby
class Sample::App < Padrino::Application
register Airship::Management::Padrinoindex do
"GET /"
endshow do
"GET /:id"
endedit do
"GET /:id/edit"
endupdate do
"POST /:id/update"
enddestroy do
"DELETE /:id/delete"
endcontroller :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