Skip to content

Commit 8e426a2

Browse files
committed
Initial commit
0 parents  commit 8e426a2

7 files changed

+588
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Taxonomy of Scala
2+
This is a repo for my work on the presentation I will be giving at StrangeLoop 2012. To see the rendered presentation (sans images), go to [this page](https://github.com/jamie-allen/taxonomy-of-scala/blob/master/preso/presentation.md).
3+
4+
A ShowOff presentation based on [Brian Clapper's](https://github.com/scala-phase/scala-orms/tree/master/ScalaQuery) presentation template.
5+
6+
For more information about ShowOff, see [Shawn Chacon's page](https://github.com/schacon/showoff).
7+
8+
## Commands:
9+
* "rake css" to generate CSS from SASS
10+
* "rake run" to serve pages (or you can use "showoff serve")
11+
12+
## Requires the following Ruby gems:
13+
* rubygems
14+
* showoff
15+
* sass
16+
* slidedown
17+
* albino
18+
19+
## Optional Ruby gems:
20+
* mongrel (to serve pages with Mongrel instead of WebRick)
21+
* pdfkit (to generate PDF of presentation)

Rakefile

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# -*- ruby -*-
2+
# Generate HTML slides, for S5, from Markdown input.
3+
#
4+
# See README.md for pre-requisites.
5+
# ---------------------------------------------------------------------------
6+
7+
require 'rubygems'
8+
require 'rake/clean'
9+
require 'slidedown'
10+
require 'albino'
11+
12+
PRESO_DIR = 'preso'
13+
SLIDE_INPUTS = FileList[File.join(PRESO_DIR, '*.md')]
14+
SASS_DIR = "sass"
15+
DATA_DIR = "data"
16+
CSS_DIR = "."
17+
18+
SASS_FILES = FileList["#{SASS_DIR}/*.scss"]
19+
CSS_OUTPUT_FILES = SASS_FILES.map do |f|
20+
f.gsub(/^#{SASS_DIR}/, CSS_DIR).gsub(/\.scss$/, '.css')
21+
end
22+
23+
CLEAN << CSS_OUTPUT_FILES
24+
CLEAN << FileList['*.html']
25+
CLEAN << "static"
26+
PWD = File.dirname(__FILE__)
27+
28+
task :default => :slides
29+
task :css => CSS_OUTPUT_FILES
30+
task :run => :css do
31+
sh "showoff serve"
32+
end
33+
34+
task :slides => ['Rakefile'] + CSS_OUTPUT_FILES + SLIDE_INPUTS do |t|
35+
sh "showoff static"
36+
cp "chariot.png", File.join("static", "file")
37+
cp FileList[File.join(PRESO_DIR, "*.png")], "static"
38+
fix_static_html(File.join("static", "index.html"))
39+
end
40+
41+
def fix_static_html(path)
42+
# Not sure why ShowOff does this, but image URLs get preceded with a
43+
# file: URL.
44+
require 'tempfile'
45+
temp = Tempfile.new('static')
46+
begin
47+
static_index = File.join("static", "index.html")
48+
preso_url = "file://" + File.expand_path(PRESO_DIR) + "/"
49+
File.open(static_index).readlines.each do |line|
50+
temp.write(line.sub(%r|#{preso_url}|, ""))
51+
end
52+
temp.rewind
53+
File.open(static_index, 'w') do |f|
54+
f.write temp.read
55+
end
56+
ensure
57+
temp.close
58+
temp.unlink
59+
end
60+
end
61+
62+
# ---------------------------------------------------------------------------
63+
# Auto-generate CSS files from any SASS input files.
64+
65+
directory CSS_DIR
66+
67+
# Figure out the name of the SCSS file necessary make a CSS file.
68+
def css_to_scss
69+
Proc.new {|task| task.sub(/^#{CSS_DIR}/, SASS_DIR).
70+
sub(/\.css$/, '.scss')}
71+
end
72+
73+
rule %r{^#{CSS_DIR}/.*\.css$} => [css_to_scss, 'Rakefile'] + SASS_FILES do |t|
74+
require 'sass'
75+
mkdir_p CSS_DIR
76+
puts("#{t.source} -> #{t.name}")
77+
Dir.chdir('sass') do
78+
sass_input = File.basename(t.source)
79+
engine = Sass::Engine.new(File.open(sass_input).readlines.join(''),
80+
:syntax => :scss)
81+
out = File.open(File.join('..', t.name), 'w')
82+
out.write("/* AUTOMATICALLY GENERATED FROM #{t.source} on #{Time.now} */\n")
83+
out.write(engine.render)
84+
# Force close, to force flush BEFORE running other tasks.
85+
out.close
86+
end
87+
end
88+

preso/300px-Schema_chipsatz.png

33.4 KB
Loading

preso/Schema_chipsatz.png

10.5 KB
Loading

0 commit comments

Comments
 (0)