InstallRailsWindows » 履歴 » バージョン 98
Yuumi Yoshida, 2017-03-28 10:35
| 1 | 95 | Yuumi Yoshida | # Ruby on Rails 開発環境の作り方(Windows 10) |
|---|---|---|---|
| 2 | 1 | Yuumi Yoshida | |
| 3 | 95 | Yuumi Yoshida | *2016/07/11更新* |
| 4 | 1 | Yuumi Yoshida | |
| 5 | 95 | Yuumi Yoshida | ## WindowsPCの仕様 |
| 6 | 1 | Yuumi Yoshida | |
| 7 | 95 | Yuumi Yoshida | * メモリー : 4Gbyte以上 |
| 8 | * ディスク空き容量: 500Mbyte以上 |
||
| 9 | * CPUの性能: 制限はありませんが、ここ3年以内に作られたPCが望ましい |
||
| 10 | * OS: Windows 10, 7(未確認), 8(未確認) |
||
| 11 | 1 | Yuumi Yoshida | |
| 12 | 95 | Yuumi Yoshida | ## インストール |
| 13 | 1 | Yuumi Yoshida | |
| 14 | 95 | Yuumi Yoshida | ### 1. Ruby |
| 15 | 1 | Yuumi Yoshida | |
| 16 | 95 | Yuumi Yoshida | http://rubyinstaller.org/ のDownload ページから **Ruby 2.2.4** をダウンロドし、実行して下さい。 |
| 17 | 83 | Yuumi Yoshida | |
| 18 | 95 | Yuumi Yoshida | * 最初の画面でライセンスに同意(I accept the License) |
| 19 | * 次の画面でインストル先とオプションを選択します。 |
||
| 20 | * インストル先は C:\Ruby22 や D:\Ruby22 にして下さい。 |
||
| 21 | * Add Ruby excutables to your PATH をチェックして下さい |
||
| 22 | 1 | Yuumi Yoshida | |
| 23 | 98 | Yuumi Yoshida |  |
| 24 | 83 | Yuumi Yoshida | |
| 25 | 95 | Yuumi Yoshida | * Installボタンを押す |
| 26 | 83 | Yuumi Yoshida | |
| 27 | 95 | Yuumi Yoshida | ### 2. DEVELOPMENT KIT |
| 28 | 1 | Yuumi Yoshida | |
| 29 | 95 | Yuumi Yoshida | OSに依存したライブラリーをWindows環境にインストールする為のツールもインストールします |
| 30 | 83 | Yuumi Yoshida | |
| 31 | 95 | Yuumi Yoshida | http://rubyinstaller.org/ のDownload ページから **DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe** をダウンロドし、実行して下さい。 |
| 32 | 1 | Yuumi Yoshida | |
| 33 | 95 | Yuumi Yoshida | ファイルを展開するディレクトリーを入力するダイアログが表示されるので、1.で指定したRubyのインストール先に DevKitディレクトリーを作成し (例 C:\Ruby22\DevKit) を指定して下さい。 |
| 34 | 1 | Yuumi Yoshida | |
| 35 | 95 | Yuumi Yoshida | ### 3. Rubyの確認とDEVELOPMENT KITのインストール作業 |
| 36 | 93 | Yuumi Yoshida | |
| 37 | 95 | Yuumi Yoshida | コマンドプロンプトを起動し ruby -v を実行し、以下のように表示されればOKです。 |
| 38 | 1 | Yuumi Yoshida | |
| 39 | |||
| 40 | 95 | Yuumi Yoshida | ``` |
| 41 | C:\>ruby -v |
||
| 42 | ruby 2.2.4p230 .... |
||
| 43 | ``` |
||
| 44 | 1 | Yuumi Yoshida | |
| 45 | 95 | Yuumi Yoshida | 次に、DEVELOPMENT KITのインストール作業をコマンドプロンプトで行います。 |
| 46 | 1 | Yuumi Yoshida | |
| 47 | 95 | Yuumi Yoshida | ``` |
| 48 | C:\> cd \Ruby22\DevKit |
||
| 49 | 84 | Yuumi Yoshida | |
| 50 | 95 | Yuumi Yoshida | C:\Ruby200\DevKit> ruby dk.rb init |
| 51 | [INFO] found RubyInstaller v2.2.4 at C:/Ruby22 |
||
| 52 | ..... |
||
| 53 | 1 | Yuumi Yoshida | |
| 54 | 95 | Yuumi Yoshida | C:\Ruby200\DevKit> ruby dk.rb install |
| 55 | [INFO] Installing 'C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/defaults/operating_system.rb' |
||
| 56 | ..... |
||
| 57 | 92 | Yuumi Yoshida | |
| 58 | 95 | Yuumi Yoshida | ``` |
| 59 | 1 | Yuumi Yoshida | |
| 60 | 95 | Yuumi Yoshida | ### 4. Ruby on Rails のインストール |
| 61 | 1 | Yuumi Yoshida | |
| 62 | 95 | Yuumi Yoshida | 引き続きコマンドプロンプトで、gemコマンドの更新を行います。 |
| 63 | 次に Ruby on Railsをインストールします。 ある程度時間がかかります。 |
||
| 64 | 84 | Yuumi Yoshida | |
| 65 | 92 | Yuumi Yoshida | |
| 66 | 95 | Yuumi Yoshida | ``` |
| 67 | C:\> gem update --system -N |
||
| 68 | ... |
||
| 69 | 92 | Yuumi Yoshida | |
| 70 | 95 | Yuumi Yoshida | C:\> gem install bundler -N |
| 71 | ... |
||
| 72 | 69 | Yuumi Yoshida | |
| 73 | 95 | Yuumi Yoshida | C:\> gem install rspec -N |
| 74 | ... |
||
| 75 | 92 | Yuumi Yoshida | |
| 76 | 95 | Yuumi Yoshida | C:\>gem install rails -N |
| 77 | .... |
||
| 78 | 92 | Yuumi Yoshida | |
| 79 | 95 | Yuumi Yoshida | ``` |
| 80 | 92 | Yuumi Yoshida | |
| 81 | 95 | Yuumi Yoshida | Ruby on Rails の確認、以下のように表示されればOKです。 |
| 82 | 92 | Yuumi Yoshida | |
| 83 | 95 | Yuumi Yoshida | ``` |
| 84 | C:\> rails -v |
||
| 85 | Rails 5.0.0 |
||
| 86 | ``` |
||
| 87 | 92 | Yuumi Yoshida | |
| 88 | |||
| 89 | 95 | Yuumi Yoshida | ### 5. 関連ライブラリーのインストール |
| 90 | 1 | Yuumi Yoshida | |
| 91 | 95 | Yuumi Yoshida | Ruby on Railsでは初めてプロジェクトを作った際に関連するライブラリーがインストールされるので、一度ダミーのプロジェクトを作成します。 |
| 92 | 92 | Yuumi Yoshida | |
| 93 | 72 | Yuumi Yoshida | |
| 94 | 95 | Yuumi Yoshida | ``` |
| 95 | C:\> cd C:\temp |
||
| 96 | C:\temp> rails new dummy |
||
| 97 | create |
||
| 98 | create README.rdoc |
||
| 99 | create Rakefile |
||
| 100 | 72 | Yuumi Yoshida | |
| 101 | 95 | Yuumi Yoshida | ... |
| 102 | 69 | Yuumi Yoshida | |
| 103 | 95 | Yuumi Yoshida | Your bundle is complete! |
| 104 | Use `bundle show [gemname]` to see where a bundled gem is installed. |
||
| 105 | ``` |
||
| 106 | 78 | Yuumi Yoshida | |
| 107 | 95 | Yuumi Yoshida | 削除出来たら、ダミーのプロジェクトは削除してしまってかまいません。 |
| 108 | 78 | Yuumi Yoshida | |
| 109 | 92 | Yuumi Yoshida | |
| 110 | 95 | Yuumi Yoshida | ### 6. Node.js のインストール |
| 111 | 1 | Yuumi Yoshida | |
| 112 | Ruby on RailsはJavaScriptの処理でJavaScriptの実行環境が必要になりますので、Node.jsをインストールする必要があります。 |
||
| 113 | 90 | Yuumi Yoshida | |
| 114 | 92 | Yuumi Yoshida | |
| 115 | 91 | Yuumi Yoshida | https://nodejs.org/download/ から、Windows環境に応じ32bitまたは64bitの `Windows Installer (.msi)` をダウンロードしインストールして下さい。 |
| 116 | 92 | Yuumi Yoshida | |
| 117 | インストール時にNode.js環境がPATH環境変数に追加されるので、 **既に開いていたコマンドプロンプトは閉じて、新たにコマンドプロンプトを実行して下さい。** |
||
| 118 | |||
| 119 | |||
| 120 | 95 | Yuumi Yoshida | ### 7. エディター |
| 121 | 90 | Yuumi Yoshida | |
| 122 | Ruby on Railsのプログラミングでは複数のファイルを編集しながら作業しますので、複数のファイルが編集しやすいエディターを使って下さい。 |
||
| 123 | 92 | Yuumi Yoshida | |
| 124 | |||
| 125 | 95 | Yuumi Yoshida | オープンソースで高機能なプログラミング用エディター [Atom](https://atom.io) , [Visual Studio Code](https://www.visualstudio.com/ja-jp/products/code-vs.aspx) がお勧めです。 |
| 126 | |||
| 127 | ### その他. |
||
| 128 | |||
| 129 | 多数の PCにインストールする場合、 |
||
| 130 | |||
| 131 | 1台で上の作業を行った後、C:\Ruby22 ディレクトリーを他のPCにコピーし、環境変数 Path に C:\Ruby22\bin を追加すれば、他のPCでもRuby on Rails使えるようになります。 |