Skip to content

Instantly share code, notes, and snippets.

@dictav
Created August 3, 2012 06:18
Show Gist options
  • Save dictav/3245060 to your computer and use it in GitHub Desktop.
Save dictav/3245060 to your computer and use it in GitHub Desktop.
ハイカラRails勉強会
- title = "ハイカラRails勉強会"
!!! 5
%html{:lang => "ja"}
%head
%meta{:charset => "UTF-8"}
%title= title
%base{ :href => "file:///Users/shintaro/Documents/LearningGit/gist/" }/
%link{ :rel => "stylesheet",
:href => "css/base.css" }/
%body
%header
%h1= title
%section
%h1 自己紹介
%img.profile{src:"http://api.twitter.com/1/users/profile_image/dictav?size=bigger"}
%dl.profile
%dt 名前
%dd 阿部慎太郎(31歳)
%dt HN, twitter, facebook, gmail
%dd dictav (でぃくたぶ、でぃくたーぶ)
%dt 経歴
%dd
%ul{id:"history"}
%li 長岡高専
%li 航空自衛隊
%li ギークハウス新潟 ←<span style="color:red;">イマココ</span>
%dt 好きな言語
%dd Objective-C / Ruby / HTML5 / JOVIAL
%section
%h1 Rails3 とは
:markdown
Ruby on Rails は一世を風靡しました。
ごく最近まで Twitter は Ruby on Rails をベースにシステムを構築していました。
多くの言語で Rails にインスパイアされたフレームワークが作成されました。
しかし、Rails は決して万能なフレームワークではありませんでした。
Ruby でも多くのフレームワークが作成されました。
- Ramaze
- Sinatra
- Merb
この Merb と統合進化したのが Rails3 です。
Rails2 から Rails3 への方は
[http://t.co/RkbnwZ8C](http://assets.en.oreilly.com/1/event/40/The%20Rails%203%20Ropes%20Course%20Presentation.pdf)
%section
%h1 ハイカラワード
%ul
%li bundler by <span class="highlight">@dictav</span>
%li Rack by <span class="highlight">@dictav</span>
%li Sprockets by <span class="highlight">@dictav</span>
%li RSpec (BDD: Behavior Driven Development) by @jewel_x12
%li Cucumber by @kasacchiful
%li Capistrano by @sambaiz
%li Jenkins (CI: Continuous Integration) by @Nkzn and @saisa6153
%li unicorn by @neko_gata_s
%li <del>Heroku by @dictav</del>
%section
%h1 bundler
bundler はどうしても雑多になるgemファイルをアプリケーション毎に管理します。
%p
Gemfile
%pre
= preserve do
:plain
source :rubygems
gem 'rails'
%pre.code
$ bundle install --path DIR
%p
\.bundle/config
%pre
= preserve do
:plain
---
BUNDLE_PATH: DIR
BUNDLE_DISABLE_SHARED_GEMS: '1'
%pre.code
$ bundle exec rails new haikara
%pre.code
$ bundle exec rails g scaffold category name:string description:text
%section
%h1 Rack
Python の世界で WSGI (Web Server Gateway Interface) というインターフェースが作成されました。
%figure
%blockquote
Webフレームワークを選択することによって、使用できるWebサーバが制限されてしまったり、その逆の制限があったりしたためである。Pythonアプリケーションは、CGI, FastCGI, mod_python, さらにはWebサーバ独自のAPIを使ったもの、などのいずれかとして設計されることが多かった。
%figcaption
%a{ :href => "http://ja.wikipedia.org/wiki/Web_Server_Gateway_Interface#.E5.9F.BA.E6.9C.AC.E7.9A.84.E3.81.AA.E7.99.BA.E6.83.B3" } Wikipedia
これを Ruby の世界に持ってきたのが Rack です。
Rails3 は Rack アプリケーションとして実装されています。
このため、Rails3 は Webrick でも Mongrel でも Thin でも Passenger (Apache, nginx) でも移植の手間はありません。
%p
%a{href:"http://coderack.org"} CodeRack - RACK MIDDLEWARE DIRECTORY
%section
%h1 閑話休題 : lighttpd
%figure
%blockquote
lighttpd (ライトティーピーディー; "Lighty"とも呼ばれる)は高速性が重視される環境に最適化された、安全、高速で標準に準拠し、柔軟であることを指向して設計されたWebサーバソフトウェアである。
%figcaption
%a{href:"http://ja.wikipedia.org/wiki/Lighttpd"} Wikipedia
%section
%h1 Ready Assets on Rails : Sprockets
%p
Sprockets は Web Assets をコンパイル、提供する Rack アプリケーションです。
Web Assets
%ul
%li Sass, SCSS and LESS (require less.gem and libv8.gem)
%li CoffeeScript and JSX (require <a href="https://github.com/uu59/sprockets-jsx">sprockets-jsx</a>)
%li EJS and Eco
%section
%h1 Ready Assets on Rails : Sprockets
Supported Comment Type
%pre
:preserve
/* Multi-line comment blocks (CSS, SCSS, JavaScript)
*= require foo
*/
// Single-line comment blocks (SCSS, JavaScript)
//= require foo
# Single-line comment blocks (CoffeeScript)
#= require foo
%section
%h1 jQuery on Rails
%pre.code
<%= form_for(@post, :remote => true) do |f| %>
%pre
\=&gt; &lt;form action="/posts" class="new_post" data-remote="true" id="new_post" method="post"&gt;
HTML 5 custom data attributes
%ul
%li data-remote
%li data-method
%li data-confirm
%li data-disable-with
%section
%h1 jQuery on Rails
%div
application.js
%pre
:preserve
//= require jquery
//= require jquery_ujs
//= require_tree .
%div{style:"font-size:90%;"}
vendor/plugins/ruby/1.9.1/gems/jquery-rails-2.0.2/vendor/assets/javascripts/jquery_ujs.js
%pre
= preserve do
:escaped
// Handles "data-method" on links such as:
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
handleMethod: function(link) {
var href = rails.href(link),
method = link.data('method'),
target = link.attr('target'),
csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content'),
form = $('<form method="post" action="' + href + '"></form>'),
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
if (csrf_param !== undefined && csrf_token !== undefined) {
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
}
if (target) { form.attr('target', target); }
form.hide().append(metadata_input).appendTo('body');
form.submit();
},
%section
%h1 Formatic
%p
これ見るべし
%a{href:"http://railscasts.com/episodes/184-formtastic-part-1"} http://railscasts.com/episodes/184-formtastic-part-1
justinfrench / formtastic
%br
%a{href:"https://github.com/justinfrench/formtastic"}https://github.com/justinfrench/formtastic
  • 15:00 : ハイカラRails by @dictav (仮)
  • 15:20 : RSpec by @jewel_x12
  • 15:40 : Cucumber by @kasacchiful
  • 16:00 : Unicorn by @neko_gata_s
  • 16:20 : Javaプロダクトから見たJenkins by @Nkzn
  • 16:40 : Jenkins 報告 by @saisa6153
  • 17:00 : Capistrano by @sambaiz
  • 17:20 : LT
  • 17:40 : LT
  • 18:00 : 懇親会
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment