Sinatra (software)
Sinatra | |
---|---|
Basic data
|
|
developer | Blake Mizerany (maintainer: Konstantin Haase) |
Current version | 2.0.0 (April 10, 2017) |
operating system | cross-platform |
programming language | Ruby |
category | Web framework |
License | MIT license |
German speaking | No |
www.sinatrarb.com |
Sinatra is a free web framework and a domain-specific language written in Ruby . It's an alternative to other Ruby frameworks like Ruby on Rails , Nitro , Camping, and Rango . Sinatra requires the rack web server interface.
Sinatra was designed and developed by Blake Mizerany and is meant to be compact and flexible. It does not follow the MVC pattern used in other frameworks such as Ruby on Rails. Instead, Sinatra aims to be able to develop web applications quickly and with minimal effort.
Some major companies use Sinatra, including Apple , the BBC , LinkedIn , Engine Yard , Heroku , GitHub, and Songbird . Heroku is providing a large portion of Sinatra's funding.
Sinatra was created in 2007 and placed under an open source license .
Examples
Example 1: a webapp in a file
A hello world web application can look like this, for example:
#!/usr/bin/env ruby
require 'sinatra'
get '/' do
redirect to('/hello/World')
end
get '/hello/:name' do
"Hello #{params[:name]}!"
end
Such a program is started with:
$ ruby test.rb
If you open it in the browser:
http://localhost:4567
Can you read the Hello World! see in the browser window. However, if you call the URL
http://localhost:4567/hello/Ada
so you can read the Hello Ada! see in the browser window.
Example 2: HTML code in the web app
It is possible to incorporate HTML code into the source code with ERuby (erb):
#!/usr/bin/env ruby
require 'sinatra'
get '/' do
erb :main
end
__END__
@@main
<!doctype html>
<html >
<head>
<title>Welcome page</title>
<meta charset="utf-8">
</head>
<body>
<header>
<h1>Welcome World!</h1>
</header>
<p>Welcome to this Website!
</p>
</body>
</html>
Frameworks influenced by Sinatra
Sinatra has inspired a number of microframeworks in Ruby and other programming languages. Such frameworks usually try to emulate Sinatra's domain-specific language (DSL) as closely as possible.
- Ruby : Almost Sinatra, Astaire, Cuba, Padrino (based on Sinatra), Pakyow, Renee
- PHP : Fat-Free, Fitzgerald, Glue, klein, Laravel, Lemonade, MiMViC, Silex, Slim
- JavaScript : Express, Picard, Roundabout, Sammy
- CoffeeScript : Zappa
- Python : Bottle, Denied (what an April Fools joke), Flask, itty, Juno
- Erlang (programming language) : Fresh, Spooky
- Groovy : graffiti, ratpack
- Scala : Scalatra, BlueEyes
- .NET : Martin, Nancy, Nina
- Perl : Dancer , Mojolicious
- Java : Spark, Napalm, Htmleasy
- Haskell : Bird, loli
- Fancy : Sinatra.fy
- Bash : Astley, sh.inatra
- C : Bogart
- F # : Frank
- Lua : Mercury, orbit
- Mirah : Shatner
- Objective-C : RC router
- Vala : Valatra
- Nim : Jester
In July 2011, an individual or group posing as members of the Sinatra team discredited the Dancer Project. This incident led the Sinatra team to publicly endorse the Dancer project and other replicas.
literature
- Alan Harris, Konstantin Haase: Sinatra: Up And Running (First ed.). O'Reilly Media, 2012, ISBN 978-1-4493-0423-2 , p. 120.
Web links
- Sinatra website at sinatrarb.com
- Sinatra's GitHub repository on github.com
- Video of Blake Mizerany and Adam Wiggins. on rubyconf2008.confreaks.com
Individual evidence
- ↑ Sinatra: Getting Started. In: sinatrarb.com. Retrieved January 29, 2012 .
- ↑ Open source software used by Apple. Retrieved January 20, 2012 .
- ↑ BBC Zeitgeist. (No longer available online.) Archived from the original on November 28, 2010 ; Retrieved January 29, 2012 . Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ↑ JRubyfying LinkedIn's front-end. Retrieved January 29, 2012 .
- ↑ Sinatra in The Wild. Retrieved January 29, 2012 .
- ↑ Sinatra: About. Retrieved January 29, 2012 .
- ^ Almost Sinatra
- ↑ Astaire
- ^ Cuba
- ↑ Padrino
- ↑ Pakyow
- ↑ Renee
- ↑ Fat-Free
- ↑ Fitzgerald
- ↑ Glue ( Memento of the original from July 8, 2011 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ↑ small
- ↑ Laravel
- ↑ lemonade
- ↑ MiMViC ( page can no longer be accessed , search in web archives ) Info: The link was automatically marked as defective. Please check the link according to the instructions and then remove this notice.
- ↑ Silex ( Memento of the original from April 30, 2015 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ↑ Slim
- ↑ Express
- ↑ Picard
- ↑ Roundabout
- ↑ Sammy
- ↑ Zappa
- ↑ Bottle ( Memento of the original from January 10, 2011 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ↑ Denied ( Memento of the original from September 4, 2011 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ^ Armin Ronacher: April 1st Post Mortem
- ↑ Flask
- ↑ itty
- ↑ Juno
- ↑ Fresh
- ↑ Spooky
- ^ Graffiti
- ↑ Ratpack
- ↑ Scalatra
- ↑ BlueEyes
- ↑ Martin
- ↑ Nancy
- ↑ Nina
- ^ Mojolicious :: Lite
- ↑ Spark
- ↑ Napalm ( page no longer available , search in web archives ) Info: The link was automatically marked as defective. Please check the link according to the instructions and then remove this notice.
- ↑ HTMLeasy
- ^ Bird
- ↑ Loli ( Memento of the original from February 14, 2010 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ↑ Sinatra.fy
- ↑ Astley
- ↑ see inatra
- ↑ Bogart
- ↑ Frank ( Memento of the original from October 13, 2011 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice.
- ↑ Mercury
- ↑ Orbit
- ↑ Shatner
- ↑ RC router
- ↑ Valatra
- ↑ Jester
- ↑ "Sinatra Loves Dancer"