-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.rb
72 lines (56 loc) · 1.82 KB
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
require_relative 'zwiftcal'
activate :dotenv
# Activate gzip compression
activate :gzip
ignore 'vendor'
ignore '.env'
ignore 'ical'
set :css_dir, 'css'
set :js_dir, 'js'
set :images_dir, 'img'
set :fonts_dir, "fonts"
set :file_watcher_ignore,[
/^bin(\/|$)/,
/^\.bundle(\/|$)/,
/^.c9(\/|$)/,
/^node_modules(\/|$)/,
/^\.sass-cache(\/|$)/,
/^\.cache(\/|$)/,
/^\.git(\/|$)/,
/^\.gitignore$/,
/\.DS_Store/,
/^\.rbenv-.*$/,
/^Gemfile$/,
/^Gemfile\.lock$/,
/~$/,
/(^|\/)\.?#/,
/^tmp\//
]
# binding.pry
main_events = ZwiftCal.events()
sports = main_events.collect{|e| e['sport'].downcase }.sort.uniq
sports.each do |sport|
sport_events = main_events.select{|e| e['sport']==sport.upcase}
proxy "/#{sport}/rides", "ical", locals: {e: ZwiftCal.new(sport_events.select{|e| e['eventType'] == 'GROUP_RIDE'} ) }
proxy "/#{sport}/workouts", "ical", locals: {e: ZwiftCal.new(sport_events.select{|e| e['eventType'] == 'GROUP_WORKOUT' } ) }
race_events = sport_events.select{|e| e['eventType'] == 'RACE' }
proxy "/#{sport}/races", "ical", locals: {e: ZwiftCal.new(race_events) }
# [A..E].do |klass|
# proxy "/#{sport}/races/#{klass}", "ical", locals: {e: ZwiftCal.new(race_events.select{|e| e['eventSubgroups'].include? 'RACE' } ) }
# end
# Get all Unique Tags
sport_events.collect{|e| e['tags']}.flatten.select{|t| !t.include?('=') }.sort.uniq.each do |tag|
tag_events = (ZwiftCal.events(tag: tag)||[]).select{|e| e['sport'] == sport.upcase}
puts "#{sport.upcase}: Found #{tag_events.length} Events for #{tag}"
proxy "/#{sport}/tag/#{tag}", "ical", locals: {e: ZwiftCal.new(tag_events) }
end
end
configure :server do
end
configure :development do
end
configure :production do
end
# Build-specific configuration
configure :build do
end