Script for generating Vortragsreihe event placeholders

This commit is contained in:
Stefan Schlott 2015-02-19 23:01:39 +01:00
parent c2f1975499
commit 5a8cb978dc
2 changed files with 77 additions and 14 deletions

View file

@ -0,0 +1,38 @@
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'date'
require 'yaml'
def event(day, dayoffset, title)
startDate = Time.local(day.year, day.month, day.day + dayoffset, 19, 30, 0)
{
'title' => title,
'startdate' => startDate,
'duration' => '2h',
'location' => {
'location' => 'bib'
}
}
end
year=ARGV[0].to_i
result = { 'events' => [] }
for month in 1..12
date = Date.new(year,month,1)
firstthursday = if (date.wday<=4)
date + (4-date.wday)
else
date + (11-date.wday)
end
result['events'] << event(firstthursday, 7, 'CCCS Vortragsreihe (Thema noch offen)')
end
puts result.to_yaml