Set up Ruby
List
Install Ruby for Windows
My Env
- Windows 7 x64
- Ruby 2.0
Download from Web
In windows, RubyInstaller is available, this is easy to install Ruby.
After downloading, just click rubyinstaller-x.x-pxxx.exe(in case of x64, please select x64)
Check second, add PATH is useful for us.
Check
Check whether the installation succeeds or not
Open command prompt(cmd.exe)
ruby -v
Ruby version shows up.
Let’s start Ruby programming.
Install Rails for Windows
Install Devkit
Rails require Devkit and its PATH
Devkit is toolset. Maybe, create folder under c:\Devikit and extract Devkit-sxf.exe under it
And this path to PATH
Install Devkit
Go Devkit folder and type
This is initialization
ruby dk.rb init
Next is install
ruby dk.rb install
Skip install doc
Add some setting for gem.
By default, gem installs all documentation. That takes a lot of time.:x
To skip install doc, create .gemrc file under c:Users\<username>(Windows 7)
install: --no-ri --no-rdoc update: --no-ri --no-rdoc
Ruby reads this file and set gem setting
Install Rails using gem
Type following command under cmd.exe
gem install rails
If there are no error, works fine.
Check
Type
rails -v
Rails version should be shown
First Rails Applicatio
In my opinion, please create new folder for Rails
Create new application
rails new applicationname
applicationname is your application name.(No rules)
rails new command create Rails Application set(files)
※If you want to use mysql(Default database is sqlite3, which is installed under Ruby)
Type this
rails new applicationname -d mysql
Start Application
Go Application folder and type
rails s
Ruby has WEBrick server for development. This command invokes WEBRick server
By default, port is 3000
Verify
Access http://localhost:3000
※If you use x64 version, sqlite3 error has occured
By default rails use 32bit sqlite3 version by default
Please open Gemfile.lock and edit
sqlite3(1.3.8)
1.3.8 is your version in Ruby
To fix, installation version(require gems) Try it!
bundle install
Stop Rails Application
Ctrl + S
Rails with Eclipse
Install Eclipse and Install Aptana
Install Eclipse is very straight.
Next is Aptana. Aptana is web development useful plugin(Rails, Python, PHP, JavaScript).
“Help” -> “Install New Software”
Access Aptana web site and find Aptana plugin URL
Add new repository and type URL
Start install and restart eclipse
Create new Application
Let’s make new application from Eclipse
“File” -> “Others” -> “Rails Project”
After that, input Project name and location setting.
Rails new command starts automatically, and create new Rails Application.
At the bottom, Rails console opens and you can input rails command in here.