From 17a2cc31ea918c976e58d982de060fbf95942c18 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Fri, 7 Jul 2023 01:26:29 -0400 Subject: [PATCH] Added draft for Sinatra blog post --- ...3-06-14-sinatra-ruby-is-beautiful.markdown | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/_posts/2023-06-14-sinatra-ruby-is-beautiful.markdown diff --git a/src/_posts/2023-06-14-sinatra-ruby-is-beautiful.markdown b/src/_posts/2023-06-14-sinatra-ruby-is-beautiful.markdown new file mode 100644 index 0000000..ca4b17f --- /dev/null +++ b/src/_posts/2023-06-14-sinatra-ruby-is-beautiful.markdown @@ -0,0 +1,34 @@ +--- +layout: post +title: "Sinatra (Ruby) is Beautiful." +description: "Sinatra is a beautifully simple web framework. It's old, but it works!" +date: 2023-06-14 09:00:00 -0400 +tags: linux +draft: True +--- + +By trade I'm a System Administrator/Network Engineer, so most of my days are filled with deploying applications, dealing with oddball software vendors and their lackluster documentation, licensing (yuck!), and planning/building out infrastructure to support operations. But I also like to do some coding on the side, and in particular I like to see what I can build to maybe be useful one day, and in particular I like spinning up web sites/apps. + +Thus enters [Sinatra](https://sinatrarb.com/). It's a very simple and lightweight framework for building web applications using a DSL. + +## The Exciting First Dance! ## + + + +## Some Quirks... ## + +While Sinatra is really easy to get going, there are some downsides to using it. First off, for anything more than just a simple web page (for which you'd probably just want to do plain old HTML or a static site generator like Jekyll), you'll want to add on some things. Things like controllers which help with code organization and flow; an ORM or at least some sort of database layer to handle storing/retrieving data; a templating engine to format and render web pages to users; a mailer tool to (obviously) send emails; and much more. This really can slow down development if you don't already have an idea of what tools are available in the Ruby ecosystem and your preferences for them. + +And on a similar note, because Sinatra is very barebones and unopinionated, you need to bring your own file/folder structure for your code, and there are several different wants to handle it. There's the classic single file app where everything is in one file, or you can break various bits and bobs out into different files but you need to find a way to either manually or automatically load those files. Oh, and you need to figure out how to define your code with Ruby modules or classes so they can be read/loaded/routed properly. + +Also, a lot of people won't like the fact that it's built on Ruby, which is comparatively a slow language, and in my opinion the syntax is a bit "too fluid" with the lack of brackets and whitespace requirements. + +## Padrino maybe? ## + +There's also this thing called Padrino, which aims to kinda standardize Sinatra a bit to get you through all of the usual code organization and boilerplate challenges, and also supercharge it with a CLI to generate models, controllers, or even a whole app! + +Frankly, this seems like a really cool tool, but it's not one that I've used extensively so I can't say for sure if it's rock-solid or not. It seems like a great way to go though, since it does tackle a lot of the issues that slow down Sinatra development, and frankly if I had run into this sooner (and not forgotten about it) then I'd probably use it more often. + +## That's All Folks! ## + +To summarize: I generally use Linux Mint on my PCs though Manjaro might take over the daily driver role soon, and I primarily use Debian in my homelab alongside a smattering of FreeBSD and RHEL-clones that might be getting phased out soon. Simple enough, right?