Alright, this week's post is a 30 second rundown of something I spent an hour looking for earlier this week. Now it'll be saved in one spot for me AND for you.
That minimal effort does come at a cost - because Sinatra is so lightweight, you're not getting as much built-in upfront as you do with a full framework like Rails. You're responsible for pretty much everything - app structure, generating files and directories, etc.
In my bootcamp, we used Sinatra before we got to Rails so we'd be required to learn the concepts behind Rails before just booting up rails and poof! having things working.
We used Sinatra in conjunction with learning about MVC architecture, setting up routes, and making all the different pieces talk to each other. It definitely provided a good foundation and made Rails easier to pickup and easier to like.
Corneal is a beautiful little gem created by a former Flatiron student named Brian Emory. Avi suggested he "maybe build a CLI gem that generates our sinatra structure using some sort of ruby templating gem . . . ."
Once Corneal is installed, you can get up and up and running with three commands.
gem install corneal corneal new MY-NEW-APP-NAME bundle
THAT'S IT. THAT'S THE TWEET.
That's it. With those three lines you'll get this:
└─app ├── controllers │ ├──application_controller.rb │ └──new_model_controller.rb ├── models │ └──new_model.rb └── views ├──new_models │ ├──index.html.rb.erb │ ├──show.html.rb.erb │ ├──new.html.rb.erb │ └──edit.html.rb.erb ├── layout.erb └── welcome.erb
I KNOW. SO MUCH TIME SAVED.
From there, you can edit and add as needed - add your various views, models, get your schema set up, get your controllers working. You'll still have to build a lot yourself, but having the scaffold just makes it easier on the brain to get going.
Have fun out there.