aaron quint - ruby kaigi presentation

Post on 12-Jan-2015

1.165 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Ruby Kaigi / July 18, 2009

Sinatra: シナトラThe Framework Withinフレームワーク内部で使われるも

Aaron Quint / Quirkey NYC, LLCアーロン・クィン / カーキー ニューヨーク 合同会社

Friday, July 31, 2009

Brooklyn, New Yorkニューヨーク州 ブルックリン

Friday, July 31, 2009

Sinatra.シナトラ

Friday, July 31, 2009

I didn’t write Sinatra,の作者ではない…が、

I just love it.ほれ込んでいる

Friday, July 31, 2009

Sinatra.

require 'sinatra'

get '/' do "Don't you hate pants?"end

Friday, July 31, 2009

Sinatra.

Friday, July 31, 2009

Sinatra.

require 'sinatra'

get '/homer/hate/:hate' do "Don't you hate #{params[:hate]}?"end

Friday, July 31, 2009

Sinatra.

Friday, July 31, 2009

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

Classy.かっこいい例

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

Sinatra. Classy.

Friday, July 31, 2009

Sinatra. Classy.

Friday, July 31, 2009

Sinatra is not

a framework.はフレームワークではない

Friday, July 31, 2009

Framework.

Friday, July 31, 2009

Not a Framework.

Friday, July 31, 2009

Sinatra.

Friday, July 31, 2009

Not MVC.でもない

Friday, July 31, 2009

WDNNSP(We Don’t Need No Stinkin’ Pattern)不愉快なパターンなんて必要ない!

Friday, July 31, 2009

Sinatrais a

library.はライブラリである

Friday, July 31, 2009

Sinatra as a library.

‣A DSL for defining routes.

‣コードの流れを定義するDSLであり、

‣A nicer Rack.

‣より快適なRackである

Friday, July 31, 2009

Friday, July 31, 2009

Code first. まずはコードありき

Then Sinatra.次に、Sinatraを使う

Friday, July 31, 2009

My Awesome Ruby Project.

私が気に入っているRubyプロジェクトは

Includes Sinatra.Sinatraを使っている

Friday, July 31, 2009

Sinatra!

Friday, July 31, 2009

HTTP as a language.

HTTPを言語と考える

Friday, July 31, 2009

Sinatra speaks HTTP.

SinatraはHTTPを話す

Friday, July 31, 2009

Do you speak HTTP?貴方、HTTPを話せる?

Friday, July 31, 2009

GET!

Friday, July 31, 2009

RESPONSE!

Friday, July 31, 2009

UserRestClient

RackSinatra

Friday, July 31, 2009

Friday, July 31, 2009

The power of the local web.ローカルWebの力

Friday, July 31, 2009

The power of localhost.

ローカルホストの力

Friday, July 31, 2009

Friday, July 31, 2009

Friday, July 31, 2009

CALLING ALLDEVELOPERS!すべての開発者へ

Friday, July 31, 2009

CALLING ALLDEVELOPERS!

require 'sinatra'

Friday, July 31, 2009

CALLING ALL DEVELOPERS!

AwesomeCodes.

お気に入り

Friday, July 31, 2009

CALLING ALL DEVELOPERS!

Sinatra!

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 # ... endend

Friday, July 31, 2009

CALLING ALL DEVELOPERS!

Friday, July 31, 2009

CALLING ALL DEVELOPERS!

Sinatra!

Friday, July 31, 2009

CALLING ALL DEVELOPERS!require 'sinatra'

module Gembox 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 def self.version Gembox::VERSION end # ...end

Friday, July 31, 2009

Introducingの紹介

Friday, July 31, 2009

Super 超Simple 単純な

SinatraStarter. スターター

Friday, July 31, 2009

Vegas

#!/usr/bin/env ruby

require File.expand_path(File.dirname(__FILE__) + "/../lib/gembox")

require 'vegas'

Vegas::Runner.new(Gembox::App, 'gembox')

Friday, July 31, 2009

Vegas

[11:05 PM:~] $ gembox -hUsage: 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

Aaron Quintaaron@quirkey.com

http://www.quirkey.com

All code available and open source at:全てのコードはオープンソースで利用できます

http://code.quirkey.com/vegashttp://code.quirkey.com/gembox

Available for hire!

Friday, July 31, 2009

top related