Skip to content

Commit 7d49ca4

Browse files
author
Pete Nicholls
committed
Basic talk structure
1 parent faca104 commit 7d49ca4

File tree

13 files changed

+203
-82
lines changed

13 files changed

+203
-82
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@
1616
# Ignore .DS_store file
1717
.DS_Store
1818

19-
# Ignore cheat-sheet
20-
cheat-sheet.txt

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0.0

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# NZ Ruby Talks
2+
3+
Talks given at NZ Ruby groups, powered by [Middleman](http://middelmanapp.com).
4+
5+
## Developing
6+
7+
Clone this repository.
8+
9+
On Mac OS X or Linux, `cd` into the project directory and run:
10+
11+
script/setup
12+
13+
On Windows:
14+
15+
1. Install [Ruby 2.0.0](http://ruby-lang.org)
16+
2. Install [Bundler](http://gembundler.com)
17+
3. Run `bundle install` from the project directory

cheat-sheet.txt

Lines changed: 0 additions & 58 deletions
This file was deleted.

config.rb

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
1+
require './lib/talk'
2+
3+
set :project_name, "NZ Ruby Talks"
4+
15
set :css_dir, 'stylesheets'
26
set :js_dir, 'javascripts'
37
set :images_dir, 'images'
48

59
# Use directory indexes, for pretty URLs
6-
activate :directory_indexes
10+
activate :directory_indexes
11+
12+
set :markdown_engine, :redcarpet
13+
set :markdown, fenced_code_blocks: true, smartypants: true
14+
15+
activate :syntax
16+
17+
helpers do
18+
19+
def page_title(separator: " – ")
20+
[current_page.data.title, project_name].compact.join(separator)
21+
end
22+
23+
def talks
24+
Talk.all(sitemap.resources)
25+
end
26+
27+
def current_talk
28+
Talk.new(current_page)
29+
end
30+
31+
end
32+
33+
configure :build do
34+
activate :minify_css
35+
activate :minify_javascript
36+
activate :asset_hash
37+
end

lib/talk.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require 'forwardable'
2+
3+
class Talk < SimpleDelegator
4+
extend Forwardable
5+
6+
def_delegators :data, :title, :author, :intro, :venue
7+
8+
def presented_at
9+
data.date.strftime('%d %h %Y')
10+
end
11+
12+
def timestamp
13+
data.date.iso8601
14+
end
15+
16+
def self.all(resources)
17+
matching_resources = resources.select do |resource|
18+
resource.url.start_with?('/talks')
19+
end
20+
21+
matching_resources.map do |resource|
22+
Talk.new(resource)
23+
end
24+
end
25+
end

script/setup

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
# Exit from the script if any statement not in a conditional returns non-true
4+
set -e
5+
6+
echo "NZ RUBY TALKS"
7+
8+
ruby_version="2.0.0"
9+
10+
# Test for Ruby 2.0.0
11+
if test $(ruby -e "print RUBY_VERSION") = "$ruby_version"
12+
then
13+
echo " + Ruby $ruby_version found."
14+
else
15+
echo "==> You need to install Ruby $ruby_version."
16+
echo " RVM is good place to start: https://rvm.io/"
17+
exit 1
18+
fi
19+
20+
# Test for Bundler
21+
if test $(which bundle)
22+
then
23+
echo " + Bundler found."
24+
else
25+
echo "==> You need to install Bundler. To install it, run:"
26+
echo " gem install bundler"
27+
exit 1
28+
fi
29+
30+
echo " + Installing gems..."
31+
bundle install --quiet
32+
echo " + Gems installed."
33+
34+
cat <<footer
35+
==> You're good to go!
36+
37+
Run 'bundle exec middleman server' to serve the site.
38+
Run 'bundle exec middleman build' to build the site.
39+
footer

source/_talk.html.erb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div class="talk-overview">
2+
<h2><%= link_to talk.title, talk.url %></h2>
3+
4+
<div class="meta">
5+
by <span class="author"><%= talk.author %></span>
6+
on <time datetime="<%= talk.timestamp %>">
7+
<%= talk.presented_at %>
8+
</time>
9+
at <%= talk.venue %>
10+
</div>
11+
12+
<p><%= talk.intro %></p>
13+
</div>

source/index.html.erb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
It's a little empty here…
1+
---
2+
title: All talks
3+
---
4+
5+
<% talks.each do |talk| %>
6+
<%= partial "talk", locals: { talk: talk } %>
7+
<% end %>

source/layouts/layout.erb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title></title>
5+
<title><%= page_title %></title>
6+
<%= stylesheet_link_tag "application" %>
7+
8+
<script type="text/javascript" src="//use.typekit.net/lpd5kis.js"></script>
9+
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
610
</head>
711
<body>
812

913
<aside>
10-
<figure>
11-
<!-- Logo -->
12-
</figure>
14+
<a href="/" class="logo">
15+
<%= image_tag "logo.png", alt: project_name, width: 180 %>
16+
<%= project_name %>
17+
</a>
1318

1419
<nav>
15-
<!-- Navigation -->
20+
<%= link_to "Talks", "/" %>
1621
</nav>
1722
</aside>
1823

0 commit comments

Comments
 (0)