Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A quick setup for exploration: Sinatra, Slim, Sass, Twitter Bootstrap, Coffeescript

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 public
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 app.rb
Octocat-spinner-32 config.ru
Octocat-spinner-32 prod.yml
Octocat-spinner-32 vim_options.vim
README.markdown

Halbert

TL;DR

  1. Pre-requisites
    1. Have a Ruby versioning system in place rbenv or rvm
    2. Have the official coffee-script compiler installed ( use node and npm or apt-get install coffeescript )
  2. Ensure your Ruby version management software has bundler
  3. git clone the repo
    1. This will create a pristine rvm gemset called "Halbert"
    2. This will be your root for Halbert operations
  4. cd Halbert
  5. bundle install : this will load up Halbert's dependencies like sinatra and slim
  6. Start Halbert in one of two formats
    1. rake halroku: gets a basic Halbert running on heroku
    2. rake halbert: gets a basic Halbert running at localhost:4567
  7. Halbert prints a helpful diagnostic on startup. If you have issues here, please file an issue so that I can fix it!
  8. From here in the browser developer interface you have JQuery and you'll see the effects of some of the compiled CoffeeScript code. You're ready to explore and hack Javascript, Coffeescript, or CSS
  9. Customize: Editing files in public/{javascripts, stylesheets, views} does what you expect: write Coffeescript, SASS, or Slim templates in these directories. Vim users might want to take shortcuts from vim_options.vim.
    1. Re-compile and re-deploy to Heroku with rake halroku (for remote) or rake for a local, Sinatra-based server
    2. Explore locally with your Sinatra-based Halbert instance running on localhost

Purpose

Programming should be easy to explore with minimal muss and fuss.

When someone gets the urge to learn to program or to sketch out an idea, the critical stumbling block to their creativity or interest is the arcane process of configuring a stack.

To this end, I have crated Halbert: a small little "shell" that allows you to get going with little effort. It includes the stack that I'm currently using at work running on a small, light server.

The stack:

  1. Coffeescript
  2. SCSS
  3. JQuery
  4. Twitter Bootstrap

This is ideal for newcomers who can be deterred by environmental and server configuration overhead. It's also great for experienced developers who want something that works quickly and that's easily deployed and shared via Heroku.

A re-launch of Halbert always re-compiles the assets before a Heroku push or a local server startup. You can, of course, use Guard or some other asset manager to compile these files, but in keeping with Halbert's lightweight, magic-minimal approach, I prefer to use Vim autocommands.

Oh, and we have facilities for TDD with Evergreen + Jasmine. Intermediate users of Halbert may find benefit here.

Halbert lets you "just get hacking."

Typical Workflow

Try some SCSS

  1. rake : starts the server locally
  2. Edit public/stylesheets/custom/custom.scss
  3. rake compile
  4. Point browser to localhost:4567 to see results

Try some Coffee

  1. rake : starts the server locally
  2. Open another tab and go into the Halbert directory
  3. Edit public/javascripts/custom/custom.coffee, edit the given alert message
  4. Edit the coffeescript class: tree.coffee
  5. rake compile
  6. Point browser to localhost:4567
  7. Load up Webkit's console
  8. t = new Tree('the_larch');
  9. b = new Bear('Edward', 'Bear'); b.greet();

Préfèrez-vous Prototype.js et Scripty?

If you want to use these instead of JQuery, toggle between the two libraries by adjusting app.rb and changing the CONFIG::JSLIBRARY value to 'JQuery' or 'Prototype'.

Send all that to Heroku

rake halroku

Kill Heroku App

rake heroku:seppuku

Testing

evergreen run will run your tests if you've got Firefox installed. Specs are written in Coffeescript and stored in spec/javascripts in the form name_spec.coffee. You can use bear_spec.coffee as a model.

Naming

Named after Tom Halbert, my first CS teacher in high school who admonished students to create "shell" code snippets for easy cut and pasting so that we could get to the the business of coding more quickly.

Author

Steven G. Harms

Something went wrong with that request. Please try again.