-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscheduler.rb
43 lines (34 loc) · 1.3 KB
/
scheduler.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
require "active_support"
require "./lib/calendar_collection"
puts "Enter start date -- the first day of the inning you want to copy:"
print "<YYYY-MM-DD> (e.g. 2015-11-02)> "
start = Date.parse(gets.chomp)
puts "Enter end date -- the last day of the last inning to copy:"
print "<YYYY-MM-DD> (e.g. 2015-11-02)> "
finish = Date.parse(gets.chomp)
puts "How many weeks of data are we copying (include intermission week/weeks AFTER the inning too!!)"
print "(default: 7)> "
input = gets.chomp
offset = (input.empty? ? 7 : input.to_i)
puts "Do you want to remove existing zoom links from your event description? (y/n)"
print "(default: y)> "
bool_input = gets.chomp
remove_zoom_links = bool_input == "y" || bool_input.empty?
calendars = CalendarCollection.new
calendars.each do |calendar|
adjusted_calendar =
calendar.create_future_shifted_calendar(
start,
finish,
offset,
remove_zoom_links,
)
filename = "#{calendar.title}-#{Time.now.to_i}.ics"
outpath = File.expand_path("./output/#{filename}")
File.open(outpath, "w") { |file| file.write(adjusted_calendar.to_ical) }
puts "Wrote shifted cal for #{calendar.title} to #{outpath}"
end
# special shift for post holidays
# 2015-11-30 to 2015-12-18 - 9 weeks
# 2016-01-04 to 2016-01-22 - 7 weeks
# Then hackily combine these suckers with ical