By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
SmartData Collective
  • Analytics
    AnalyticsShow More
    predictive analytics in dropshipping
    Predictive Analytics Helps New Dropshipping Businesses Thrive
    12 Min Read
    data-driven approach in healthcare
    The Importance of Data-Driven Approaches to Improving Healthcare in Rural Areas
    6 Min Read
    analytics for tax compliance
    Analytics Changes the Calculus of Business Tax Compliance
    8 Min Read
    big data analytics in gaming
    The Role of Big Data Analytics in Gaming
    10 Min Read
    analyst,women,looking,at,kpi,data,on,computer,screen
    Promising Benefits of Predictive Analytics in Asset Management
    11 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-23 SmartData Collective. All Rights Reserved.
Reading: Integrating Sinatra Into Ruby To Expedite Application Development
Share
Notification Show More
Latest News
ai digital marketing tools
Top Five AI-Driven Digital Marketing Tools in 2023
Artificial Intelligence
ai-generated content
Is AI-Generated Content a Net Positive for Businesses?
Artificial Intelligence
predictive analytics in dropshipping
Predictive Analytics Helps New Dropshipping Businesses Thrive
Predictive Analytics
cloud data security in 2023
Top Tools for Your Cloud Data Security Stack in 2023
Cloud Computing
become a data scientist
Boosting Your Chances for Landing a Job as a Data Scientist
Jobs
Aa
SmartData Collective
Aa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Exclusive > Integrating Sinatra Into Ruby To Expedite Application Development
ExclusiveProgramming

Integrating Sinatra Into Ruby To Expedite Application Development

Ryan Kh
Last updated: 2019/10/07 at 9:34 PM
Ryan Kh
6 Min Read
web developer ruby
Shutterstock Licensed Photo
SHARE

Sinatra is a great web application library. It can be used to streamline development in Ruby and several other programming languages. A number of articles on Dzone have been written on using Sinatra to develop web applications and other solutions, but there didn’t appear to be an article on setting up Sinatra. We decided to provide a quick tutorial on this process.

Contents
Setting Up Sinatra for Ruby DevelopmentWhat is Sinatra?Conclusion

Setting Up Sinatra for Ruby Development

The first step is to download the latest stable version of Ruby. Some versions of Ruby are not compatible with Sinatra, so you may need to update it. I would like to emphasize that the 64-bit version is functional, but it may require some packages to be compiled manually. Therefore, this version is only recommended for more advanced Ruby developers.

A better option is to setup version 2.6.5. You will follow the same steps as any of the other Windows installations. You will have to add the Ruby executables to the Path to use it in the console.

After Ruby has been downloaded, you will need to begin compiling it. You will accomplish this by looking for the command console and typing the following command:

More Read

DevOps data analytics

Log Analytics Practices That DevOps Experts Must Embrace In 2019

Here’s Why DevOps Is The New Agile In 2019, And Why It Matters
University Web Developer Programs Must Prep Students For Big Data Era
Is Blockchain The Answer To Blockchain Security Problems?
The Role Of Big Data Marketing In End-To-End App Development
ruby -v

If the message is successful, you should see a message similar to the following:

Ruby 2.2.1p85 <2015-02-26 revision 49769>

The exact message may differ, depending on the version of Sinatra you are installing and whether it has been recently updated from the recent file source.

As you can see, the installation process is very straightforward. There are other steps that you may need to take to get the most out of the Ruby interface, such as compiling binaries. However, this material is not necessary for adding Sinatra and beyond the scope of this tutorial. You can find more information on other articles here at Dzone.

What is Sinatra?

At this stage, you have fulfilled the first step, which is installing Ruby and RubyGems. The next step is to start working with Sinatra, so let’s see what this component is about.

Sinatra first appeared on the market in 2007. It started to gain more popularity in 2010 and was made available in RubyGems, due to its simplicity and low file size. Sinatra has been used by large companies such as GitHub, Apple and Linkedin for a variety of services and their web infrastructure. It can also be used for a variety of other applications, such as cryptocurrency platforms that need to oversee bitcoin halving.

Most developers refer to Sinatra as a micro-framework, but the team at Sinatra defines it as a specific domain language. In other words, it works with an implementation under a particular domain.

This means that it only focuses on giving us a series of programs written in Ruby with which you can manipulate the web aspect through the HTTP protocol. Since it is not considered a framework, it does not require a folder or directory structure for your application to start working.

This means that you have set up a development web server where you can see the result of your programs, to see what your small program does just visit the localhost:4267 root in your browser and add:

 /welcome

Once you have taken that step, you will have effectively started the Sinatra environment and can use it with Ruby and RubyGems successfully.

The coding process becomes easier over time. Every time you edit your code, you have to restart the server by pressing the CRTL + C keys in the console where you started the program. This step will stop the server and start it again.

As this step is very repetitive, you can use a tool called Sinatra Reloader, which simply detects changes in the program and automatically restarts the server. To install this component, you just need to type the following in the command prompt:

gem install sinatra-contrib

This will give you a lot of tools to use. Now you will need to modify the program by typing the following into the console:

require 'sinatra'require 'sinatra/reloader' if development?get '/welcome' do "Welcome to Sinatra!"end

As you see, you need to add a new line that tells Sinatra to load the reloader if you are in a development environment. You will need to start the application again by typing:

ruby hello.rb

Now every time you make a change to the file, the server will immediately restart and you will be able to confirm your changes without having to do the whole process again manually.

Conclusion

With this you have finished your tutorial, as you see there are more options for working with Ruby than using Rails. Sinatra is a great tool that allows us to get to develop great applications such as a software inventory tool without the need to adapt to other work methodologies other than your own.

TAGGED: application development, developers, ruby, sinatra, web developers
Ryan Kh October 7, 2019
Share this Article
Facebook Twitter Pinterest LinkedIn
Share
By Ryan Kh
Follow:
Ryan Kh is an experienced blogger, digital content & social marketer. Founder of Catalyst For Business and contributor to search giants like Yahoo Finance, MSN. He is passionate about covering topics like big data, business intelligence, startups & entrepreneurship. Email: ryankh14@icloud.com

Follow us on Facebook

Latest News

ai digital marketing tools
Top Five AI-Driven Digital Marketing Tools in 2023
Artificial Intelligence
ai-generated content
Is AI-Generated Content a Net Positive for Businesses?
Artificial Intelligence
predictive analytics in dropshipping
Predictive Analytics Helps New Dropshipping Businesses Thrive
Predictive Analytics
cloud data security in 2023
Top Tools for Your Cloud Data Security Stack in 2023
Cloud Computing

Stay Connected

1.2k Followers Like
33.7k Followers Follow
222 Followers Pin

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

[mc4wp_form id=”1616″]

You Might also Like

DevOps data analytics
AnalyticsBig DataDevelopmentExclusive

Log Analytics Practices That DevOps Experts Must Embrace In 2019

6 Min Read
DevOps is the new agile
DevelopmentExclusive

Here’s Why DevOps Is The New Agile In 2019, And Why It Matters

4 Min Read
university web developer programs
Big DataExclusiveNews

University Web Developer Programs Must Prep Students For Big Data Era

5 Min Read
blockchain security problems
BlockchainExclusiveSecurity

Is Blockchain The Answer To Blockchain Security Problems?

7 Min Read

SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

AI and chatbots
Chatbots and SEO: How Can Chatbots Improve Your SEO Ranking?
Artificial Intelligence Chatbots Exclusive
ai is improving the safety of cars
From Bolts to Bots: How AI Is Fortifying the Automotive Industry
Artificial Intelligence

Quick Link

  • About
  • Contact
  • Privacy
Follow US

© 2008-23 SmartData Collective. All Rights Reserved.

Removed from reading list

Undo
Go to mobile version
Welcome Back!

Sign in to your account

Lost your password?