Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdebruin committed Oct 31, 2012
0 parents commit 5054fd8
Show file tree
Hide file tree
Showing 24 changed files with 741 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
.rvmrc
.bundle/
.sass-cache/
.DS_Store
tmp/**/*
13 changes: 13 additions & 0 deletions Gemfile
@@ -0,0 +1,13 @@
source :rubygems

gem 'rake', '0.9.2'
gem 'sinatra', '~> 1.2.3'
gem 'shotgun', '~> 0.9'
gem 'haml', '~> 3.1.4'

# Sass & Compass
gem 'sass', '~> 3.1.12'
gem 'compass', '~> 0.11.6'

# Sass libraries
gem 'grid-coordinates', '~> 1.1.4'
33 changes: 33 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,33 @@
GEM
remote: http://rubygems.org/
specs:
chunky_png (1.2.5)
compass (0.11.6)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
fssm (0.2.7)
grid-coordinates (1.1.9)
compass (>= 0.11.5)
haml (3.1.4)
rack (1.4.0)
rake (0.9.2)
sass (3.1.12)
shotgun (0.9)
rack (>= 1.0)
sinatra (1.2.8)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
tilt (1.3.3)

PLATFORMS
ruby

DEPENDENCIES
compass (~> 0.11.6)
grid-coordinates (~> 1.1.4)
haml (~> 3.1.4)
rake (= 0.9.2)
sass (~> 3.1.12)
shotgun (~> 0.9)
sinatra (~> 1.2.3)
92 changes: 92 additions & 0 deletions README.mdown
@@ -0,0 +1,92 @@
# Sinatra Bootstrap

## A simple Sinatra starting point

Sinatra Bootstrap supports:

* [Haml](http://haml-lang.com/)
* [Sass](http://sass-lang.com/)
* [Compass](https://github.com/chriseppstein/compass)
* [Grid Coordinates](https://github.com/adamstac/grid-coordinates)
* [Meyer Reset](https://github.com/adamstac/meyer-reset)
* [jQuery](http://jquery.com/)
* [Modernizr](http://www.modernizr.com/)

## What is the purpose of Sinatra Bootstrap?

I created Sinatra Bootstrap in order to have a consistent starting point for my Sinatra projects. I like having Haml, Sass and Compass available to me in every project, likewise jQuery and a few JavaScripts make their way into every production as well. A number of helpful rake tasks have also been included.

## How do I get started?

If you're using [RVM](https://rvm.beginrescueend.com/), there's an `.rvmrc` file in the root of the project that automatically sets the Ruby version to 1.9.2 and the gemset to `sinatra-bootstrap`. You'll need to have 1.9.2 in place and a gemset called `sinatra-bootstrap` in place before moving on (only if you are using RVM though). See the [RVM docs](http://beginrescueend.com/rubies/docs/) if you need help or send me message if you get stuck here.

First you'll need to fork the project and then clone your Sinatra Bootstrap to your local machine.

git clone git@github.com:YOURUSER/sinatra-bootstrap.git

Then we need to run `bundle install` to install the required gems as specified by the [Gemfile](https://github.com/adamstac/sinatra-bootstrap/blob/master/Gemfile).

If you're in a fresh gemset or you don't have Bundler installed, run the following at the command prompt:

gem install bundler

You should see output like this:

sinatra-bootstrap :: (master) » gem install bundler
Successfully installed bundler-1.0.14
1 gem installed
sinatra-bootstrap :: (master) » bundle install
Fetching source index for http://rubygems.org/
Installing chunky_png (1.2.0)
Installing fssm (0.2.7)
Installing sass (3.1.2)
Installing compass (0.11.1)
Installing grid-coordinates (1.1.4)
Installing haml (3.1.1)
Installing rack (1.3.0)
Installing shotgun (0.9)
Installing tilt (1.3.2)
Installing sinatra (1.2.6)
Using bundler (1.0.14)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

## How do I start the application?

After you've ran `bundle install` and Sinatra as well as the other required gems are installed, start it up by running this command:

# runs `bundle exec shotgun config.ru` behind the scenes
rake start

This will start Sinatra Bootstrap on Sinatra's default port 9393 and will now be able to view the application in your web browser at this URL [http://localhost:9393](http://localhost:9393).

You'll also want to open a new terminal window to the same directory and run the Compass watch rake task so we can monitor our Sass files for changes.

rake styles:watch

Or you just run `compass watch`, either work.

## Helper Rake Tasks

There are a few helper Rake tasks that will help you to clear and compile your Sass stylesheets as well as a few other helpful tasks. There is also a generate task, so you can generate a new project at a defined location based on the bootstrap.

rake -T

rake generate # Generate a new project at dir=foo
rake start # Start the application
rake styles:clear # Clear the styles
rake styles:compile # Compile new styles
rake styles:compile:production # Compile new styles for production
rake styles:list # List the styles
rake styles:stats # Run compass stats
rake styles:stats:log # Create a log of compass stats
rake styles:watch # Watch the styles and compile new changes

## License

Copyright (c) 2011 Adam Stacoviak

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Empty file added README.rdoc
Empty file.
6 changes: 6 additions & 0 deletions Rakefile
@@ -0,0 +1,6 @@
require 'rubygems'
require 'bundler'
require 'rake'
Bundler.setup

Dir["tasks/*.rake"].sort.each { |ext| load ext }
32 changes: 32 additions & 0 deletions app.rb
@@ -0,0 +1,32 @@
require 'rubygems'
require 'sinatra'
require 'haml'

#
# Definitions
#

#
# Include helpers
#

#
# Set Sinatra variables
#
set :app_file, __FILE__
set :root, File.dirname(__FILE__)
set :views, 'views'
set :public, 'public'
set :haml, {:format => :html5} # default Haml format is :xhtml

#
# ===========================================================================================
#

#
# Home
# -----------------------------
#
get '/' do
haml :home, :layout => :'layouts/application'
end
34 changes: 34 additions & 0 deletions config.rb
@@ -0,0 +1,34 @@
require './app'

# Compass Configuration

require 'grid-coordinates'

# Configuration to use when running within Sinatra
project_path = Sinatra::Application.root

# HTTP paths
http_path = '/'
http_stylesheets_path = '/stylesheets'
http_images_path = '/images'
http_javascripts_path = '/javascripts'

# File system locations
css_dir = File.join 'public', 'stylesheets'
sass_dir = File.join 'views', 'stylesheets'
images_dir = File.join 'public', 'images'
javascripts_dir = File.join 'public', 'javascripts'

# Syntax preference
preferred_syntax = :sass

# Determine whether Compass generates relative or absolute paths
relative_assets = false

# Determines whether line comments should be added to compiled css for easier debugging
line_comments = false

# CSS output style - :nested, :expanded, :compact, or :compressed
output_style = :expanded

# Learn more: http://beta.compass-style.org/help/tutorials/configuration-reference/
5 changes: 5 additions & 0 deletions config.ru
@@ -0,0 +1,5 @@
require 'rubygems'
require 'sinatra'
require './app'

run Sinatra::Application
9 changes: 9 additions & 0 deletions public/bootstrap/bootstrap-responsive.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions public/bootstrap/bootstrap.min.css

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions public/javascripts/application.js
@@ -0,0 +1,10 @@
$(document).ready(function() {

// Open external links in a new window
hostname = window.location.hostname
$("a[href^=http]")
.not("a[href*='" + hostname + "']")
.addClass('link external')
.attr('target', '_blank');

});
16 changes: 16 additions & 0 deletions public/javascripts/lib/jquery-1.5.min.js

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions public/javascripts/lib/modernizr-1.6.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions public/stylesheets/application.css
@@ -0,0 +1,35 @@
html, body {
height: 100%;
}

#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -60px;
}

#push {
height: 60px;
}

#footer {
height: 60px;
background-color: #f5f5f5;
}

@media (max-width: 767px) {
#footer {
margin-left: -20px;
margin-right: -20px;
padding-left: 20px;
padding-right: 20px;
}
}
.container {
width: auto;
max-width: 680px;
}
.container .credit {
margin: 20px 0;
}

0 comments on commit 5054fd8

Please sign in to comment.