Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A minimal ruby web app skeleton. (deprecated)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 assets
Octocat-spinner-32 spec
Octocat-spinner-32 views
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Vendorfile
Octocat-spinner-32 app.rb
Octocat-spinner-32 config.ru
README.md

Greenfield

This was a fun experiment in composing different Ruby libraries into a web framework. Since writing this library, I've built many more standalone Sinatra applications and found I prefer just using it's standard tools. Sprockets is still awesome, but it's so easy to mount that it's not really worth a template to set it up. I used to love guard, but now I'm fine with running tests manually or having an editor hook instead of adding a project dependency. No more love for RSpec. Love live Test::Unit cough minitest cough.

I'm archiving this here and hope someone finds it as useful as I did for learning.

Introduction

Greenfield is a minimal ruby web app skeleton.

Included Libraries

  • sprockets - Rail's asset pipeline
  • compass - CSS framework and utilities
  • sinatra - small and simple Ruby web framework
  • vendorer - manage external JS dependencies
  • rspec 2 - testing framework
  • guard - file watcher to refresh bundle and run specs

Getting Started

git clone https://github.com/jch/greenfield
cd greenfield
bundle install
rake setup

Folder Structure

assets/            # asset pipeline compiled assets
  - javascripts/   # coffeescript enabled JS
  - stylesheets/   # sass, scss enabled CSS
  - templates/     # handlebar templates for client side rendering
views/             # sinatra layouts and views
public/            # static files
spec/              # rspec tests
  - integration/   # rspec integration tests
app.rb             # sinatra application
Rakefile           # rake tasks
Vendorfile         # external assets

Rake Tasks

  • rake deploy heroku initialization and deployment
  • rake clean remove temp files

For a full list, run rake -D

Referencing Image Assets

The sprockets-sass and sprockets-helpers gems provide helper to reference your assets.

For example, to reference an image in your sass files:

// put your images in assets/images
.sidebar
  background: url(asset-path('bg.png'))

If you prefer to put your assets in a different path, append another lookup path in config.ru.

LICENSE

Copyright (c) 2012, Jerry Cheung All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Something went wrong with that request. Please try again.