Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Mar 15, 2012
0 parents commit 2bcaa21
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.bundle/
public/
12 changes: 12 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
source 'http://rubygems.org'

gem 'rake'
gem 'fssm'

gem 'haml'
gem 'compass'
gem 'coffee-script'
gem 'therubyracer'
gem 'sprockets'

gem 'r18n-core', git: 'git@github.com:ai/r18n.git'
49 changes: 49 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
GIT
remote: git@github.com:ai/r18n.git
revision: 84a26d2e9bdc89cd8553ec7aeeb7499adb98841b
specs:
r18n-core (0.4.14)

GEM
remote: http://rubygems.org/
specs:
chunky_png (1.2.5)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.2.0)
compass (0.12.0)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
execjs (1.3.0)
multi_json (~> 1.0)
fssm (0.2.8.1)
haml (3.1.4)
hike (1.2.1)
libv8 (3.3.10.4)
multi_json (1.1.0)
rack (1.4.1)
rake (0.9.2.2)
sass (3.1.15)
sprockets (2.3.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
therubyracer (0.9.10)
libv8 (~> 3.3.10)
tilt (1.3.3)

PLATFORMS
ruby

DEPENDENCIES
coffee-script
compass
fssm
haml
r18n-core!
rake
sprockets
therubyracer
Empty file added README.md
Empty file.
75 changes: 75 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
require 'pathname'
ROOT = Pathname(__FILE__).dirname
CONTENT = ROOT.join('content/')
PUBLIC = ROOT.join('public/')
LAYOUT = ROOT.join('layout/')

require 'haml'
require 'r18n-core'
R18n.default_places = CONTENT.join('i18n')

class Pathname
def glob(pattern, &block)
Pathname.glob(self.join(pattern), &block)
end
end

class Helpers
include R18n::Helpers

def assets
@sprockets ||= begin
require 'sprockets'
Sprockets::Environment.new(ROOT) do |env|
env.append_path(LAYOUT)
env.append_path(ROOT.join('vendor'))

compass = Gem.loaded_specs['compass'].full_gem_path
env.append_path("#{compass}/frameworks/compass/stylesheets")
end
end
end
end

def render(haml, &block)
Haml::Engine.new(haml, format: :html5).render(Helpers.new, &block)
end

task :clean_public do
PUBLIC.mkpath
PUBLIC.glob('*') { |i| i.rmtree }
end

desc 'Build site files'
task :build => :clean_public do
layout = LAYOUT.join('layout.html.haml').read

R18n.available_locales.each do |locale|
R18n.set(locale)

LAYOUT.glob('*.html.haml') do |haml|
next if haml.basename.to_s == 'layout.html.haml'
name = PUBLIC + haml.relative_path_from(LAYOUT).sub_ext('').
sub_ext(".#{locale.code}.html")

PUBLIC.join(name).open('w') do |html|
html << render(layout) { render(haml.read) }
end
end
end
end

desc 'Rebuild files on every changes'
task :watch do
def rebuild
puts 'rebuild'
Rake::Task['build'].execute
end

require 'fssm'
FSSM.monitor(ROOT, '{content,layout}/**/*', directories: true) do
update { rebuild }
delete { rebuild }
create { rebuild }
end
end
Empty file added content/easings.yml
Empty file.
1 change: 1 addition & 0 deletions content/i18n/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Easing Functions
Empty file added layout/action.js.coffee
Empty file.
1 change: 1 addition & 0 deletions layout/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
10 changes: 10 additions & 0 deletions layout/layout.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
!!! 5
%html( lang="#{ r18n.locale.code }" )
%head
%meta( charset='UTF-8' )
%title= t.title
%style= assets['style.css']
%script( src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" )
%body
= yield
%script= assets['action.js']
9 changes: 9 additions & 0 deletions layout/style.css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import 'compass/css3'

*
margin: 0
padding: 0

body
background: white
color: black

0 comments on commit 2bcaa21

Please sign in to comment.