APPLE, GITHUB, AND THE BBC USE SINATRA. WHY? Sinatra has become the natural choice for building fast and efficient Ruby applications without the weight of Rails. In fact, consider that the entire Sinatra codebase weighs in at less than 2,000 lines—around 1% the size of Rails! And, unlike Rails, you have the freedom to choose the tools you prefer. So, for instance, you can write database-agnostic code complete with Ajax.
I invite you to ask any Sinatra questions that you have here - Darren is hanging around and is keen to help you out (or encourage you to get started if Sinatra is new to you). And remember, there is no such thing as a stupid question around this place. And keep your eyes out for some fun Sinatra based quizes and contests that we have in the pipeline.
Hi Darren! Another complete programming noob here. I did dip my nose into a Ruby book once, but didn’t get far. One thing that worried me about the concept of Rails was that it didn’t seem all that straightforward to host whatever you build. It didn’t seem possible to run a Rails-based site on my current hosting account, for example, while I don’t have to think twice about using PHP on most servers.
What is the situation with Sinatra? I assume something special is needed in this case too? What kind of hosting does one need to organize?
I’d probably say Linux, basically because that’s what I use! Traditionally it was quite hard setting up Ruby on Windows, but now it’s fairly easy I think, so both would probably be fine.
You basically need Ruby and the Sinatra gem installed on your server for it to run, so you’d have to check with your current hosts if they provide that (more and more are). In the book I recommend using a platform as a service such as Heroku (http://www.heroku.com/) that allows you to deploy Sinatra applications very easily.Their basic packages are free, so you can use them to experiment with.
I do wonder about the hosting though. If my server does not have Ruby or Sinatra gem installed, I assume that you can use Heroku’ services to deploy business applications and to host the application that can’t be hosted in my own server (even if that means to pay their fees). Or would it be easier to contract another web server where Ruby and Sinatra are installed?
Yes Heroku make it very easy to host as they deal with all the deployment and dependency issues you might run into. They have a free tier as well, so you can try things out first before deploying a big business application (lots of them are run on Heroku and they have a lot of experience of running Ruby apps). My own Cards in the Cloud site is running on Heroku (http://www.cardsinthecloud.com/). This would certainly be my preferred option, but there are also lots of other hosts that would provide you with Ruby and Sinatra hosting such as Engine Yard (https://www.engineyard.com/) or you could even deploy it yourself using Amazon’s cloud services.
The best way to handle rails development is to use vagrant to spin up a VM with appropriate bits. If you really want to run totally locally, something *nix based is easier though you can get there on windows. You’ll certainly want to look at RVM to run it properly and allow you to have multiple ruby stacks on the same box.
How easy is to integrate Sinatra in existing applications or CMS (let’s say an exisiting website in WordPress or Joomla)?
Depends on what you are doing. One angle could be building the sinatra app to handle something specific and exposing a RESTful service layer that the WP / Joomla site could consume.
Since I know absolutely nothing about Ruby nor Sinatra, I guess my question is, what expectations are there for someone who is new to Ruby and has never heard of Sinatra in regards to your book?
Would it be wise for me to pick up a Ruby book first or at least to go side-by-side with Jump Start Sinatra?
You should be able to get along fine with the book if you are new to both Sinatra and Ruby, as long as you know a bit about HTML and CSS and have done a little programming before. You’ll definitely learn how Sinatra works and hopefully learn a little bit of Ruby. Having said that, things will probably make more sense if you know more Ruby. A great place to start is with this online resource http://pine.fm/LearnToProgram/ as well as the interactive http://tryruby.org/levels/1/challenges/0
This should be enough to get you started with Ruby and Sinatra … and after that, the better you get at Ruby the better you’ll be at Sinatra.
That does, Thanks. Ruby has been one of those languages that seemingly always sits on my To Do List but never gets past that list sigh. I’ll get to it someday, maybe sooner now that we are using it a bit at work on some of our teams
If you’re already familiar with similar “micro frameworks” like Python’s bottle or flask, or Perl’s Dancer, which are all really based on Sinatra, then I think you kinda know what to expect getting into Sinatra. The bigger difference might be the environment: Ruby, and Rails.
Unfortunately, I never jumped on the Python bandwagon (although I have written some snippets for systems that used a python plugin architecture). As for Perl, I haven’t touched that for 7-8 years? Most of my work has been around .NET and the occasional PHP. Ruby has been on my radar for years and I tried getting into it a few years ago, but I just didn’t have the free time then. Now I’m finding more free time, I may need to dig up that book and get back at it.
Is this the right place to ask technical questions about this book? I am working through it and am getting errors in chapter 3. Sinatra is reporting a line that doesn’t even exist in my file.