1 Ruby setup Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How do you manage multiple versions of Ruby on a local machine?

A

Install few versions using rvm or rbenv. Then set on of the versions as default if you want. Use needed version as local. Check version using
$ ruby -v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you install at least one of the following tools? (RVM, rbenv, chruby)

A

rbenv (MacOS, Linux)
1. Install it from the OS package manager:
Ubuntu/Debian:
$ sudo apt install rbenv
2. Set up rbenv in your shell:
$ rbenv init
3. Close your terminal window and open a new one so your changes take effect.
4. Verify that rbenv is properly set up using thisrbenv-doctorscript:
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
5. List the available rubies:
$ rbenv install -l
6. Install Ruby:
$ rbenv install 3.0.0
7. Set the default ruby:
#global
rbenv global 3.0.0
#local
rbenv local 3.0.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a.ruby-versionfile? Do we need to commit it? Why or why not?

A

It’s a single-line with ruby version. A file with defined version of ruby which project is written in.
Make sure to add it to your version control systems as this is part configuring the project.
We need to commit it to allow a project to be configured for automated ruby switching.
Usually, this file is used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a gemset?

A

Gemsets are little libraries for individual projects, where each gem used in the project is stored.

You tell Ruby which gems you need for a project, and it stores them in a gemset so you can quickly switch project to project and have all the gems you need (and only the gems you need for each project).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a.ruby-gemsetfile? Do we need to commit it? Why or why not?

A

It is the name of the gemset whereall installed gems will be stored (one gemset per project)
Make sure to add it to your version control systems as this is part configuring the project.
We need to commit it to allow a project to be configured for automated ruby switching.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you find the directory of a specific gemset on your local machine?

A

$ rvm gemdir
or
gem which %gemname%

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you change the version of Ruby being used?

A

Using rvm
$rvmuse 3.0
rbenv
rbenv local 3.0.0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you list all the installed versions of Ruby?

A

$ rbenv install -l
or
$ rvm list known

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is irb? How do you run it?

A

It’s a playground.
$ irb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly