Just another WordPress.com weblog

Archive for the ‘Ruby’ Category

Install Rails using gem in Ubuntu 15.04

Install Ruby on Rails
1. Install Dependencies
$ sudo apt-get install ruby ruby-dev zlib1g-dev libsqlite3-dev sqlite3

2. Install Rails without documentations of gem files

$ sudo gem install rails –no-ri –no-rdoc

Note : Missing dependency of ruby-env or zlib1g-dev will result in following error :

ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 extconf.rb

If anybody is facing such an issue while installing, please look into the log file of a specific gem where you encountered the problem and install the specific dependency package for that gem

Install rails without documentation for gems by default
1. find out gemrc file in your system
$ strace gem source 2>&1 | grep gemrc
stat(“/etc/gemrc”, 0x7fffe6f7dcd0) = -1 ENOENT (No such file or directory)
stat(“/home/selva/.gemrc”, 0x7fffe6f7ddb0) = -1 ENOENT (No such file or directory)
2. $ vim ~/.gemrc – add below line to this file :
gem: –no-documen

After you have created your rails application and you are facing the issue like “rails server autodetect’ could not find a javascript runtime” while starting your application’s rails server (bin/rails server), You can either install therubyracer gem which is commented in your Gemfile or You can install node.js by using this link :

http://www.ubuntuupdates.org/ppa/nodejs_v012?dist=vivid

Download the the repository key with:

curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

Then setup the repository:

$ sudo sh -c "echo deb https://deb.nodesource.com/iojs_1.x vivid main \
> /etc/apt/sources.list.d/nodesource.list"
$ sudo apt-get update
$ sudo apt-get install iojs