Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rails Hands-on Seminar Ch01

Yohei Yasukawa
November 20, 2014

Rails Hands-on Seminar Ch01

Rails チュートリアル解説セミナー (第1章) の資料です。
本スライドを使った解説動画(スクリーンキャスト)もあるので是非 :)

Rails スクリーンキャスト
http://railstutorial.jp/screencasts

【関連リンク】
Rails 解説セミナー: http://railstutorial.jp/seminars
Rails チュートリアル: http://railstutorial.jp/
Rails ガイド: http://railsguides.jp/
RoR ビギナーズ倶楽部: http://ror-beginners.doorkeeper.jp/

Yohei Yasukawa

November 20, 2014
Tweet

More Decks by Yohei Yasukawa

Other Decks in Education

Transcript

  1. ং࿦ • RailsνϡʔτϦΞϧ͕ରԠ͍ͯ͠Δόʔδϣϯ • Rails 3.2/4.0 ͷҧ͍ • ࠓճ͸ Rails

    4.0 Λ࢖͍·͢ • RailsνϡʔτϦΞϧͷষߏ੒ • first_app: ୈ̍ষ • demo_app: ୈ̎ষ • sample_app: ୈ̏ষʙ࠷ޙ
  2. 1. IDE (౷߹։ൃ؀ڥ)
 - RadRails
 - RubyMine
 - Cloud9 (Ϋϥ΢υαʔϏε)

    2. ςΩετΤσΟλ + λʔϛφϧ
 - Sublime Text, TextMate, Atom
 - Vim, Emacs͋
 1.2.1 ։ൃ؀ڥ
  3. 1.2.1 ։ൃ؀ڥ • λʔϛφϧ
 - Mac: iTerm2, Terminal.app.
 - Linux:

    Terminal
 - Windows: Linux͕ಈ͘Ծ૝Ϛγϯ (Virtual BoxͳͲ)
 ɹɹɹɹɹ΋͘͠͸ɼRailsΠϯετʔϥ • ϒϥ΢β (※ Inspect elementػೳ͕͋Δ΋ͷ)
 - Google Chrome
 - Firefox
 - Safari
  4. Ruby/Railsͷߏ଄ Ruby 2.0.0-p643 RubyGems (ಉࠝ) rails (4.0.5) , bundler, pry,

    … ϥΠϒϥϦ (Gem) ΛΠϯετʔϧ͢Δ $ gem install rails --version 4.0.5
  5. Ruby 2.0.0-p643 Ruby/Railsͷߏ଄ RubyGems (ಉࠝ) rails (4.0.5) , bundler, pry,

    … rbenv ruby-build ruby ΛϏϧυ͢ΔϓϥάΠϯ $ rbenv install 2.0.0-p643 ruby Λ؅ཧ͢Δπʔϧ $ rbenv global 2.0.0-p643 ϥΠϒϥϦ (Gem) ΛΠϯετʔϧ͢Δ $ gem install rails --version 4.0.5
  6. Ruby 2.0.0-p643 Ruby/Railsͷߏ଄ RubyGems (ಉࠝ) rails (4.0.5) , bundler, pry,

    … rbenv ruby-build ruby ΛϏϧυ͢ΔϓϥάΠϯ $ rbenv install 2.0.0-p643 Ruby 1.9.3 Ruby 2.1.0 RubyGems (ಉࠝ) RubyGems (ಉࠝ) ϥΠϒϥϦ (Gem) ΛΠϯετʔϧ͢Δ $ gem install rails --version 4.0.5 ruby Λ؅ཧ͢Δπʔϧ $ rbenv global 2.0.0-p643
  7. Ruby 2.0.0-p643 Ruby/Railsͷߏ଄ RubyGems (ಉࠝ) rails (4.0.5) , bundler, pry,

    … ϥΠϒϥϦ (Gem) ΛΠϯετʔϧ͢Δ $ gem install rails --version 4.0.5 rbenv ruby-build ruby ΛϏϧυ͢ΔϓϥάΠϯ $ rbenv install 2.0.0-p643 Ruby 1.9.3 Ruby 2.1.0 RubyGems (ಉࠝ) RubyGems (ಉࠝ) rails 3.2 rails 4.2 ruby Λ؅ཧ͢Δπʔϧ $ rbenv global 2.0.0-p643
  8. 1. Linux ͷԾ૝؀ڥΛߏங͢Δ (Φεεϝ)
 - VMWare Player / Virtual Box͋


    - Ubuntu 14.04 LTS ೔ຊޠ൛
 - Linux ൛ͷηοτΞοϓΛݟΔ
 - http://railstutorial.jp/screencasts#ch01 2. Windows಺ʹRails։ൃ؀ڥΛߏங͢Δ (ඇਪ঑)
 - Rails Installer (Ruby 2.0 + Rails 4.0)͋
 - Heroku Toolbelt (Bash + Git + Heroku)͋ ηοτΞοϓͷखॱ
  9. 1. rbenvͱruby-buildΛΠϯετʔϧ (rvmͰ΋Մ)
 https://github.com/sstephenson/rbenv
 https://github.com/sstephenson/ruby-build 2. Ruby 2.0.0-p576 ΛΠϯετʔϧ: 


    - rbenv install 2.0.0-p576 3. Rails 4.0.5 ΛΠϯετʔϧ
 - gem install rails --version 4.0.5 4. Τϥʔ͕ग़ͨΒϥΠϒϥϦΛదٓΠϯετʔϧ
 ྫ: sudo apt-get libyaml-dev libxslt-dev libxml2-dev
 ྫ: libsqlite3-dev (֤Τϥʔ಺༰Ͱݕࡧ!) ηοτΞοϓͷखॱ
  10. 1. HomebrewͱඞཁͳϥΠϒϥϦΛΠϯετʔϧ
 - http://brew.sh/index_ja.html
 - brew install libtool libxslt libksba

    openssl libyaml 2. rbenvͱruby-buildΛΠϯετʔϧ
 - brew install rbenv ruby-build 3. Ruby 2.0.0-p576 ΛΠϯετʔϧ&ίϯύΠϧ
 - rbenv install 2.0.0-p576 4. RubyGems Ͱ Rails ΛΠϯετʔϧ
 - gem install rails --version 4.0.5 ηοτΞοϓͷखॱ
  11. 1. https://github.com/yasslab/ railstutorialjp_starter_kit ʹΞΫηε͢Δ 2. ʮຊπʔϧΛ࢖ͬͨ؀ڥߏஙͷखॱʯʹै͏ 3. Ruby 2.0.0-p576 ΛΠϯετʔϧ&ίϯύΠϧ


    - rbenv install 2.0.0-p576 4. RubyGems Ͱ Rails ΛΠϯετʔϧ
 - gem install rails --version 4.0.5 ηοτΞοϓͷखॱ
  12. 1. mkdir rails_projects; cd rails_projects 2. rails _4.0.5_ new first_app

    3. GemfileΛฤू 4. bundle install 5. rails server 6. http://localhost:3000 ʹΞΫηε 1.2.3 ࠷ॳͷΞϓϦέʔγϣϯ ϝϞ: ࠓճ͔Β͸ίʔυ෦΍
 ը૾ɾදΛத৺ʹਐΊ͍͖ͯ·͢
  13. ࠓޙͷਐΊํ • ൓ڹ͕͋ΔݶΓɼܧଓతʹ࣮ࢪ͍͖ͯ͠·͢. • ࠓޙͷεέδϡʔϧ͸ίνϥ
 → ৄࡉ: http://railstutorial.jp/seminars • εΫϦʔϯΩϟετͷൢചΛ։࢝͠·ͨ͠!


    → ৄࡉ: http://railstutorial.jp/screencasts • Ξϯέʔτͷ͝ճ౴ʹڠྗ͍ͩ͘͞
 ίϝϯτཝʹURLΛష෇͚·͢ :-)
 ※ Ξϯέʔτʹճ౴Λૹ৴͢Δͱ,
 ɹಛయಈըͷ৘ใ͕දࣔ͞Ε·͢.