From 89984977e0f3386d94e3466c54743a50da7cf9bf Mon Sep 17 00:00:00 2001 From: Ben Rexin Date: Thu, 15 Aug 2024 21:47:34 +0200 Subject: [PATCH] chore: replace ri_cal with icalendar based upon https://github.com/rubyredrick/ri_cal/pull/22#issuecomment-1001147689 i assume phoet intended to replace the quite outdated ri_cal with icalendar a while ago. so doing it now :) --- Gemfile | 2 +- Gemfile.lock | 14 ++++---------- app/helpers/ical_helper.rb | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/Gemfile b/Gemfile index 821f4d53e..0aa1c5c19 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'public_suffix' gem 'puma' gem 'rack-cache' gem 'redcarpet' -gem 'ri_cal', github: 'phoet/ri_cal', branch: 'master' +gem 'icalendar' gem 'simple_form' gem 'slim-rails' gem 'sprockets', '~> 3.7' diff --git a/Gemfile.lock b/Gemfile.lock index 136197993..757347da5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,3 @@ -GIT - remote: https://github.com/phoet/ri_cal.git - revision: 0c607408f931ebbbed1c5e4dd6e4eb22572f268f - branch: master - specs: - ri_cal (0.8.8) - activesupport (> 2.2) - tzinfo (> 2.0) - GEM remote: http://rubygems.org/ specs: @@ -135,6 +126,9 @@ GEM hashie (5.0.0) i18n (1.14.4) concurrent-ruby (~> 1.0) + icalendar (2.10.2) + ice_cube (~> 0.16) + ice_cube (0.17.0) image_info (1.2.2) addressable (~> 2.0) image_size (~> 2.0) @@ -459,6 +453,7 @@ DEPENDENCIES faker font-awesome-rails geocoder + icalendar kaminari kgio letter_opener @@ -480,7 +475,6 @@ DEPENDENCIES rails-controller-testing rails_12factor redcarpet - ri_cal! rspec-collection_matchers rspec-rails rubocop diff --git a/app/helpers/ical_helper.rb b/app/helpers/ical_helper.rb index d54708599..7f7481526 100644 --- a/app/helpers/ical_helper.rb +++ b/app/helpers/ical_helper.rb @@ -2,18 +2,18 @@ module IcalHelper def icalendar(*events) - RiCal.Calendar do |cal| - events.each do |event| - cal.event do |item| - item.summary = event.name - item.description = "#{event.description} #{event_url(event)}" - item.dtstart = event.date - item.dtend = event.end_date - item.url = event_url(event) - item.location = event.location.name if event.location - end + cal = Icalendar::Calendar.new + events.map do |event| + cal.event do |item| + item.summary = event.name + item.description = "#{event.description} #{event_url(event)}" + item.dtstart = event.date + item.dtend = event.end_date + item.url = event_url(event) + item.location = event.location.name if event.location end - end.to_s + end + cal.to_ical end def calendar_link