link to docs
[sinatra.git] / README
blob5db9111611c6ce5487b0d7b0fb16135e6f74b49f
1 Sinatra (C) 2007 By Blake Mizerany
3 = Classy web-development dressed in a DSL
5 == Install!
7   sudo gem install sinatra -y
9 == Use!
11 I'm going to move quick.  I'll let you drool at your own pace.
13 * Create a file called lyrics.rb (or any name you like)
15 * Add
16     require 'rubygems'
17     require 'sinatra'
19 * Run (yes, with just ruby)
20     % ruby lyrics.rb
21     == Sinata has taken the stage on port 4567!
23 * Take a moment and view the default page http://localhost:4567.  Go ahead and bask in it's glory.
25 * Notice:
26   * It didn't create any page to show you that default page (just a cool thing to see, that's all)
27   * There was nothing generated other than a log file
28   * Sinatra is a really cool name for a web-framework that's a DSL
30 * Modify lyrics.rb by adding:
31     get '/' do
32       'Hello World'
33     end
34   
35 * Refresh (no need to restart Sinatra):
36     http://localhost:4567
38 * Modify again (then refresh):
39     get '/' do
40       <<-HTML
41         <form action='/' method="POST">
42           <input type="text" name="name" />
43           <input type="submit" value="Say my name!" />
44         </form>
45       HTML
46     end
47   
48     post '/' do
49       "Hello #{params[:name] || 'World'}!"
50     end
52 * Now you try:
53   Use the Sinatra::Erb::EventContext or Sinatra::Haml::EventContext to do the same.  Do them inline and as template files.
55 * Learn more cool stuff:
56   see Sinatra::Dsl
58 * Create your own plugins!
59   1. Create a 'vendor' directory in your app directory
60   2. Lay it out like:
62      myapp.rb : root
63         |- vendor
64                      | - plugin_name
65                    | - init.rb  # load and hook here
66                    | - lib
67                          |- modules/classes here
69   3. Use it in your app!
71   see $SINATRA_GEM_ROOT/vendor/erb or $SINATRA_GEM_ROOT/vendor/erb for examples.
73 * Tell!
74 We would love to here what you're doing with Sinatra and any cool patches/features you would like.  (blake { dot } mizerany [ at ] gmail)
76 * Talk!
77 IRC (irc.freenode.com  #sinatra)
78 Mailing List (sinatrarb@googlegroups.com)
80 * Contribute
82 We're using git as our scm.. cuz.. it rocks.  You can get the latest source from http://repo.or.cz/w/sinatra.git
84 NOTE: You can also get tar'd snapshots of each commit there too.  So technically you don't need git to get the latest code.
86 It's probably going to happen.. you'll find a bug.  Please help by:
88 * Sending a message to sintrarb@googlegroups.com with BUG: at the start of the subject (I'm working on a better tracking system)
89 * Please send patches or pull requests to (blake { dot } mizerany [ at ] gmail) don't forget the dot com. ;)
91 == Thanks!
93 - Ezra Zygmuntowicz (http://brainspl.at) for answering all those random questions over IM and all the poached code
94 - Ditto to Chris Wanstrath (errtheblog.com) and helping me keep things simple, and some cool tricks
95 - Ari Lerner over at CitrusByte for ideas, code, and enthusiasm
96 - Koshi (http://www.songbirdnest.com/jkoshi/blog) here at POTI, Inc. for the Sinatra mark
97 - Pete Golibersuch for the hat logo
98 - John Philip Green (http://www.linkedin.com/in/johngreen) for motivation and evangelism
99 - The team here at songbirdnest.com for cool ideas