Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Print to standard output in different scripting languages

Answer:

To print a string of "Hello World" to the standard output in different scripting languages

1. Perl

print "Hello, World!";

2. Python

print('Hello, World!')

3. PHP

echo "Hello, World!";

4. Ruby

puts "Hello, World!"

List of remote gems on rubyforge.org

Answer:

To list all the available gems on rubyforge.org, use this command:

# gem list --remote

For example, to search for all rails related gems, use

# gem list --remote | grep "\-rails"

List all the installed gems

Answer:

To list all the installed gems on your machine, simply execute the following command:

# gem list --local

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.9)
actionpack (3.0.9)
activemodel (3.0.9)
activerecord (3.0.9)
activeresource (3.0.9)
activesupport (3.0.9)
arel (2.0.10)
builder (2.1.2)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rake (0.9.2)
treetop (1.4.9)
tzinfo (0.3.28)

How to update RubyGems?

Answer:

To update the the RubyGems installed in Ubuntu, enter the command below:

# sudo gem update --systemNow

That's it.

Install RubyOnRails in Ubuntu

Answer:

In the last article, we talked how to install Ruby in Ubuntu. Now, we are going to install a very popular web framework for Ruby - RubyOnRails.

Firstly, you need to install RubyGems, a gem is a packaged Ruby application or library.

# sudo apt-get install rubygems

Then, we use the gem command to install rails.

# sudo gem install rails

That's all.