Output an ical file
Almost there—but we’re only adding birthdays to the current year.
This commit is contained in:
parent
36d1e481e9
commit
db982373c7
|
@ -6,8 +6,8 @@ require "yaml"
|
||||||
class Birthdaze < Thor
|
class Birthdaze < Thor
|
||||||
desc "generate", "Generate calendars"
|
desc "generate", "Generate calendars"
|
||||||
def generate
|
def generate
|
||||||
puts "Generate calendars"
|
puts "Writing ical file to #{config['ical_output']}"
|
||||||
puts calendar.inspect
|
File.open(config["ical_output"], 'w') { |file| file.write(calendar.to_ical) }
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "list", "List birthdays"
|
desc "list", "List birthdays"
|
||||||
|
@ -90,11 +90,7 @@ class Birthdaze < Thor
|
||||||
end
|
end
|
||||||
|
|
||||||
def summary(name, birthday)
|
def summary(name, birthday)
|
||||||
return "#{name}’s birthday" if birthday.start_with?("-") || birthday.start_with?("1604")
|
return "🎂 #{name}’s birthday"
|
||||||
|
|
||||||
birth_year = birthday[0..3].to_i
|
|
||||||
age = Date.today.year - birth_year + 1
|
|
||||||
"🎂 #{name}’s #{age} birthday"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_reminders
|
def set_reminders
|
||||||
|
|
Loading…
Reference in New Issue