Skip to content

Commit

Permalink
first crack at middleman
Browse files Browse the repository at this point in the history
  • Loading branch information
doolin committed Sep 28, 2012
1 parent e285638 commit c4b33bd
Show file tree
Hide file tree
Showing 16 changed files with 789 additions and 19 deletions.
28 changes: 13 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global

# Ignore bundler config
/.bundle
/vendor/bundle
/log/*
/tmp/*
/db/*.sqlite3
/public/system/*
/coverage/
/spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html

# Ignore the build directory
/build

# Ignore Sass' cache
/.sass-cache
8 changes: 6 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
source 'https://rubygems.org'
source :rubygems

gem 'middleman'
gem "middleman", "~> 3.0.5"
gem "middleman-blog", "~> 3.1.1"
gem "bootstrap-sass"

# For feed.xml.builder
gem "builder", "~> 3.0.0"
14 changes: 12 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
GEM
remote: https://rubygems.org/
remote: http://rubygems.org/
specs:
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
bootstrap-sass (2.1.0.0)
builder (3.0.3)
chunky_png (1.2.6)
coffee-script (2.2.0)
coffee-script-source
Expand All @@ -30,6 +32,10 @@ GEM
middleman-core (= 3.0.5)
middleman-more (= 3.0.5)
middleman-sprockets (~> 3.0.2)
middleman-blog (3.1.1)
maruku (~> 0.6.0)
middleman-core (~> 3.0.1)
tzinfo (~> 0.3.0)
middleman-core (3.0.5)
activesupport (~> 3.2.6)
bundler (~> 1.1)
Expand Down Expand Up @@ -90,6 +96,7 @@ GEM
syntax (1.0.0)
thor (0.15.4)
tilt (1.3.3)
tzinfo (0.3.33)
uglifier (1.2.7)
execjs (>= 0.3.0)
multi_json (~> 1.3)
Expand All @@ -100,4 +107,7 @@ PLATFORMS
ruby

DEPENDENCIES
middleman
bootstrap-sass
builder (~> 3.0.0)
middleman (~> 3.0.5)
middleman-blog (~> 3.1.1)
106 changes: 106 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
###
# Blog settings
###

# Time.zone = "UTC"

activate :blog do |blog|
# blog.prefix = "blog"
# blog.permalink = ":year/:month/:day/:title.html"
# blog.sources = ":year-:month-:day-:title.html"
# blog.taglink = "tags/:tag.html"
# blog.layout = "layout"
# blog.summary_separator = /(READMORE)/
# blog.summary_length = 250
# blog.year_link = ":year.html"
# blog.month_link = ":year/:month.html"
# blog.day_link = ":year/:month/:day.html"
# blog.default_extension = ".markdown"

blog.tag_template = "tag.html"
blog.calendar_template = "calendar.html"

# blog.paginate = true
# blog.per_page = 10
# blog.page_link = "page/:num"
end

page "/feed.xml", :layout => false

###
# Compass
###

# Susy grids in Compass
# First: gem install susy
# require 'susy'

# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end

###
# Page options, layouts, aliases and proxies
###

# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end

# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
# @which_fake_page = "Rendering a fake page with a variable"
# end

###
# Helpers
###

# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes

# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end

set :css_dir, 'stylesheets'

set :js_dir, 'javascripts'

set :images_dir, 'images'

# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
# activate :minify_css

# Minify Javascript on build
# activate :minify_javascript

# Enable cache buster
# activate :cache_buster

# Use relative URLs
# activate :relative_assets

# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher

# Or use a different image path
# set :http_path, "/Content/images/"
end
7 changes: 7 additions & 0 deletions source/2012-01-01-example-article.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Example Article
date: 2012-01-01
tags: example
---

This is an example article. You probably want to delete it and write your own articles!
33 changes: 33 additions & 0 deletions source/calendar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
pageable: true
---
<h1>Archive for
<% case page_type
when 'day' %>
<%= Date.new(year, month, day).strftime('%b %e %Y') %>
<% when 'month' %>
<%= Date.new(year, month, 1).strftime('%b %Y') %>
<% when 'year' %>
<%= year %>
<% end %>
</h1>

<% if paginate %>
<p>Page <%= page_number %> of <%= num_pages %></p>

<% if prev_page %>
<p><%= link_to 'Previous page', prev_page %></p>
<% end %>
<% end %>

<ul>
<% page_articles.each_with_index do |article, i| %>
<li><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></li>
<% end %>
</ul>

<% if paginate %>
<% if next_page %>
<p><%= link_to 'Next page', next_page %></p>
<% end %>
<% end %>
23 changes: 23 additions & 0 deletions source/feed.xml.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title "Blog Name"
xml.subtitle "Blog subtitle"
xml.id "http://blog.url.com/"
xml.link "href" => "http://blog.url.com/"
xml.link "href" => "http://blog.url.com/feed.xml", "rel" => "self"
xml.updated blog.articles.first.date.to_time.iso8601
xml.author { xml.name "Blog Author" }

blog.articles[0..5].each do |article|
xml.entry do
xml.title article.title
xml.link "rel" => "alternate", "href" => article.url
xml.id article.url
xml.published article.date.to_time.iso8601
xml.updated article.date.to_time.iso8601
xml.author { xml.name "Article Author" }
xml.summary article.summary, "type" => "html"
xml.content article.body, "type" => "html"
end
end
end
Binary file added source/images/background.png
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 source/images/middleman.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions source/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
pageable: true
per_page: 10
---
<% if paginate %>
<p>Page <%= page_number %> of <%= num_pages %></p>

<% if prev_page %>
<p><%= link_to 'Previous page', prev_page %></p>
<% end %>
<% end %>

<% page_articles.each_with_index do |article, i| %>
<h2><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></h2>
<p><%= article.summary %></p>
<% end %>

<% if paginate %>
<% if next_page %>
<p><%= link_to 'Next page', next_page %></p>
<% end %>
<% end %>
1 change: 1 addition & 0 deletions source/javascripts/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= require_tree .
36 changes: 36 additions & 0 deletions source/layout.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv='X-UA-Compatible' content='IE=edge;chrome=1' />
</head>
<body>

<div id="main" role="main">
<%= yield %>
</div>

<aside>
<h2>Recent Articles</h2>
<ol>
<% blog.articles[0...10].each do |article| %>
<li><a href="<%= article.url %>"><%= article.title %></a> <span><%= article.date.strftime('%b %e') %></span></li>
<% end %>
</ol>

<h2>Tags</h2>
<ol>
<% blog.tags.each do |tag, articles| %>
<li><a href="<%= tag_path tag %>"><%= tag %> (<%= articles.size %>)</a></li>
<% end %>
</ol>

<h2>By Year</h2>
<ol>
<% blog.articles.group_by {|a| a.date.year }.each do |year, articles| %>
<li><a href="<%= blog_year_path year %>"><%= year %> (<%= articles.size %>)</a></li>
<% end %>
</ol>
</aside>
</body>
</html>
19 changes: 19 additions & 0 deletions source/layouts/layout.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">

<!-- Always force latest IE rendering engine or request Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">

<!-- Use title if it's in the page YAML frontmatter -->
<title><%= data.page.title || "The Middleman" %></title>

<%= stylesheet_link_tag "normalize", "all" %>
<%= javascript_include_tag "all" %>
</head>

<body class="<%= page_classes %>">
<%= yield %>
</body>
</html>
55 changes: 55 additions & 0 deletions source/stylesheets/all.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@charset "utf-8";

body {
background: #d4d4d4 url("../images/background.png");
text-align: center;
font-family: sans-serif; }

h1 {
color: rgba(0, 0, 0, .3);
font-weight: bold;
font-size: 32px;
letter-spacing: -1px;
text-transform: uppercase;
text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
background: url("../images/middleman.png") no-repeat center 100px;
padding: 350px 0 10px;
margin: 0; }

.doc {
font-size: 14px;
margin: 0; }
.doc:before,
.doc:after {
opacity: .2;
padding: 6px;
font-style: normal;
position: relative;
content: "•"; }
.doc a {
color: rgba(0, 0, 0, 0.3); }
.doc a:hover {
color: #666; }

.welcome {
-webkit-animation-name: welcome;
-webkit-animation-duration: .9s; }

@-webkit-keyframes welcome {
from {
-webkit-transform: scale(0);
opacity: 0;
}
50% {
-webkit-transform: scale(0);
opacity: 0;
}
82.5% {
-webkit-transform: scale(1.03);
-webkit-animation-timing-function: ease-out;
opacity: 1;
}
to {
-webkit-transform: scale(1);
}
}
Loading

0 comments on commit c4b33bd

Please sign in to comment.