Author Topic: Setup Ruby  (Read 509 times)

0 Members and 1 Guest are viewing this topic.

Offline rincewind

  • Peasant
  • *
  • Posts: 59
  • Cookies: 17
  • Hello
    • View Profile
Setup Ruby
« on: September 08, 2015, 02:47:11 pm »
Setting up Ruby development environment
by acaan for Evilzone
#1 INTRO
Hello in this tutorial  I will show you how to setup Ruby dev environment on debian-like systems.
Ruby is a dynamic, reflective, object-oriented, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan.
It is widely in web development, but you can use it also for desktop apps, mobile apps, or just as a scripting language to automate your tasks. Now let's get started.

#2 DEPENDENCIES
Open up your terminal, we are gonna download some dependencies first.
Code: [Select]
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
#3 RVM
We need them because we will install Ruby through RVM(Ruby version manager) which is useful tool for managing ruby versions. With RVM we can use more than one version of Ruby very easily. Now let's install it.
Code: [Select]
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
#4 RUBY
Now we have RVM installed we can install Ruby, yay! Currently latest stable version is 2.2.3, so we will use that one.
Code: [Select]
rvm install 2.2.3
rvm use 2.2.3 --default

And that's it! You now have Ruby 2.2.3 installed and you are ready for coding.
To verify type this in your terminal
Code: [Select]
ruby -v

The output should be something like this
Code: [Select]
=>ruby 2.2.3p173 (2015-08-18 revision 51636) [i686-linux]


#5 RUBY GEMS
A gem is like a header file in C or module in Python. It has management system called ruby gems(well duh :P ).
We already have it when we installed rvm. And we use it like this:
Code: [Select]
gem install nokogiri

this will search gem database fetch the gem and install it. Nokogiri is a gem for web scraping by the way. From here everything is rather easy to setup. You want sinatra, no problem just type
Code: [Select]
gem install sinatra

and you can start using rails. It's really easy and Ruby is a beautiful and fun language to learn.
To see what gems you have type
Code: [Select]
gem list


#6 OUTRO  AND REFERENCES
So thanks for reading my tutorial, it's my first one. If you are new to Ruby I will now give you some useful resources to begin your journey.

Try Ruby - Made by why the lucky stiff
Ruby Koans - You will be enlightened.
CodeCademy - Mostly web stuff here.

Here are references i used to make this tutorial:
https://gorails.com/setup/ubuntu/14.10
https://en.wikipedia.org/wiki/Ruby_%28programming_language%29

And that would be it. Go program now.
« Last Edit: September 08, 2015, 02:49:07 pm by acaan »
asdf