Sinatra is an open-source web application library, written in Ruby and is a domain-specific language. It depends on the Rack webserver interface.
Pre-installation settings :
Certain EasyApache 4 RPM’S need to exist on the server-
The following command needs to be run to install these-
yum install ea-ruby24-mod_passenger ea-ruby24-ruby-devel ea-apache24-mod_env
Installation of the Sinatra Gem ( Steps )
- Log in to the server as a CPANEL user.
- The following line needs to be added to the RC file
- Log out from a terminal session and log in again.
- Then the Sinatra Gem can be run.
Creating a directory path for the application
After the installation, a directory path has to be created. Example-
Creation of the application’s Ruby files :
- Change the application’s directory.
- Create the RB file with a text editor’s help.
- One needs to add the code for the execution of the application.
get ‘/’ do
Registration of the application :
After the setting file permissions, register the application. The usage of CPANEL’S Application Manager is required.
(cPanel >> Home >> Software >> Application Manager)
Restarting Apache :
- Root level permissions on the server are required.
- This is an optional step. API’s https://documentation.cpanel.net/display/DD/UAPI+Functions+-+PassengerApps%3A%3Aregister_application can restart Apache, but the results might not be immediate.
To restart Apache, run the following command-
The application is accessible after Apache restarts in Cpanel’s Application manager interface –
(cPanel >> Home >> Software >> Application Manager).
RVM is an unix-like software, used to manage more than one installations of Ruby on a single device.
gpg –keyserver hkp://keys.gnupg.net –recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3$ curl -sSL https://get.rvm.io | bash -s stable –ruby
There are a few choices of code writing tools :
- Atom, which runs on Electron to build cross platform apps.
- Sublime Text, is renowned for being an easy usage text editor.
- RubyMine, might take some time to set up but comes with pre-installed tools.
- Vim, too is a popular text editor, meant for advanced users.
Bundler is used to manage dependencies and pulling Sinatra into the development environment is done by bundle install..
Using builder 3.2.2
Using jwt 1.5.6
Using multi_json 1.12.1
Using rack 1.6.5
Using tilt 2.0.5
Using bundler 1.13.3
Using twilio-ruby 4.13.0
Using rack-protection 1.5.3
Using sinatra 1.4.7
Go to Source