InstallRailsWindows2 » 履歴 » バージョン 2
Yuumi Yoshida, 2015-08-03 22:24
| 1 | 2 | Yuumi Yoshida | # Ruby on Rails 開発環境の作り方(Windows) |
|---|---|---|---|
| 2 | 1 | Yuumi Yoshida | |
| 3 | _2015/06/30更新_ |
||
| 4 | |||
| 5 | |||
| 6 | 2 | Yuumi Yoshida | ## WindowsPCの仕様 |
| 7 | |||
| 8 | 1 | Yuumi Yoshida | * メモリー : 1Gbyte以上 |
| 9 | * ディスク空き容量: 500Mbyte以上 |
||
| 10 | * CPUの性能: 制限はありませんが、ここ3年以内に作られたPCが望ましい |
||
| 11 | * OS: Windows 7, 8 |
||
| 12 | |||
| 13 | 2 | Yuumi Yoshida | ## インストール |
| 14 | 1 | Yuumi Yoshida | |
| 15 | |||
| 16 | 2 | Yuumi Yoshida | ### 1. Ruby |
| 17 | 1 | Yuumi Yoshida | |
| 18 | |||
| 19 | 2 | Yuumi Yoshida | http://rubyinstaller.org/ のDownload ページから **Ruby 2.2.2** をダウンロドし、実行して下さい。 |
| 20 | 1 | Yuumi Yoshida | |
| 21 | |||
| 22 | 2 | Yuumi Yoshida | 1. 最初の画面でライセンスに同意(I accept the License) |
| 23 | 1. 次の画面でインストル先とオプションを選択します。 |
||
| 24 | * インストル先は C:\Ruby や D:\Ruby にして下さい。 |
||
| 25 | * Add Ruby excutables to your PATH をチェックして下さい |
||
| 26 |  |
||
| 27 | 1. Installボタンを押す |
||
| 28 | 1 | Yuumi Yoshida | |
| 29 | 2 | Yuumi Yoshida | ### 2. DEVELOPMENT KIT |
| 30 | |||
| 31 | 1 | Yuumi Yoshida | OSに依存したライブラリーをWindows環境にインストールする為のツールもインストールします |
| 32 | |||
| 33 | |||
| 34 | 2 | Yuumi Yoshida | http://rubyinstaller.org/ のDownload ページから **DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe** をダウンロドし、実行して下さい。 |
| 35 | |||
| 36 | |||
| 37 | 1 | Yuumi Yoshida | ファイルを展開するディレクトリーを入力するダイアログが表示されるので、1.で指定したRubyのインストール先に DevKitディレクトリーを作成し (例 C:\Ruby\DevKit) を指定して下さい。 |
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | 2 | Yuumi Yoshida | ### 3. Rubyの確認とDEVELOPMENT KITのインストール作業 |
| 42 | |||
| 43 | 1 | Yuumi Yoshida | コマンドプロンプトを起動し ruby -v を実行し、以下のように表示されればOKです。 |
| 44 | 2 | Yuumi Yoshida | |
| 45 | ~~~ |
||
| 46 | 1 | Yuumi Yoshida | C:\>ruby -v |
| 47 | ruby 2.2.2p95 .... |
||
| 48 | 2 | Yuumi Yoshida | ~~~ |
| 49 | 1 | Yuumi Yoshida | |
| 50 | 次に、DEVELOPMENT KITのインストール作業をコマンドプロンプトで行います。 |
||
| 51 | 2 | Yuumi Yoshida | |
| 52 | ~~~ |
||
| 53 | 1 | Yuumi Yoshida | C:\> cd \Ruby\DevKit |
| 54 | |||
| 55 | C:\Ruby200\DevKit> ruby dk.rb init |
||
| 56 | [INFO] found RubyInstaller v2.2.2 at C:/Ruby |
||
| 57 | ..... |
||
| 58 | |||
| 59 | C:\Ruby200\DevKit> ruby dk.rb install |
||
| 60 | [INFO] Installing 'C:/Ruby/lib/ruby/site_ruby/2.2.2/rubygems/defaults/operating_system.rb' |
||
| 61 | ..... |
||
| 62 | |||
| 63 | 2 | Yuumi Yoshida | ~~~ |
| 64 | 1 | Yuumi Yoshida | |
| 65 | |||
| 66 | 2 | Yuumi Yoshida | ### 4. Ruby on Rails のインストール |
| 67 | 1 | Yuumi Yoshida | |
| 68 | 引き続きコマンドプロンプトで、gemコマンドの更新を行います。 |
||
| 69 | 2 | Yuumi Yoshida | |
| 70 | 1 | Yuumi Yoshida | 次に Ruby on Railsをインストールします。 ある程度時間がかかります。 |
| 71 | |||
| 72 | 2 | Yuumi Yoshida | |
| 73 | ~~~ |
||
| 74 | 1 | Yuumi Yoshida | C:\> gem update --system -N |
| 75 | ... |
||
| 76 | |||
| 77 | C:\> gem install bundler -N |
||
| 78 | ... |
||
| 79 | |||
| 80 | C:\> gem install rspec -N |
||
| 81 | ... |
||
| 82 | |||
| 83 | C:\>gem install rails -N |
||
| 84 | .... |
||
| 85 | |||
| 86 | 2 | Yuumi Yoshida | ~~~ |
| 87 | 1 | Yuumi Yoshida | |
| 88 | Ruby on Rails の確認、以下のように表示されればOKです。 |
||
| 89 | 2 | Yuumi Yoshida | |
| 90 | ~~~ |
||
| 91 | 1 | Yuumi Yoshida | C:\> rails -v |
| 92 | Rails 4.2.3 |
||
| 93 | 2 | Yuumi Yoshida | ~~~ |
| 94 | 1 | Yuumi Yoshida | |
| 95 | 2 | Yuumi Yoshida | **DL is deprecated, please use Fiddle** という警告が表示されますが、問題ありません。 |
| 96 | 1 | Yuumi Yoshida | |
| 97 | |||
| 98 | 2 | Yuumi Yoshida | ### 5. 関連ライブラリーのインストール |
| 99 | |||
| 100 | 1 | Yuumi Yoshida | Ruby on Railsでは初めてプロジェクトを作った際に関連するライブラリーがインストールされるので、一度ダミーのプロジェクトを作成します。 |
| 101 | |||
| 102 | 2 | Yuumi Yoshida | |
| 103 | ~~~ |
||
| 104 | 1 | Yuumi Yoshida | C:\> cd C:\temp |
| 105 | C:\temp> rails new dummy |
||
| 106 | create |
||
| 107 | create README.rdoc |
||
| 108 | create Rakefile |
||
| 109 | |||
| 110 | ... |
||
| 111 | |||
| 112 | Your bundle is complete! |
||
| 113 | Use `bundle show [gemname]` to see where a bundled gem is installed. |
||
| 114 | 2 | Yuumi Yoshida | ~~~ |
| 115 | 1 | Yuumi Yoshida | |
| 116 | |||
| 117 | 削除出来たら、ダミーのプロジェクトは削除してしまってかまいません。 |
||
| 118 | |||
| 119 | |||
| 120 | |||
| 121 | 2 | Yuumi Yoshida | ### エディター |
| 122 | |||
| 123 | 1 | Yuumi Yoshida | https://github.com/atom/atom |
| 124 | |||
| 125 | 2 | Yuumi Yoshida | |
| 126 | 1 | Yuumi Yoshida | Download the latest AtomSetup.exe installer. |
| 127 | |||
| 128 | |||
| 129 | 2 | Yuumi Yoshida | ### その他. |
| 130 | |||
| 131 | 1 | Yuumi Yoshida | 多数の PCにインストールする場合、 |
| 132 | |||
| 133 | 2 | Yuumi Yoshida | |
| 134 | 1 | Yuumi Yoshida | 1台で上の作業を行った後、C:\Ruby ディレクトリーを他のPCにコピーし、環境変数 Path に C:\Ruby\bin を追加すれば、他のPCでもRuby on Rails使えるようになります。 |
| 135 | |||
| 136 | |||
| 137 | 2 | Yuumi Yoshida | ### sqlite3, nokogiri |
| 138 | |||
| 139 | 1 | Yuumi Yoshida | C:\Ruby\DevKit\mingw\bin\gcc -O2 -shared -o sqlite3.dll -Wl,--out-implib=libsqlite3.dll.a sqlite |
| 140 | 2 | Yuumi Yoshida | |
| 141 | 1 | Yuumi Yoshida | 3.c |
| 142 | |||
| 143 | 2 | Yuumi Yoshida | |
| 144 | 1 | Yuumi Yoshida | C:\Ruby\DevKit\mingw\bin\gcc -O2 -o sqlite3.exe shell.c libsqlite3.dll.a |
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | 2 | Yuumi Yoshida | gem install sqlite3 ~~-platform=ruby -~~ --with-sqlite3-include=C:/temp/sqlite3 --with-sqlite3-lib=C:/temp/sqlite3 |
| 149 | 1 | Yuumi Yoshida | |
| 150 | |||
| 151 | 2 | Yuumi Yoshida | gem install nokogiri ~~-platform=ruby -~~ --use-system-libraries --with-iconv-include=C:/temp/include --with-iconv-lib=C:/temp/lib --with-xml2-include=C:/temp/include/libxml --with-xml2-lib=C:/temp/lib --with-xslt-include=C:/temp/include --with-xslt-lib=C:/temp/lib |
| 152 | |||
| 153 | |||
| 154 | ### nodejs |
||
| 155 | |||
| 156 | 1 | Yuumi Yoshida | node.js -> C:\Ruby\nodejs |
| 157 | 2 | Yuumi Yoshida | |
| 158 | 1 | Yuumi Yoshida | |
| 159 | |||
| 160 | PATH C:\Ruby\nodejs\;C:\Ruby\bin; |