Skip to content

Commit

Permalink
chore: replace ri_cal with icalendar
Browse files Browse the repository at this point in the history
based upon rubyredrick/ri_cal#22 (comment) i assume phoet intended to replace the quite outdated ri_cal with icalendar a while ago.
so doing it now :)
  • Loading branch information
salzig authored and JoschkaSchulz committed Sep 16, 2024
1 parent 1c16005 commit 8998497
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
14 changes: 4 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -459,6 +453,7 @@ DEPENDENCIES
faker
font-awesome-rails
geocoder
icalendar
kaminari
kgio
letter_opener
Expand All @@ -480,7 +475,6 @@ DEPENDENCIES
rails-controller-testing
rails_12factor
redcarpet
ri_cal!
rspec-collection_matchers
rspec-rails
rubocop
Expand Down
22 changes: 11 additions & 11 deletions app/helpers/ical_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8998497

Please sign in to comment.