Sinatra.
require 'sinatra'
get '/homer/hate/:hate.json' do
content_type 'json'
"{'hate': '#{params[:hate]}'}"
end
get '/homer/hate/:hate' do
"Don't you hate #{params[:hate]}?"
end
Friday, July 31, 2009
Sinatra. Classy.
require 'sinatra'
require 'rack/flash'
class ClassyApp < Sinatra::Default
set :sessions, true
use Rack::Flash
get '/' do
haml :index
end
post '/classify' do
flash[:message] = 'Your text has been classified.'
@text = "I do say, #{params[:text]}. Quite!"
haml :classify
end
end
Friday, July 31, 2009
CALLING ALL DEVELOPERS!
require 'sinatra'
module MyProject
class App < ::Sinatra::Default
set :root, File.join(File.dirname(__FILE__), '..', '..')
set :app_file, __FILE__
#...
get '/' do
# ... SOMETHING AWESOME
end
# ...
end
end
Friday, July 31, 2009
require 'sinatra'
module Gembox
CALLING ALL DEVELOPERS!
class App < ::Sinatra::Default
include Gembox::ViewHelpers
include WillPaginate::ViewHelpers
@@root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
set :root, @@root
set :app_file, __FILE__
before do
Gembox::Gems.load
@gems = Gembox::Gems.local_gems.paginate :page => params[:page], :per_page => 30
@stats = Gembox::Gems.stats
end
#...
get '/' do
redirect '/gems'
end
get %r{/gems/doc/([w-_]+)/?([d.]+)?/?(.*)?} do
#...
end
get %r{/gems/([w-_]+)/?([d.]+)?/?} do
# ...
haml :gem, :layout => show_layout
end
get '/gems/?' do
# ...
haml "gems_#{@show_as}".to_sym, :layout => show_layout
end
Friday, July 31, 2009
Vegas
[11:05 PM:~] $ gembox -h
Usage: gembox [options]
Vegas options:
-s, --server SERVER serve using SERVER (webrick/mongrel)
-o, --host HOST listen on HOST (default: 0.0.0.0)
-p, --port PORT use PORT (default: 5678)
-e, --env ENVIRONMENT use ENVIRONMENT for defaults (default: development)
-F, --foreground don't daemonize, run in the foreground
-K, --kill kill the running process and exit
-S, --status display the current running PID and URL then quit
Common options:
-h, --help Show this message
--version Show version
Friday, July 31, 2009
Vegas
$ sudo gem install gembox
Friday, July 31, 2009
Vegas
$ sudo gem install neerajdotname-javascript_lab
Friday, July 31, 2009
The FUTURE!
‣Gems+Vegas as a distribution platform.
‣
‣Even easier workflow for mounting.
‣
‣Vegas as the central brain.
‣Vegas
‣Distribute tasks across the local network.
‣
Friday, July 31, 2009
Thank you!
Thanks to Sougo Tsuboi, Leonard
Chin and the other Ruby Kaigi
Volunteers
Friday, July 31, 2009
Av
ai
la
bl
e
fo
rh
ire
!
Aaron Quint
aaron@quirkey.com
http://www.quirkey.com
All code available and open source at:
http://code.quirkey.com/vegas
http://code.quirkey.com/gembox
Friday, July 31, 2009