2016-06-09 14:27:23 +02:00
|
|
|
#!/usr/bin/env ruby
|
2016-07-19 08:39:52 +02:00
|
|
|
# frozen_string_literal: true
|
2016-06-09 14:27:23 +02:00
|
|
|
|
2016-07-20 14:38:50 +02:00
|
|
|
require 'json'
|
2016-07-27 00:13:36 +02:00
|
|
|
require 'icalendar'
|
2016-07-20 14:38:50 +02:00
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# PREPROCESS
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2016-07-20 14:38:50 +02:00
|
|
|
preprocess do
|
2016-10-04 23:22:10 +02:00
|
|
|
`npm install`
|
|
|
|
|
2016-10-15 21:32:45 +02:00
|
|
|
# We don't want to compile old blogposts in development
|
2016-12-11 00:55:11 +01:00
|
|
|
ignore_old_blogposts if development?
|
|
|
|
update_blog_attributes
|
|
|
|
create_blog_items
|
|
|
|
convert_event_time_to_timestamps
|
2016-07-20 14:38:50 +02:00
|
|
|
end
|
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# COMPILATION
|
|
|
|
#
|
|
|
|
#
|
2016-08-04 20:57:25 +02:00
|
|
|
compile '/feed.xml' do
|
2016-07-26 20:08:42 +02:00
|
|
|
filter :erb
|
2016-08-04 20:57:25 +02:00
|
|
|
write '/feed.xml'
|
2016-07-26 20:08:42 +02:00
|
|
|
end
|
2016-07-23 22:43:46 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# ARCHIVES
|
|
|
|
#
|
2016-09-22 21:23:40 +02:00
|
|
|
compile '/blog/*' do
|
2016-07-23 22:06:06 +02:00
|
|
|
layout '/archive_page.*'
|
2016-07-23 21:17:24 +02:00
|
|
|
layout '/generic.*'
|
|
|
|
layout '/default.*'
|
2016-07-19 10:27:27 +02:00
|
|
|
filter :erb
|
2016-12-29 13:37:22 +01:00
|
|
|
filter :html_press if production?
|
2016-06-09 14:27:23 +02:00
|
|
|
end
|
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
2016-08-23 20:21:02 +02:00
|
|
|
# EVENTS
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
2016-08-23 20:21:02 +02:00
|
|
|
compile '/events/**/*' do
|
2016-06-09 15:04:10 +02:00
|
|
|
filter :kramdown
|
2016-07-18 09:24:24 +02:00
|
|
|
|
2016-07-19 10:27:27 +02:00
|
|
|
layout '/eventpost.*'
|
|
|
|
layout '/default.*'
|
2016-07-12 23:58:08 +02:00
|
|
|
filter :erb
|
2016-12-29 13:37:22 +01:00
|
|
|
filter :html_press if production?
|
2016-06-09 15:04:10 +02:00
|
|
|
end
|
2016-06-09 14:27:23 +02:00
|
|
|
|
2016-08-23 20:21:02 +02:00
|
|
|
compile '/events/**/*', rep: :text do
|
2016-07-20 17:52:56 +02:00
|
|
|
filter :kramdown
|
|
|
|
filter :strip_html
|
|
|
|
end
|
|
|
|
|
2016-08-23 20:21:02 +02:00
|
|
|
compile '/events/**/*', rep: :ical do
|
2016-07-27 00:13:36 +02:00
|
|
|
filter :ical
|
|
|
|
end
|
|
|
|
|
2016-08-23 20:21:02 +02:00
|
|
|
#
|
|
|
|
# POSTS
|
|
|
|
#
|
2016-10-31 13:48:39 +01:00
|
|
|
compile '/blog/*/*' do
|
2016-10-31 12:29:44 +01:00
|
|
|
layout '/blogpost.md'
|
2016-08-23 20:21:02 +02:00
|
|
|
filter :kramdown
|
|
|
|
|
2016-10-31 12:29:44 +01:00
|
|
|
layout '/blogpost.erb'
|
2016-08-23 20:21:02 +02:00
|
|
|
layout '/generic.*'
|
|
|
|
layout '/default.*'
|
2016-12-29 13:37:22 +01:00
|
|
|
filter :erb
|
|
|
|
filter :html_press if production?
|
2016-08-23 20:21:02 +02:00
|
|
|
end
|
|
|
|
|
2016-10-31 13:48:39 +01:00
|
|
|
compile '/blog/*/*', rep: :text do
|
2016-08-23 20:21:02 +02:00
|
|
|
filter :kramdown
|
|
|
|
filter :strip_html
|
|
|
|
end
|
|
|
|
|
2016-10-03 21:56:08 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# PROJECTS
|
|
|
|
#
|
|
|
|
compile '/projects/*' do
|
|
|
|
filter :kramdown
|
|
|
|
end
|
|
|
|
|
2016-10-15 21:43:29 +02:00
|
|
|
# Don't create specific project pages for now
|
2016-10-30 14:50:51 +01:00
|
|
|
route '/projects/*' do; end
|
2016-10-15 21:43:29 +02:00
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
|
|
|
# GENERIC ERB PAGES
|
|
|
|
#
|
2016-10-04 16:25:03 +02:00
|
|
|
compile '/*_search.json' do
|
2016-07-24 13:09:37 +02:00
|
|
|
filter :erb
|
|
|
|
end
|
|
|
|
|
2016-08-04 20:57:25 +02:00
|
|
|
compile '/**/*.ics' do
|
2016-07-27 00:13:36 +02:00
|
|
|
filter :erb
|
|
|
|
end
|
|
|
|
|
2016-11-01 17:11:51 +01:00
|
|
|
compile '/**/*.erb' do
|
2016-07-23 22:06:06 +02:00
|
|
|
layout '/generic.*'
|
|
|
|
layout '/default.*'
|
|
|
|
filter :erb
|
2016-12-29 13:37:22 +01:00
|
|
|
filter :html_press if production?
|
2016-07-23 22:06:06 +02:00
|
|
|
end
|
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
|
|
|
# ASSETS
|
|
|
|
#
|
|
|
|
compile '/assets/scripts/**/*.coffee' do
|
|
|
|
filter :coffeescript
|
|
|
|
end
|
|
|
|
|
2016-08-02 18:31:40 +02:00
|
|
|
ignore '/assets/stylesheets/includes/**/*'
|
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
compile '/assets/stylesheets/**/*.scss' do
|
|
|
|
filter :sass, syntax: :scss
|
2016-10-15 21:32:45 +02:00
|
|
|
filter :autoprefixer if production?
|
2016-07-23 22:43:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# ROUTES
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# ASSETS
|
|
|
|
#
|
2016-07-18 23:34:38 +02:00
|
|
|
route '/assets/stylesheets/**/*' do
|
|
|
|
"#{item.identifier.without_ext}.css"
|
|
|
|
end
|
|
|
|
|
|
|
|
route '/assets/scripts/**/*' do
|
|
|
|
"#{item.identifier.without_ext}.js"
|
|
|
|
end
|
|
|
|
|
2016-10-15 21:32:45 +02:00
|
|
|
# EVENTS
|
2016-08-23 20:21:02 +02:00
|
|
|
route '/events/**/*', rep: :ical do
|
2016-07-27 00:13:36 +02:00
|
|
|
"#{item.identifier.without_ext}.ics"
|
|
|
|
end
|
|
|
|
|
2016-07-18 09:27:32 +02:00
|
|
|
route '/**/*.{erb,html,md}' do
|
2016-08-30 23:37:32 +02:00
|
|
|
if item.identifier.without_ext.to_s =~ %r{/index$}
|
|
|
|
"#{item.identifier.without_ext}.html"
|
|
|
|
else
|
|
|
|
"#{item.identifier.without_ext}/index.html"
|
|
|
|
end
|
2016-06-09 14:27:23 +02:00
|
|
|
end
|
|
|
|
|
2016-12-11 00:55:11 +01:00
|
|
|
# Let anything else simply pass through
|
|
|
|
passthrough '/**/*'
|
|
|
|
|
2016-07-23 22:43:46 +02:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# LAYOUTS
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2016-06-09 14:27:23 +02:00
|
|
|
layout '/**/*', :erb
|