Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenburger committed Apr 14, 2011
0 parents commit 1612d7c
Show file tree
Hide file tree
Showing 17 changed files with 549 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## OS
.DS_Store
Thumbs.db

## TEXTMATE
*.tmproj
tmtags

## LOGS
*.log

## EMACS
*~
#*
.#*

## VIM
*.swp

## PROJECT::GENERAL
coverage
rdoc
pkg
.bundle

## CACHES
.sass-cache
*.cache

## TMP
tmp

## MIDDLEMAN
build
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source 'http://rubygems.org'
gem 'haml', '3.1.0.alpha.147'
gem 'sass', '3.1.0.alpha.253'
gem 'compass', '0.11.beta.6'
gem 'html5-boilerplate', '~> 0.3.2'
gem 'jammit', '~> 0.6.0'
#gem 'middleman', '~> 1.0.3'
gem 'middleman', :path => '~/Projekte/middleman'
gem 'rdiscount', '~> 1.6.8'
118 changes: 118 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
PATH
remote: ~/Projekte/middleman
specs:
middleman (1.0.2)
coffee-script (~> 2.1.0)
compass (~> 0.10)
compass-slickmap (~> 0.4.0)
haml (~> 3.0)
json_pure (~> 1.4.0)
less (~> 1.2.0)
padrino-core (~> 0.9.0)
padrino-helpers (~> 0.9.0)
rack (~> 1.0)
rack-test (~> 0.5.0)
shotgun (~> 0.8.0)
sinatra (~> 1.0)
smusher (~> 0.4.5)
templater (~> 1.0.0)
thin (~> 1.2.0)
tilt (~> 1.1)
yui-compressor (~> 0.9.0)

GEM
remote: http://rubygems.org/
specs:
POpen4 (0.1.4)
Platform (>= 0.4.0)
open4
Platform (0.4.0)
activesupport (3.0.6)
chunky_png (1.1.0)
closure-compiler (1.1.1)
coffee-script (2.1.3)
coffee-script-source
coffee-script-source (1.0.1)
compass (0.11.beta.6)
chunky_png (~> 1.1.0)
sass (>= 3.1.0.alpha.249)
compass-slickmap (0.4.0)
compass (>= 0.10)
haml (>= 3.0)
daemons (1.1.2)
diff-lcs (1.1.2)
eventmachine (0.12.10)
extlib (0.9.15)
haml (3.1.0.alpha.147)
highline (1.6.1)
html5-boilerplate (0.3.2)
compass (>= 0.10.0)
http_router (0.5.4)
rack (>= 1.0.0)
url_mount (~> 0.2.1)
httpclient (2.2.0)
i18n (0.5.0)
jammit (0.6.0)
closure-compiler (>= 0.1.0)
yui-compressor (>= 0.9.1)
json (1.5.1)
json_pure (1.4.6)
less (1.2.21)
mutter (>= 0.4.2)
treetop (>= 1.4.2)
mutter (0.5.3)
open4 (1.0.1)
padrino-core (0.9.23)
activesupport (>= 3.0.0)
http_router (~> 0.5.4)
sinatra (~> 1.2.0)
thor (>= 0.14.3)
tzinfo
padrino-helpers (0.9.23)
i18n (>= 0.4.1)
padrino-core (= 0.9.23)
polyglot (0.3.1)
rack (1.2.2)
rack-test (0.5.7)
rack (>= 1.0)
rake (0.8.7)
rdiscount (1.6.8)
sass (3.1.0.alpha.253)
shotgun (0.8)
rack (>= 1.0)
sinatra (1.2.3)
rack (~> 1.1)
tilt (>= 1.2.2, < 2.0)
smusher (0.4.7)
httpclient
json
rake
templater (1.0.0)
diff-lcs (>= 1.1.2)
extlib (>= 0.9.5)
highline (>= 1.4.0)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.14.6)
tilt (1.2.2)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.26)
url_mount (0.2.1)
rack
yui-compressor (0.9.6)
POpen4 (>= 0.1.4)

PLATFORMS
ruby

DEPENDENCIES
compass (= 0.11.beta.6)
haml (= 3.1.0.alpha.147)
html5-boilerplate (~> 0.3.2)
jammit (~> 0.6.0)
middleman!
rdiscount (~> 1.6.8)
sass (= 3.1.0.alpha.253)
39 changes: 39 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# encoding: utf-8

require "bundler"
Bundler.setup

ssh_user = "nico@hagenburger.net"
production_url = "http://www.moviehackday.net/"
production_path = "/home/web/hagenburger/PREVIEW/moviehackday"

desc "Builds the site with bundler"
task :build do
puts "Building the site"
system "bundle exec mm-build"

# fix wrong image urls
css = File.read('build/stylesheets/moviehackday.css')
File.open('build/stylesheets/moviehackday.css', 'w') do |file|
css.gsub! '../../images', '../images'
css.gsub! /(\.png|\.jpg)\d+/, '\\1'
file.write css
end
Dir.glob '**/*.html' do |file|
html = File.read(file)
File.open(file, 'w') do |file|
html.gsub! 'images/images', 'images'
file.write html
end
end

require "jammit"
Jammit.load_configuration('assets.yml')
Jammit.packager.precache_all(File.join('.', 'build', 'javascripts'), '.')
end

desc "Deploys the site to #{production_url}"
task :deploy => :build do
puts "Deploying the site to #{production_url}"
system("rsync -avz --delete build/ #{ssh_user}:#{production_path}")
end
7 changes: 7 additions & 0 deletions assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package_path: javascripts
package_assets: <%= ENV['MM_ENV'] == 'build' ? 'on' : 'off' %>
javascript_compressor: yui
javascripts:
moviehackday:
- build/javascripts/vendor/analytics.js
- build/javascripts/application.js
4 changes: 4 additions & 0 deletions compass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'bundler'
Bundler.setup

require 'html5-boilerplate'
38 changes: 38 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require 'bundler'
Bundler.setup

require "jammit"
Jammit.load_configuration('assets.yml')

require 'compass'
Compass.add_project_configuration('compass.rb')

::Compass::configuration.asset_cache_buster = :none
set :haml, { :attr_wrapper => '"', :format => :html5 }

# activate :slickmap
activate :automatic_image_sizes

configure :build do
activate :minify_css
activate :smush_pngs
activate :cache_buster
activate :relative_assets
end

helpers do
def javascripts(*packages)
"var " +
packages.map do |pack|
if ENV['MM_ENV'] == 'build'
asset_url(Jammit.asset_url(pack, :js)[1..-1])
else
Jammit.packager.individual_urls(pack.to_sym, :js).map do |file|
asset_url(file.gsub(%r(^.*?build/), asset_url('')))
end
end
end.flatten.map do |src|
"s=document.createElement('script');s.src='#{src}';document.getElementsByTagName('HEAD')[0].appendChild(s)"
end.join(';')
end
end
118 changes: 118 additions & 0 deletions public/javascripts/vendor/analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// gaTracker: jQuery Google Analytics Integration
// A quicker, automated way to embed Google Analytics.
// (c)2007 Jason Huck/Core Five Creative
//
// Requires jQuery 1.2.x or higher (for cross-domain $.getScript)
//
// Usage:
//
// Only a tracking code is required:
// $.gaTracker('UA-XXXXX-XX');
//
// ...but other options can be specified:
// $.gaTracker(
// 'UA-XXXXX-XX',
// {
// external: '/external/',
// mailto: '/mailto/',
// download: '/downloads/',
// extensions: [
// 'pdf','doc','xls','csv','jpg','gif', 'mp3',
// 'swf','txt','ppt','zip','gz','dmg','xml'
// ]
// }
// );
//
// TODO: more testing, delay after $.getScript for Safari


(function($){
$.gaTracker = function(code, opts){
opts = jQuery.extend({
external: '/external/',
mailto: '/mailtos/',
download: '/downloads/',
extensions: [
'pdf','doc','xls','csv','jpg','gif', 'mp3',
'swf','txt','ppt','zip','gz','dmg','xml'
]
}, opts);

// Returns the given URL prefixed if it is:
// a) a link to an external site
// b) a mailto link
// c) a downloadable file
// ...otherwise returns an empty string.
function decorateLink(u){
var trackingURL = '';

if(u.indexOf('://') == -1 && u.indexOf('mailto:') != 0){
// no protocol or mailto - internal link - check extension
var ext = u.split('.')[u.split('.').length - 1];
var exts = opts.extensions;

for(i = 0; i < exts.length; i++){
if(ext == exts[i]){
trackingURL = opts.download + u;
break;
}
}
} else {
if(u.indexOf('mailto:') == 0){
// mailto link - decorate
trackingURL = opts.mailto + u.substring(7);
} else {
// complete URL - check domain
var regex = /([^:\/]+)*(?::\/\/)*([^:\/]+)(:[0-9]+)*\/?/i;
var linkparts = regex.exec(u);
var urlparts = regex.exec(location.href);
if(linkparts[2] != urlparts[2]) trackingURL = opts.external + u;
}
}

return trackingURL;
}

// add tracking code to the current page
function addTracking(){
_uacct = code;
urchinTracker();

// examine every link in the page
$('a').each(function(){
var u = $(this).attr('href');

if(typeof(u) != 'undefined'){
var newLink = decorateLink(u);

// if it needs to be tracked manually,
// bind a click event to call GA with
// the decorated/prefixed link
if(newLink.length){
$(this).click(function(){
urchinTracker(newLink);
});
}
}
});
}

// include the external GA script in try/catch to play nice
function initGA(){
try{
// determine whether to include the normal or SSL version
var gaURL = (location.href.indexOf('https') == 0 ? 'https://ssl' : 'http://www');
gaURL += '.google-analytics.com/urchin.js';
// include the script
$.ajax({ url: gaURL, dataType: 'script', async: true, success: function(){
addTracking();
}});
} catch(err) {
// log any failure
console.log('Failed to load Google Analytics:' + err);
}
}

initGA();
}
})(jQuery);
4 changes: 4 additions & 0 deletions views/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- content_for :head do
%title The Middleman!

%h1 The Middleman is watching.
3 changes: 3 additions & 0 deletions views/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
try
Typekit.load()
catch e
Loading

0 comments on commit 1612d7c

Please sign in to comment.