CSC/ECE 517 Fall 2013/ch1 1w28 nm: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:




===='''1. Install XCode or XCode command line tool.'''====
====''' Install XCode or XCode command line tool.'''====
For Mac OS X, the first thing we need to do is to install XCode which are the Apple Developer Tools.  
For Mac OS X, the first thing we need to do is to install XCode which are the Apple Developer Tools.  
XCode ships with Mac OS 10.6 i.e Snow Leopard.
XCode ships with Mac OS 10.6 i.e Snow Leopard.
Line 21: Line 21:
You can also install the XCode command line tool instead of the entire XCode developer tool.
You can also install the XCode command line tool instead of the entire XCode developer tool.


===='''2. Download git'''====
====''' Download git'''====


Git is an open source distributed version control system designed to handle everything, from small to large projects with speed and efficiency.  
Git is an open source distributed version control system designed to handle everything, from small to large projects with speed and efficiency.  
Line 38: Line 38:
     [cd git-1.8.3.2]$ git --version --This command will return the current version of git installed on the machine.
     [cd git-1.8.3.2]$ git --version --This command will return the current version of git installed on the machine.


===='''3. Ruby Version Manager'''====
====''' Ruby Version Manager'''====
The next step is to install Ruby Version Manager(RVM). This is an optional step.
The next step is to install Ruby Version Manager(RVM). This is an optional step.
All computers having Mac OS 10.6 and above have some version of ruby pre installed.  
All computers having Mac OS 10.6 and above have some version of ruby pre installed.  
Line 49: Line 49:
For all in one installation append --rails or --ruby or --ruby=1.9.3
For all in one installation append --rails or --ruby or --ruby=1.9.3


===='''4. Install Ruby'''====
====''' Install Ruby'''====


After installing RVM, you can install Ruby by using the following commands
After installing RVM, you can install Ruby by using the following commands
Line 61: Line 61:
     $ rvm install 1.9.2 -- installs ruby 1.9.2
     $ rvm install 1.9.2 -- installs ruby 1.9.2


===='''5. Install RubyGems'''====
====''' Install RubyGems'''====
If you want to use multiple versions of rails on the same machine,you need to create a separate gemset, which is a self contained bundles of gems, for each version.
If you want to use multiple versions of rails on the same machine,you need to create a separate gemset, which is a self contained bundles of gems, for each version.


Line 78: Line 78:
     $ sudo gem update --system
     $ sudo gem update --system


====6. '''Install Rails'''====
==== '''Install Rails'''====


The last step is to install rails. This can be done as follows:-
The last step is to install rails. This can be done as follows:-
Line 100: Line 100:


There are many ways in which one might want to set up a complete development environment for Ruby on Rails on a Windows machine. There are primarily two types of installations  
There are many ways in which one might want to set up a complete development environment for Ruby on Rails on a Windows machine. There are primarily two types of installations  
==='''1. Using Command Line Instructions'''===
===''' Using Command Line Instructions'''===
Here we are going to cover how to setup Rails on a Windows machine using Ruby, Ruby Gems and Rails.  
Here we are going to cover how to setup Rails on a Windows machine using Ruby, Ruby Gems and Rails.  


===='''1. Installing GIT'''====
====''' Installing GIT'''====
Installing Git on Windows is very simple. Simply download the installer exe file from the GitHub page, and run it:
Installing Git on Windows is very simple. Simply download the installer exe file from the GitHub page, and run it:
http://msysgit.github.com/
http://msysgit.github.com/
After it’s installed, you have both a command-line version (including an SSH client) and the standard GUI.
After it’s installed, you have both a command-line version (including an SSH client) and the standard GUI.


===='''2. Ruby Installation:'''====
====''' Ruby Installation:'''====
Download and install the latest final version of the Ruby installer (currently 1.8.6) from http://rubyforge.org/ .  
Download and install the latest final version of the Ruby installer (currently 1.8.6) from http://rubyforge.org/ .  


Continue with the installations with all the default settings. Make sure that Ruby is installed in a path which doesn’t contain any spaces. The default path selected by the installation wizard is c: //Ruby
Continue with the installations with all the default settings. Make sure that Ruby is installed in a path which doesn’t contain any spaces. The default path selected by the installation wizard is c: //Ruby


===='''3.''' '''Check Installation'''====
===='''''' '''Check Installation'''====
Once the installation is complete check that all the ruby commands are added to the file path. Open the command prompt and type
Once the installation is complete check that all the ruby commands are added to the file path. Open the command prompt and type


Line 125: Line 125:
If you get the “not recognized as an internal or external command” error, then set the path to the ruby bin directory (e.g. c:\ruby\bin) and try again.
If you get the “not recognized as an internal or external command” error, then set the path to the ruby bin directory (e.g. c:\ruby\bin) and try again.


===='''4. Update RubyGems'''====
====''' Update RubyGems'''====
The above installer also installs RubyGems package and SciTE editor as part of the installation process. But, the installed version of RubyGems may be a bit old(~0.9.4), so we need to update it to the latest available version.
The above installer also installs RubyGems package and SciTE editor as part of the installation process. But, the installed version of RubyGems may be a bit old(~0.9.4), so we need to update it to the latest available version.
     C:\> gem update ––system
     C:\> gem update ––system
Line 132: Line 132:
     C:\> gem –v  The lasts updated version will be displayed.
     C:\> gem –v  The lasts updated version will be displayed.


===='''5. Installing Rails'''====
====''' Installing Rails'''====
Once Ruby and RubyGems have been installed run the following command on the command prompt to install Ruby on Rails and all its dependencies.  
Once Ruby and RubyGems have been installed run the following command on the command prompt to install Ruby on Rails and all its dependencies.  


Line 148: Line 148:
The simple Rails development environment is now installed on the System with WEBrick as the web server, SQLite as the database server.
The simple Rails development environment is now installed on the System with WEBrick as the web server, SQLite as the database server.


==='''2. Using Windows Rails Installer'''===
===''' Using Windows Rails Installer'''===


1. Go to Rails Installer and download the Rails Installer executable.  
1. Go to Rails Installer and download the Rails Installer executable.  

Revision as of 15:42, 24 September 2013

Configuring rails environment for Linux and Mac OS X.



Since both Mac OSX and Linux are UNIX based systems, the process of configuring rails in Linux and Mac OSX is very similar .


Steps for configuring Rails:

Install XCode or XCode command line tool.

For Mac OS X, the first thing we need to do is to install XCode which are the Apple Developer Tools. XCode ships with Mac OS 10.6 i.e Snow Leopard. XCode can be installed from the Mac OS X install DVD or can be downloaded from https://developer.apple.com/xcode/. You can verify if the XCode has been installed correctly by going to the terminal and running the following command:

   gcc -v 

This command will check whether the required gcc compiler has been installed. You can also install the XCode command line tool instead of the entire XCode developer tool.

Download git

Git is an open source distributed version control system designed to handle everything, from small to large projects with speed and efficiency. Git allows you to have multiple branches that can be entirely independent of each other. The creation, merging and deletion of these development lines takes seconds. It allows you to switch between these branches with ease. If, at any time you feel that the branch is not required you can delete that branch and revert back to the previous branch. You can download git-1.8.3.2(tar.gz file) from http://git-scm.com/ Then execute the following commands from the terminal:-

   $ tar zxf git-1.8.3.2.tar.gz -- This command will extract the .tar file.
   $ cd git-1.8.3.2 -- This command will take the control into that directory.
   [cd git-1.8.3.2]$ make && sudo make install -- This command will compile and install git
   [cd git-1.8.3.2]$ git --version --This command will return the current version of git installed on the machine.

Ruby Version Manager

The next step is to install Ruby Version Manager(RVM). This is an optional step. All computers having Mac OS 10.6 and above have some version of ruby pre installed. Therefore it is good practice to install RVM to manage different version of Ruby of the same machine. This is particularly important if you want to run Rails3 and Rails2.3 on the same machine. You can download RVM from www.rvm.io. To install RVM, execute the following command in the terminal:-

   Install RVM with a Ruby: \curl -L https://get.rvm.io | bash -s stable

For all in one installation append --rails or --ruby or --ruby=1.9.3

Install Ruby

After installing RVM, you can install Ruby by using the following commands

   $ rvm update --head
   $ rvm reload

These commands will update and reload RVM as it is updated frequently.

   $ rvm install 1.8.7 --installs ruby 1.8.7
   $ rvm install 1.9.2 -- installs ruby 1.9.2

Install RubyGems

If you want to use multiple versions of rails on the same machine,you need to create a separate gemset, which is a self contained bundles of gems, for each version.

   $ rvm--create1.8.7-p174@rails2
   $ rvm--createuse1.9.2@rails3

Here the first command creates the gemset rails2 associated with Ruby1.8.7-p174, while the second command creates the gemset rails3 associated with Ruby1.9.2 and uses it at the same time.

You can download RubyGems and install them using them using the following command:

   $ sudo ruby setup.rb

If you already have RubyGems installed on your machine you can update it using the following command:-


   $ sudo gem update --system

Install Rails

The last step is to install rails. This can be done as follows:-

   $ gem install rails --version 3.2.13

It is possible to check whether rails is installed correctly or not using

   $ rails -v

This command should return the installed version of rails and will return an error if rails has not been installed correctly.



Configuring rails environment for Windows



There are many ways in which one might want to set up a complete development environment for Ruby on Rails on a Windows machine. There are primarily two types of installations

Using Command Line Instructions

Here we are going to cover how to setup Rails on a Windows machine using Ruby, Ruby Gems and Rails.

Installing GIT

Installing Git on Windows is very simple. Simply download the installer exe file from the GitHub page, and run it: http://msysgit.github.com/ After it’s installed, you have both a command-line version (including an SSH client) and the standard GUI.

Ruby Installation:

Download and install the latest final version of the Ruby installer (currently 1.8.6) from http://rubyforge.org/ .

Continue with the installations with all the default settings. Make sure that Ruby is installed in a path which doesn’t contain any spaces. The default path selected by the installation wizard is c: //Ruby

' 'Check Installation

Once the installation is complete check that all the ruby commands are added to the file path. Open the command prompt and type

   C:/> ruby –v

The above instruction will display the version of ruby installed.

Ruby
   C:/> gem –v
Version of installed Gem

The above instruction will display the version of gem installed.

If you get the “not recognized as an internal or external command” error, then set the path to the ruby bin directory (e.g. c:\ruby\bin) and try again.

Update RubyGems

The above installer also installs RubyGems package and SciTE editor as part of the installation process. But, the installed version of RubyGems may be a bit old(~0.9.4), so we need to update it to the latest available version.

   C:\> gem update ––system
Update Gems
   C:\> gem –v  The lasts updated version will be displayed.

Installing Rails

Once Ruby and RubyGems have been installed run the following command on the command prompt to install Ruby on Rails and all its dependencies.

   C:\> gem install rails - -include-dependencies
Installing Rails
   C:\> rails -v
Installed version of rails

If you want to update the version of Rails, just run the following commands

	C:\> gem update rails

The simple Rails development environment is now installed on the System with WEBrick as the web server, SQLite as the database server.

Using Windows Rails Installer

1. Go to Rails Installer and download the Rails Installer executable.

http://railsinstaller.org/en
Rails Installer


2. Double-click the executable and follow the instructions to install Git, Ruby, RubyGems, and Rails itself.


Setup Wizard


Agreement


Install


3. Once the installation is done, the environment is set up and ready for the first application.


Installation Complete

References:

</references>