Ruby is…
an object-oriented interpreted scripting language. When we say it is interpreted we mean to say that the Ruby source code is compiled by an interpreter at the point of execution (similar in this regard to JavaScript and PHP). This contrasts with compiled languages such as C or C++ where the code is pre-compiled into a binary format targeted to run on a specific brand of microprocessor.
There are advantages and disadvantages to being an interpreted language. A disadvantage is speed. Because the source code has to be interpreted at runtime this means that it runs slower than an equivalent compiled application. A secondary concern for some is the fact that anyone who uses your application will also be able to see the source code. In the world of open source this is less of a problem than it used to be, but for some proprietary applications this might prove to be unacceptable.
The primary advantage of interpreted languages is that they are portable across multiple operating system platforms and hardware architectures. A compiled application, on the other hand, will only run on the operating system and hardware for which it was compiled. For example, you can take a Ruby application and run it without modification on an Intel system running Linux, an Intel system running Windows, an Intel system running Mac OS X or even a PowerPC system running Mac OS or Linux. To do this with a C or C++ application you would need to compile the code on each of the 5 different systems and make each binary image available. With Ruby you just supply the source code.
Another advantage of being interpreted is that we can write and execute Ruby code in real-time directly in the Ruby interpreter. For those who like to try things out in real time (and not everyone does), this is an invaluable feature.
Install Ruby on pcDuino Ubuntu
METHOD 1 : ( Not current stable ruby )
$ sudo apt-get install ruby $ ruby -v ruby 1.9.3p484 (2013-11-22 revision 43786) [arm-linux-eabihf]
METHOD 2: Install Ruby with RVM
Ruby Version Manager (RVM)
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
Step 1 — Install RVM
Before we do anything else, we should run a quick update to make sure that all of the packages we download are up to date: sudo apt-get update
Once that’s done, we can start installing RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one system; however, in this case, we will just use it to install the latest version of Ruby on the droplet.
If you do not have curl on your system, you can start by installing it:
1
|
$ sudo apt- get install curl |
To install RVM, open terminal and type in this command:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
$ curl -L get .rvm.io | bash -s stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 184 100 184 0 0 9 0 0 : 00 : 20 0 : 00 : 19 0 : 00 : 01 13 100 20511 100 20511 0 0 980 0 0 : 00 : 20 0 : 00 : 20 --:--:-- 46195 Downloading https: //github.com/wayneeseguin/rvm/archive/stable.tar.gz Installing RVM to /home/ubuntu/.rvm/ Adding rvm PATH line to /home/ubuntu/.profile /home/ubuntu/.bashrc /home/ubuntu/.zshrc. Adding rvm loading line to /home/ubuntu/.bash_profile /home/ubuntu/.zlogin. Installation of RVM in /home/ubuntu/.rvm/ is almost complete: * To start using RVM you need to run `source /home/ubuntu/.rvm/scripts/rvm` in all your open shell windows, in rare cases you need to reopen all shell windows. # ubuntu, # # Thank you for using RVM! # We sincerely hope that RVM helps to make your life easier and more enjoyable!!! # # ~Wayne, Michal & team. |
After it is done installing, load RVM.
1
|
$ source ~/.rvm/scripts/rvm |
check rvm version
1
2
|
$ rvm -v rvm 1.25 . 28 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https: //rvm.io/] |
Step 2 —Install Ruby
Once you are using RVM, installing Ruby is easy.
Current Stable Ruby Version is 2.1.2
So,
$ rvm install 2.1.2
example of ruby 2.0.0 :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
$ rvm install 2.0 . 0 Searching for binary rubies, this might take some time. No binary rubies available for : debian/wheezy_sid/armhf/ruby- 2.0 . 0 -p481. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for debian. Installing requirements for debian. Updating system....... Installing required packages: gawk, libreadline6-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev.............. Requirements installation successful. Installing Ruby from source to: /home/ubuntu/.rvm/rubies/ruby- 2.0 . 0 -p481, this may take a while depending on your cpu(s)... ruby- 2.0 . 0 -p481 - #downloading ruby- 2.0 . 0 -p481, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10 .2M 100 10 .2M 0 0 354k 0 0 : 00 : 29 0 : 00 : 29 --:--:-- 478k ruby- 2.0 . 0 -p481 - #extracting ruby- 2.0 . 0 -p481 to /home/ubuntu/.rvm/src/ruby- 2.0 . 0 -p481.... ruby- 2.0 . 0 -p481 - #configuring.................................................. ruby- 2.0 . 0 -p481 - #post-configuration. ruby- 2.0 . 0 -p481 - #compiling............................................................................. ruby- 2.0 . 0 -p481 - #installing............................. ruby- 2.0 . 0 -p481 - #making binaries executable.. ruby- 2.0 . 0 -p481 - #downloading rubygems- 2.2 . 2 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 404k 100 404k 0 0 35728 0 0 : 00 : 11 0 : 00 : 11 --:--:-- 55057 No checksum for downloaded archive, recording checksum in user configuration. ruby- 2.0 . 0 -p481 - #extracting rubygems- 2.2 . 2 .... ruby- 2.0 . 0 -p481 - #removing old rubygems......... ruby- 2.0 . 0 -p481 - #installing rubygems- 2.2 . 2 ............... ruby- 2.0 . 0 -p481 - #gemset created /home/ubuntu/.rvm/gems/ruby- 2.0 . 0 -p481@global ruby- 2.0 . 0 -p481 - #importing gemset /home/ubuntu/.rvm/gemsets/global.gems............................................................. ruby- 2.0 . 0 -p481 - #generating global wrappers.............. ruby- 2.0 . 0 -p481 - #gemset created /home/ubuntu/.rvm/gems/ruby- 2.0 . 0 -p481 ruby- 2.0 . 0 -p481 - #importing gemsetfile /home/ubuntu/.rvm/gemsets/ default .gems evaluated to empty gem list ruby- 2.0 . 0 -p481 - #generating default wrappers............. ruby- 2.0 . 0 -p481 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby- 2.0 . 0 -p481 - #complete Ruby was built without documentation, to build it run: rvm docs generate-ri |
Ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use 2.0.0 by default.
1
2
3
4
5
6
7
8
9
|
$ rvm use 2.0 . 0 -- default $ ruby -v ruby 2.0 .0p481 ( 2014 - 05 - 08 revision 45883 ) [armv7l-linux-eabihf] $ gem -v 2.2 . 2 $ gem source -r https: //rubygems.org/ https: //rubygems.org/ removed from sources $ gem source -a https: //ruby.taobao.org https: //ruby.taobao.org added to sources |
Step 3 —Install RubyGems
The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.
1
|
$ rvm rubygems current |
Leave a Reply
You must be logged in to post a comment.