
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.
(Source: wikipedia.org)
Yeah with the tracks and all. Funny it looks more like Reel than Rail 😛
Okay anyway. You wouldn’t believe but this very post is dedicated to ‘appreciate’ the framework.
Setting up:
Step#1
Use Synaptic
or
$ sudo apt-get install ruby1.9.1 ruby1.9.1-full nodejs sqlite3 libsqlite3-dev
Step#2
Download RubyGems from http://rubyonrails.org/download
Unzip. Use terminal and navigate to the unzipped content.
Step#3
$ sudo ruby1.9.1 setup.rb
Output: RubyGems installed the following executables: /usr/bin/gem1.9.1
Step#4
$ sudo gem1.9.1 install rails
Output: 30 gems installed
Step#5
$ rails new path/to/your/new/application
Output: Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
$ cd path/to/your/new/application
$ rails server
Output:
=> Booting WEBrick
=> Ctrl-C to shutdown server
[2011-10-08 23:02:20] INFOÂ WEBrick 1.3.1
[2011-10-08 23:02:20] INFOÂ ruby 1.9.2 (2010-08-18) [x86_64-linux]
[2011-10-08 23:02:20] INFOÂ WEBrick::HTTPServer#start: pid=4967 port=3000
Open Firefox: http://localhost:3000/
Now its time to (Sleep?) customize the application. Good Bye!
Do Visit:
Ruby: http://mislav.uniqpath.com/poignant-guide/book/
Rails: http://guides.rubyonrails.org/getting_started.html
Issues Faced:
#1
$ ruby
The program ‘ruby’ is currently not installed. You can install it by typing:
sudo apt-get install ruby
Resolution: use ruby1.9.1 instead
#2
$ ruby1.9.1 setup.rb
ERROR:Â While executing gem … (Errno::EACCES)
Permission denied – /usr/local/lib/site_ruby/1.9.1/ubygems.rb
Resolution: $ sudo ruby1.9.1 setup.rb
(superuser required. ergo sudo user provided)
#3
$ gem1.9.1 install rails
Fetching: multi_json-1.0.3.gem (100%)
ERROR:Â While executing gem … (Errno::EACCES)
Permission denied – /usr/lib/ruby/gems/1.9.1
Resolution: $ sudo gem1.9.1 install rails
(superuser required. ergo sudo user provided)
#4
ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb checking for sqlite3.h... no sqlite3.h is missing.
Try 'port install sqlite3 +universal' or 'yum install sqlite3-devel' *** extconf.rb failed ***
Resolution: $ sudo apt-get install libsqlite3-dev
#5
$ sudo rails server
/usr/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `autodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /usr/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs.rb:5:in `<module:ExecJS>’
Resolution: $ sudo apt-get install nodejs
(V8 by Google)