How To Install ruby-sinatra-contrib on Ubuntu 18.04

In this tutorial we learn how to install ruby-sinatra-contrib on Ubuntu 18.04. ruby-sinatra-contrib is collection of useful extensions to the Sinatra web framework

Introduction

In this tutorial we learn how to install ruby-sinatra-contrib on Ubuntu 18.04.

What is ruby-sinatra-contrib

ruby-sinatra-contrib is:

sinatra-contrib is a collection of common extensions to the Sinatra web framework, semi-officially supported:

  • capture: Lets you capture the content of blocks in templates.
  • config_file: Allows loading configuration from yaml files.
  • content_for: Adds Rails-style content_for helpers to Haml, Erb, Erubis and Slim.
  • cookies: A cookies helper for reading and writing cookies.
  • engine_tracking: Adds methods like haml? that allow helper methods to check whether they are called from within a template.
  • json: Adds a #json helper method to return JSON documents.
  • link_header: Helpers for generating link HTML tags and corresponding Link HTTP headers. Adds link, stylesheet and prefetch helper methods.
  • multi_route: Adds ability to define one route block for multiple routes and multiple or custom HTTP verbs.
  • namespace: Adds namespace support to Sinatra.
  • respond_with: Choose action and/or template automatically depending on the incoming request. Adds helpers respond_to and respond_with.
  • custom_logger: Allows one to define their own logger instance.
  • decompile: Recreates path patterns from Sinatra’s internal data structures (used by other extensions).
  • reloader: Automatically reloads Ruby files on code changes.
  • extension: Mixin for writing your own Sinatra extensions.
  • test_helpers: Helper methods to ease testing your Sinatra application. Partly extracted from Sinatra. Testing framework agnostic.

There are three methods to install ruby-sinatra-contrib 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-sinatra-contrib 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-sinatra-contrib using apt-get by running the following command:

sudo apt-get -y install ruby-sinatra-contrib

Install ruby-sinatra-contrib Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install ruby-sinatra-contrib

Install ruby-sinatra-contrib 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-sinatra-contrib using aptitude by running the following command:

sudo aptitude -y install ruby-sinatra-contrib

How To Uninstall ruby-sinatra-contrib on Ubuntu 18.04

To uninstall only the ruby-sinatra-contrib package we can use the following command:

sudo apt-get remove ruby-sinatra-contrib

Uninstall ruby-sinatra-contrib And Its Dependencies

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

sudo apt-get -y autoremove ruby-sinatra-contrib

Remove ruby-sinatra-contrib Configurations and Data

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

sudo apt-get -y purge ruby-sinatra-contrib

Remove ruby-sinatra-contrib configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge ruby-sinatra-contrib

References

Summary

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