akio-freelanceの日記

神奈川県在住のフリーランスエンジニアです。

Ruby on Railsのアプリケーションの作成と動作確認

久し振りの更新です。

普段は仕事で忙しいのでマイペースで学習しています。

 

インストールからサンプルアプリケーションの作成です。

 

作業ディレクト

D:\dev\work

 

テスト用アプリケーション名

TestApp

 1.テスト用アプリケーションの作成

コマンドプロンプトから

cd D:\dev\work

rails new TestApp

この後、コマンドプロンプトに戻るまでしばらく時間が掛かる。

 

2.サーバの実行

cd TestApp

rails server

また起動に時間がかかる。

 

3.動作確認

ブラウザで以下のURLを確認する。

http://localhost:3000

 

以下の画面が出ればOK

f:id:akiofreelance:20170220005819p:plain

 

バージョンはインストール時のバージョンのため差異があります。

 

4.サーバの停止

サーバを起動したコマンドプロンプトでCtrl+cキーを押すと「バッチ ジョブを終了しますか (Y/N)?」と聞くのでyキーを押して終了

 

次回は簡単なプログラムを作成したいと思います。

 

Ruby on Railsの開発環境構築

本日は環境構築しました。

対象環境

OS:windows10 64bit

CPU:Core i7 6700HQ

メモリ:16GB

 

ruby のイントール
https://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.6-x64.exe

インストーラーに従ってインストール

オプションは以下
Rubyの実行ファイルへ環境変数PATHを設定する。→オン
.rbと.rbwファイルをRubyへ関連付ける。→オン


devkitのダウンロード

以下のURLからダウンロード

https://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

解凍後にc:\Ruby22-x64\devkitに移動

 

Rubyの初期化

C:\Users\abcd>cd c:\Ruby22-x64\devkit

c:\Ruby22-x64\devkit>ruby dk.rb init
[INFO] found RubyInstaller v2.2.6 at C:/Ruby22-x64

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

c:\Ruby22-x64\devkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby22-x64'
[INFO] Installing 'C:/Ruby22-x64/lib/ruby/site_ruby/devkit.rb'

 

Railsのインストール

c:\Ruby22-x64\devkit>gem install rails
Fetching: concurrent-ruby-1.0.4.gem (100%)
Successfully installed concurrent-ruby-1.0.4
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
--------------- 中略 ---------------
Parsing documentation for rails-5.0.1
Installing ri documentation for rails-5.0.1
Done installing documentation for concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, mini_portile2, nokogiri, rails-dom-testing, loofah, rails-html-sanitizer, erubis, builder, actionview, rack, rack-test, actionpack, sprockets, sprockets-rails, bundler, method_source, thor, railties, websocket-extensions, websocket-driver, nio4r, actioncable, globalid, activejob, mime-types-data, mime-types, mail, actionmailer, arel, activemodel, activerecord, rails after 191 seconds
36 gems installed

 

RubyRailsのバージョン確認

ruby

c:\Ruby22-x64\devkit>ruby -v
ruby 2.2.6p396 (2016-11-15 revision 56800) [x64-mingw32]

rails

c:\Ruby22-x64\devkit>rails -v
Rails 5.0.1

c:\Ruby22-x64\devkit>

 

IDE環境構築
IDE環境はVisual Studio Code

https://code.visualstudio.com/download

windows版をダウンロード

その後、インストーラーを実行

インストーラー通りにインストール

 

本日はここまで、次回は簡単な簡単なプログラムを作成

 

ブログを始めます。

神奈川県内在住のフリーランスのITエンジニアです。

これからruby on railsの学習の記録を書きます。

 他にもjavaとかC言語の事を書ければと思います。

日常の事もたまには記録したいです。

 

 次回は環境構築の事を書きます。