Script for generating Stammtisch data
This commit is contained in:
parent
3d8a77defa
commit
cb3ffbd96e
2 changed files with 130 additions and 54 deletions
34
scripts/generate-stammtisch.rb
Executable file
34
scripts/generate-stammtisch.rb
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env ruby
|
||||
# encoding: utf-8
|
||||
|
||||
require 'date'
|
||||
require 'yaml'
|
||||
|
||||
year=ARGV[0].to_i
|
||||
result = { 'events' => [] }
|
||||
|
||||
for month in 1..12
|
||||
date = DateTime.new(year,month,1,18,0,0)
|
||||
firsttuesday = if (date.wday<=2)
|
||||
date + (2-date.wday)
|
||||
else
|
||||
date + (9-date.wday)
|
||||
end
|
||||
result['events'] << {
|
||||
'startdate' => firsttuesday.to_time,
|
||||
'duration' => '4h',
|
||||
'location' => {
|
||||
'location' => 'zadu'
|
||||
}
|
||||
}
|
||||
result['events'] << {
|
||||
'startdate' => (firsttuesday+15).to_time,
|
||||
'duration' => '4h',
|
||||
'location' => {
|
||||
'location' => 'shack'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
puts result.to_yaml
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue