How To Install ruby-test-construct on Ubuntu 18.04

In this tutorial we learn how to install ruby-test-construct on Ubuntu 18.04. ruby-test-construct is Ruby library that creates temporary files and directories for testing

Introduction

In this tutorial we learn how to install ruby-test-construct on Ubuntu 18.04.

What is ruby-test-construct

ruby-test-construct is:

TestConstruct is a DSL for creating temporary files and directories during testing.

Using construct is as simple as calling within_construct and providing a block. All files and directories that are created within that block are created within a temporary directory. The temporary directory is always deleted before within_construct finishes.

There is nothing special about the files and directories created with TestConstruct, so you can use plain old Ruby IO methods to interact with them.

There are three methods to install ruby-test-construct on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install ruby-test-construct Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install ruby-test-construct using apt-get by running the following command:

sudo apt-get -y install ruby-test-construct

Install ruby-test-construct Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install ruby-test-construct using apt by running the following command:

sudo apt -y install ruby-test-construct

Install ruby-test-construct Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install ruby-test-construct using aptitude by running the following command:

sudo aptitude -y install ruby-test-construct

How To Uninstall ruby-test-construct on Ubuntu 18.04

To uninstall only the ruby-test-construct package we can use the following command:

sudo apt-get remove ruby-test-construct

Uninstall ruby-test-construct And Its Dependencies

To uninstall ruby-test-construct and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove ruby-test-construct

Remove ruby-test-construct Configurations and Data

To remove ruby-test-construct configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge ruby-test-construct

Remove ruby-test-construct configuration, data, and all of its dependencies

We can use the following command to remove ruby-test-construct configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge ruby-test-construct

References

Summary

In this tutorial we learn how to install ruby-test-construct package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.