zeus.ugent.be/Rules

162 lines
2.1 KiB
Plaintext
Raw Normal View History

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