Skip to content

Commit

Permalink
Ruby and Sentry bump
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNaessens committed May 26, 2024
1 parent d3172ec commit 9e0c23f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.2
3.3.1
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ruby 3.1.2
ruby 3.3.1
yarn 1.22.19
nodejs 16.15.0
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.2"
ruby "3.3.1"

# ed25519 ssh key support
gem "bcrypt_pbkdf", ">= 1.0", "< 2.0"
Expand Down Expand Up @@ -78,6 +78,7 @@ gem "rswag-ui"
# Sentry
gem "sentry-rails"
gem "sentry-ruby"
gem "stackprof"

group :development, :test do
gem "factory_bot_rails"
Expand Down
20 changes: 12 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ GEM
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.6)
minitest (5.16.3)
msgpack (1.6.0)
multi_xml (0.6.0)
Expand All @@ -192,10 +193,9 @@ GEM
net-protocol
timeout
net-ssh (7.0.1)
nio4r (2.5.8)
nokogiri (1.13.9-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.9-x86_64-linux)
nio4r (2.7.3)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
oauth2 (2.0.2)
faraday (>= 0.17.3, < 3.0)
Expand Down Expand Up @@ -336,11 +336,13 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.5.3-x86_64-darwin)
sqlite3 (1.5.3-x86_64-linux)
sqlite3 (1.7.3-arm64-darwin)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
sshkit (1.21.3)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stackprof (0.2.26)
stimulus-rails (1.1.0)
railties (>= 6.0.0)
strscan (3.0.4)
Expand Down Expand Up @@ -374,6 +376,7 @@ GEM
zeitwerk (2.6.1)

PLATFORMS
arm64-darwin-23
x86_64-darwin-21
x86_64-linux

Expand Down Expand Up @@ -418,14 +421,15 @@ DEPENDENCIES
sentry-ruby
sprockets-rails
sqlite3 (~> 1.5)
stackprof
stimulus-rails
turbo-rails
tzinfo-data
web-console
webdrivers

RUBY VERSION
ruby 3.1.2p20
ruby 3.3.1p55

BUNDLED WITH
2.3.18
2.5.10
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
protect_from_forgery with: :exception

include SentryUserContext

rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, alert: exception.message
end
Expand Down
24 changes: 24 additions & 0 deletions app/controllers/concerns/sentry_user_context.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

module SentryUserContext
extend ActiveSupport::Concern

included do
before_action :set_sentry_context
end

private

def sentry_user_context
{}.tap do |user|
next unless current_user

user[:id] = current_user.id
user[:name] = current_user.name
end
end

def set_sentry_context
Sentry.set_user(sentry_user_context)
end
end

0 comments on commit 9e0c23f

Please sign in to comment.