13 June 2012

Installing Ruby on Mac OS

STEP 1 Installing XCode


Please install XCode + Developer Tools from the App Center.
XCode is needed to install the Developer tools used in compilation of the Ruby packages for installation on the system.

STEP 2 Install RVM


Install RVM using the command
  • curl -L get.rvm.io | bash -s stable
This will install RVM on your system.
Please close and open the terminal again to load RVM.
To verify the RVM installation , open Terminal and type
  • rvm requirements
This will show a help doc.

Step 3 Installing required RVM packages before installing Ruby


Open Terminal and run the below mentioned commands one after the another
  • rvm pkg install zlib
  • rvm pkg install openssl
  • rvm pkg install iconv
  • rvm pkg install readline
  • rvm pkg install autoconf

Step 4 Installing Ruby


Open the Terminal and type the following command
  • rvm install 1.8.7 --with-gcc=clang
Here 1.8.7 reflects the Ruby version 1.8.7 and the latest patch, so to install any specific version or path you specify it by altering the above mentioned command eg.
  • rvm install 1.8.7-p334 --with-gcc=clang
  • rvm install 1.9.3 -C --with-gcc=clang

Step 5 Verify the installation


Open a new Terminal window and type
  • rvm list This will display the list of the different rubies installed on the system.
    To use a specific Ruby version use the following command
  • rvm use 1.8.7
  • rvm use 1.8.7-p334
  • rvm use 1.9.3 To make a Ruby version default for the system use the command
  • rvm alias create default 1.8.7
  • rvm alias create default 1.8.7-p334
  • rvm alias create default 1.9.3
This Ruby version will be the default version of Ruby on the system , to change to other versions of Ruby use the above mentioned commands.
To use default incase of switching use
  • rvm use default
To remove RVM from the system use the command
  • rvm implode

Installing Ruby on Ubuntu

Step 1 Verifying


Verify the system is update and then run a sudo apt-get update on the terminal.

Step 2 Installing RVM on Ubuntu


Open terminal and type
  • curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
This will install RVM on your system.
Please close and open the terminal again to load RVM.
To verify the RVM installation , open Terminal and type
  • rvm requirements
This will show a help doc.

Step 3 Installing required RVM packages before installing Ruby


Open Terminal and run the below mentioned commands one after the another
  • rvm pkg install zlib
  • rvm pkg install openssl
  • rvm pkg install iconv
  • rvm pkg install readline
  • rvm pkg install autoconf

Step 4 Installing Ruby


Open the Terminal and type the following command
  • rvm install 1.8.7 -C --with-openssl-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr
Here 1.8.7 reflects the Ruby version 1.8.7 and the latest patch, so to install any specific version or path you specify it by altering the above mentioned command eg.
  • rvm install 1.8.7-p334 -C --with-openssl-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr
  • rvm install 1.9.3 -C --with-openssl-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr

Step 5 Verify the installation


Open a new Terminal window and type
  • rvm list This will display the list of the different rubies installed on the system.
    To use a specific Ruby version use the following command
  • rvm use 1.8.7
  • rvm use 1.8.7-p334
  • rvm use 1.9.3 To make a Ruby version default for the system use the command
  • rvm alias create default 1.8.7
  • rvm alias create default 1.8.7-p334
  • rvm alias create default 1.9.3
This Ruby version will be the default version of Ruby on the system , to change to other versions of Ruby use the above mentioned commands.
To use default incase of switching use
  • rvm use default
To remove RVM from the system use the command
  • rvm implode

Installing Ruby on Windows

Step 1 :

Download Ruby from http://www.ruby-lang.org/en/.

Versions Available :
  • Ruby 1.8.6
  • Ruby 1.8.7
  • Ruby 1.9.1
  • Ruby 1.9.2
  • Ruby 1.9.3 *Recommended
Run the installer to install Ruby like any other windows application.
After install verify the installation by opening the command prompt
( Win Key + R : Type CMD : Press Enter )
Type
  • ruby -v
This should display the Ruby version which has been installed

Step 2


Extract the Devkit in a directory.
Open command prompt and navigate to the the directory where you extracted Devkit.
Type
  • ruby dk.rb init
  • ruby dk.rb install
    Now Devkit is configured on your system.

Step 3

Download Mysql/any other DB installer and install it on the machine to be used as a database for your Rails application

Creating a native iOS application !

Step 1 Installing XCode on the system

  • Download and install XCode from the App Center alongwith the Developer Tools

Step 2 Download the Phonegap SDK

  • Download and unzip the Phonegap SDK.
  • Now navigate to the iOS directory in the extracted source and run the Cordova-1.7.0.dmg and install it.

Step 3 Creating a XCode Project

Run XCode and create a new Project
Select the template
  • Cordova-based Application
This will create the a new project and include the neccesary Phonegap API Files.

Step 4 Changing the default compiler

  • Click on the application name and select BUILD SETTINGS tab in the center pane
  • Change the compiler in the BUILD OPTIONS from APPLE LLVM COMPILER to LLVM GCC

Step 5 Build and Run the Project

  • Click on the left top of the XCode window selecting the default device as iPad/iPhone Now run the Project. This would invoke the simulator and run the application on it.
  • Once the application runs a error will Popup stating the index.html is not found. Close the simulator and return back to the XCode project window.

Step 6 Include www folder in the project to start with application development

  • Right click the project name and select Show in Finder
  • Drag the www folder from the Finder to the Project
  • A window pop's up , select to create references to the files.

Step 7 Again BUILD & RUN

  • Now again build and run the project in an iPad/iPhone simulatore
  • This time it would show up the index.html which is located in the www folder. Also it would show up the Dialog stating that Phonegap was successfully integrated in the application

Step 8 Download JQuery Mobile bundle

Download the latest build of JQuery Mobile from http://jquerymobile.com/ Unzip the contents and add the files in the www folder categorizing the folders as
  • javascripts
  • stylesheets
  • `images'

Step 9 Including the JQuery mobile in the application

  • Open index.html and create references to the javascript and css files located in the www folder using the html tags

Step 10

Add a few lines of HTML to the index page and use the JQuery classes and the Phonegap api function calls to implement the features of the native application as desired
More Documentation available at

Step 11 * not tested though

  • Once the application is complete or for on Device testing a Apple's Developer License is required to sign the applications.
  • After signing it , push the application to PhoneGap Build https://build.phonegap.com/.
  • Download the build package and deploy to th Device.