winodws7のruby2でrails4を遊ぶ環境を作るのだ。

17
Windows 7 (x64) において Ruby 2.0.0 (x64) による rails4.1.4 を遊ぶ環境を作りたいのだ 公立大学 産業技術大学院大学 産業技術研究科 創造技術専攻 M2 / 斉藤之雄 スライド公開日:2014年8月1日

Upload: -office-saitoh

Post on 27-May-2015

321 views

Category:

Education


6 download

DESCRIPTION

Winodws7のRuby2でRails4を遊ぶ環境を作るのだ。

TRANSCRIPT

Page 1: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

Windows 7 (x64) においてRuby 2.0.0 (x64) によるrails4.1.4 を遊ぶ環境を作りたいのだ

公立大学 産業技術大学院大学 産業技術研究科

創造技術専攻 M2 / 斉藤之雄

スライド公開日:2014年8月1日

Page 2: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

学校の図書館にある書籍は Ruby 1.8 か 1.9.1 ばかり。だから、次のように意思決定した。

復習や基礎から学ぶのは大事だ。しかし、1.9.3 か x64 に対応した参考資料があれば・・・。

無いなら、図書館リクエスト(夏休みがあるので3ヶ月後か)するしかないかな。

いやいや、人柱になって自分でやってみた結果を備忘録メモ的な公開スライドで、ええんちゃうかな。全部入り PaaS使うなら別。

Page 3: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

まずは、準備やな。

前提書くのを忘れていた。このスライドは → のようなWindows 7 Ultimate SP1(x64) で書き上げた。

情報アーキテクチャー専攻ではないのでマシンのスペックはあまり気にしていない。これ買ったのはもう4年以上も前。

Page 4: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

それと、このスライドは超初志者の救済資料でもない。

ずばり、これは備忘録。

AIIT創造技術専攻 M2 のオッサン学生が、PBL 2Q においてソフトウェア・プロトタイプの独り(ぼっち)スプリントを好き好んで遊んで実施したもの。追々、PTメンバーへスキルトランスファ予定。

(ちなみに環境作るのに、資料起こしながらザックリ 4h 程度)

Page 5: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

用意は、いいですか?

【お願い】著者はヲタクを拗らせたそこらにいる馬鹿なのでインスコという表記はすべて「インストール」と読み替えてください。

Page 6: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

Ruby 2.0.0-p481-x64 インスコ済み(チェックボックス3つは有効のもと)、コマンドプロンプトは gem install rails 投入済み。

■インストーラ(x64)とDevkit (x64)入手先:http://rubyinstaller.org/downloads/

Page 7: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

DevKit は次のコマンドを投入しておく。作業的にちょっと前後してもいい。

>cd devkit

>ruby –v>ruby dk.rb init ← 必須>ruby db.rb install>gem install rails ← 必須>rails –v>gem update –system ←必須.gem update rake ← 必須

Page 8: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

コマンドプロンプトから適当なディテクトリで rails new hoge でも叩いておく。

例:>cd c:¥>mkdir hoge1>cd hoge1

>rails new hoge

以下、rails 環境がcreate されていく。

Page 9: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

Rails コマンドで自動生成されたスケルトン。¥app, ¥bin, ¥config, ¥db¥, lib¥, ¥log, ¥public, ¥test, ¥tmp, ¥vendor 等

Page 10: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

以降は、heroku を使う想定で準備のみ

用意は、いいですか?

【お願い】heroku レクチャーについては資料が山のように本屋やネットにあるのでご自身で探してみて、遊んでください。

Page 11: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

Git インスコ(Simple context menu, from command, Windows-style)

http://msysgit.github.io/https://github.com/msysgit/msysgit/releases/download/Git-1.9.4-preview20140611/Git-1.9.4-preview20140611.exe

Page 12: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

Heroku toolbelt インスコ / Full Installationhttps://toolbelt.heroku.com/

Page 13: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

Aptana Studio 3.4.2インスコ / Eclipse 3.5以降(互換含め)持ってない前提http://www.aptana.com/products/studio3/download

Page 14: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

IDE (統合開発環境, Eclipse 含む)で開発するよりも、LL言語はコンソールを叩くのが楽ちん。そこで、 Rails 引数一覧を紹介。 1/3

Usage:rails new APP_PATH [options]

Options:-r, [--ruby=PATH] # Path to the Ruby binary of your choice

# Default: C:/Ruby200-x64/bin/ruby.exe-m, [--template=TEMPLATE] # Path to some application template (can be a

filesystem path or URL)[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile

-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install-G, [--skip-git], [--no-skip-git] # Skip .gitignore file

[--skip-keeps], [--no-skip-keeps] # Skip source control .keep files-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files-V, [--skip-action-view], [--no-skip-action-view] # Skip Action View files-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files

[--skip-spring], [--no-skip-spring] # Don't install Spring application preloader-d, [--database=DATABASE] # Preconfigure for selected database (options:

mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)

# Default: sqlite3

Page 15: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

IDE (統合開発環境, Eclipse 含む)で開発するよりも、LL言語はコンソールを叩くのが楽ちん。そこで、 Rails 引数一覧を紹介。 2/3

-j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library# Default: jquery

-J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files[--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails

checkout[--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails

repository-T, [--skip-test-unit], [--no-skip-test-unit] # Skip Test::Unit files

[--rc=RC] # Path to file containing extra configuration options for rails command

[--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file

Runtime options:-f, [--force] # Overwrite files that already exist-p, [--pretend], [--no-pretend] # Run but do not make any changes-q, [--quiet], [--no-quiet] # Suppress status output-s, [--skip], [--no-skip] # Skip files that already exist

Page 16: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

IDE (統合開発環境, Eclipse 含む)で開発するよりも、LL言語はコンソールを叩くのが楽ちん。そこで、 Rails 引数一覧を紹介。 3/3

Rails options:-h, [--help], [--no-help] # Show this help message and quit-v, [--version], [--no-version] # Show Rails version number and quit

Description:The 'rails new' command creates a new Rails application with a defaultdirectory structure and configuration at the path you specify.

You can specify extra command-line arguments to be used every time'rails new' runs in the .railsrc configuration file in your home directory.

Note that the arguments specified in the .railsrc file don't affect thedefaults values shown above in this help message.

Example:rails new ~/Code/Ruby/weblog

This generates a skeletal Rails installation in ~/Code/Ruby/weblog.See the README in the newly created application to get going.

Page 17: Winodws7のruby2でrails4を遊ぶ環境を作るのだ。

とりあえずのまとめ

環境さえ作っておけば、あとは本を見ながらの写経的コマンド入力や、ネットで検索し表示された内容を、as is コピペで動作確認できるよ。

環境作るのが面倒だ!って方にはPaaS で Cloud IDE や heroku など。NTTcom Cloud n PaaS などもオススメ。