Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
kripy committed Jul 1, 2013
0 parents commit 1efee12
Show file tree
Hide file tree
Showing 27 changed files with 447 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
.sass-cache
.env
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source "https://rubygems.org"

ruby "1.9.3"
gem "unicorn"
gem "sinatra"
gem "sinatra-support", require: "sinatra/support"
gem "sinatra-assetpack", :require => "sinatra/assetpack"

gem "coffee-script"
gem "compass"
gem "compass-h5bp"
gem "mustache"
gem "json"
56 changes: 56 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
GEM
remote: https://rubygems.org/
specs:
chunky_png (1.2.8)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.2)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
compass-h5bp (0.1.1)
compass
execjs (1.4.0)
multi_json (~> 1.0)
fssm (0.2.10)
jsmin (1.0.1)
json (1.8.0)
kgio (2.7.4)
multi_json (1.7.7)
mustache (0.99.4)
rack (1.2.2)
rack-test (0.6.2)
rack (>= 1.0)
raindrops (0.10.0)
sass (3.2.9)
sinatra (1.2.6)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
sinatra-assetpack (0.2.7)
jsmin
rack-test
sinatra
tilt (>= 1.3.0)
sinatra-support (1.2.2)
sinatra (>= 1.0)
tilt (1.3)
unicorn (4.3.1)
kgio (~> 2.6)
rack
raindrops (~> 0.7)

PLATFORMS
ruby

DEPENDENCIES
coffee-script
compass
compass-h5bp
json
mustache
sinatra
sinatra-assetpack
sinatra-support
unicorn
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec unicorn -p $PORT -c ./unicorn.rb
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Frank's Famous

Frank's Famous is an extension of [Pizza Man](https://github.com/kripy/pizza-man), bringing in [Sass](http://sass-lang.com/) support via [Sinatra Support](https://github.com/sinefunc/sinatra-support/), [HTML5 boilerplate](http://html5boilerplate.com/) support via [Compass H5bp](https://github.com/sporkd/compass-h5bp), and asset management via [Sinatra AssetPack](https://github.com/rstacruz/sinatra-assetpack). Phew.

Again it's a Heroku ready [Sinatra](http://www.sinatrarb.com/) app, running on [Unicorn](http://unicorn.bogomips.org/) with [Mustache](http://mustache.github.io/) for templating.

Check the code for the only real gotcha I came across, with Heroku seemingly not being able to deal with asset minification yet the assets were minified anyhow. Go figure.

I also added an extra helper to load [Modernizr](http://modernizr.com/) before the HTML body start tag, as per the HTML5 boilerplate convention, with the rest of the JavaScript includes loading right before the end body tag.

## Installation

Firstly, make sure you've [installed Ruby](http://www.ruby-lang.org/en/). Also, install the [Heroku Toolbelt](https://toolbelt.heroku.com/) as it includes [Foreman](https://github.com/ddollar/foreman) for running Procfile-based applications.

Then in terminal, clone me:

```
$ git clone git@github.com:/kripy/franks-famous my-franks-famous
$ cd my-franks-famous
$ foreman start
```

Open up a browser at ```http://localhost:5000/```: now you're cooking!

## Deployment

If you don't already have one, sign up for a [Heroku](https://www.heroku.com/) account. Everything you need to know and do to deploy is in [Getting Started with Ruby on Heroku](https://devcenter.heroku.com/articles/ruby).

In terminal, cd into your app:

```
$ cd my-franks-famous
$ git init
$ git add .
$ git commit -m "init"
$ heroku create
$ git push heroku master
$ heroku open
```

Then enjoy your slice of pizza pie!

## MIT LICENSE

Copyright (c) 2013 Arturo Escartin

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.
77 changes: 77 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
require "sinatra/base"
require "sinatra/assetpack"
require "compass"
require "compass-h5bp"
require "sinatra/support"
require "mustache/sinatra"
require "json"

class App < Sinatra::Base
base = File.dirname(__FILE__)
set :root, base

app_json = "#{base}/app/result.json"

register Sinatra::AssetPack
register Sinatra::CompassSupport
register Mustache::Sinatra

set :sass, Compass.sass_engine_options
set :sass, { :load_paths => sass[:load_paths] + [ "#{base}/app/css" ] }

assets do
serve "/js", from: "app/js"
serve "/css", from: "app/css"
serve "/img", from: "app/img"

css :app_css, [ "/css/*.css" ]
js :app_js, [
"/js/*.js",
"/js/vendor/jquery-1.9.1.min.js",
]
js :app_js_modernizr, [ "/js/vendor/modernizr-2.6.2.min.js" ]
end

require "#{base}/app/helpers"
require "#{base}/app/views/layout"

set :mustache, {
:templates => "#{base}/app/templates",
:views => "#{base}/app/views",
:namespace => App
}

before do
@css = css :app_css
@js = js :app_js
@js_modernizr = js :app_js_modernizr
end

# Function allows both get / post.
def self.get_or_post(path, opts={}, &block)
get(path, opts, &block)
post(path, opts, &block)
end

get "/" do
@page_title = "Website Name"
answer = JSON.parse(File.open(app_json).read)
@answer = answer["answer"]

mustache :index
end

# Switches between Yes / No. Handy when you're on the move.
# Email the route to yourself and keep it handy.
# Variable store in .env file.
get "/" + ENV['YSN_ROUTE'] do
answer = JSON.parse(File.open(app_json).read)
answer = answer["answer"]

if answer == "yes"
File.open(File.open(app_json), 'w') { |file| file.write("{\"answer\": \"no\"}") }
else
File.open(File.open(app_json), 'w') { |file| file.write("{\"answer\": \"yes\"}") }
end
end
end
5 changes: 5 additions & 0 deletions app/css/modules/_base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Core imports
@import "compass";

// Default project mixins
@import "mixins";
21 changes: 21 additions & 0 deletions app/css/modules/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Default font
@mixin typeface {
// From: Better Helvetica Font Stack http://j.mp/9t6O6Z
font-family: "Helvetica", Arial, sans-serif;
}

@mixin clearfix() {
// http://nicolasgallagher.com/micro-clearfix-hack/
// USAGE: @include clearfix();
& {
*zoom: 1;
}
&:before,
&:after {
content: "";
display: table;
}
&:after {
clear: both;
}
}
70 changes: 70 additions & 0 deletions app/css/modules/_normalize.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* HTML5 Boilerplate
* ==|== normalize.css ==========================================================
*/

article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }
audio:not([controls]) { display: none; }
[hidden] { display: none; }

html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
body { margin: 0; font-size: 13px; line-height: 1.231; }
body, button, input, select, textarea { font-family: sans-serif; color: #222; }

::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
::selection { background: #fe57a1; color: #fff; text-shadow: none; }

a { color: #00e; }
a:visited { color: #551a8b; }
a:hover { color: #06e; }
a:focus { outline: thin dotted; }
a:hover, a:active { outline: 0; }

abbr[title] { border-bottom: 1px dotted; }
b, strong { font-weight: bold; }
blockquote { margin: 1em 40px; }
dfn { font-style: italic; }
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
ins { background: #ff9; color: #000; text-decoration: none; }
mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; }
pre, code, kbd, samp { font-family: monospace, monospace; _font-family: 'courier new', monospace; font-size: 1em; }
pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; }
q { quotes: none; }
q:before, q:after { content: ""; content: none; }
small { font-size: 85%; }
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -0.5em; }
sub { bottom: -0.25em; }
ul, ol { margin: 1em 0; padding: 0 0 0 40px; }
dd { margin: 0 0 0 40px; }
nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; }
img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; }
svg:not(:root) { overflow: hidden; }
figure { margin: 0; }

form { margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; }
label { cursor: pointer; }
legend { border: 0; *margin-left: -7px; padding: 0; }
button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; }
button, input { line-height: normal; *overflow: visible; }
table button, table input { *overflow: auto; }
button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; }
input[type="checkbox"], input[type="radio"] { box-sizing: border-box; }
input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; }
textarea { overflow: auto; vertical-align: top; resize: vertical; }
input:valid, textarea:valid { }
input:invalid, textarea:invalid { background-color: #f0dddd; }

table { border-collapse: collapse; border-spacing: 0; }
td { vertical-align: top; }

/* ==|== non-semantic helper classes ======================================== */
.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; }
.ir br { display: none; }
.hidden { display: none !important; visibility: hidden; }
.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.invisible { visibility: hidden; }
1 change: 1 addition & 0 deletions app/css/partials/_footer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
footer {}
1 change: 1 addition & 0 deletions app/css/partials/_header.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
header {}
1 change: 1 addition & 0 deletions app/css/partials/_ie.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Any styles targetting IE go here
36 changes: 36 additions & 0 deletions app/css/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import "h5bp";
@include h5bp-normalize;
@include h5bp-base-styles;
@include h5bp-chromeframe;

//Start custom styles.
html,
body {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}

#center {
position: relative;
display: block;
top: 50%;
margin-top: -1000px;
height: 2000px;
text-align: center;
line-height: 2000px;
}
#wrap {
line-height: 0;
}
#wrapper {
vertical-align: middle;
font-family: courier-new, sans-serif;
font-size: 30em;
text-transform: uppercase;
}

@include h5bp-helpers;
@include h5bp-media;
17 changes: 17 additions & 0 deletions app/helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class App
module ViewHelpers

def stylesheets
@css
end

def javascripts
@js
end

def js_modernizr
@js_modernizr
end

end
end
Binary file added app/img/no.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/img/yes.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit 1efee12

Please sign in to comment.