Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
# frozen_string_literal: true
namespace :pundit do
desc 'Show the latest Pundit security warnings'
task :warnings, [:lines] => :environment do |_t, args|
lines = args[:lines]&.to_i || 50
log_file = Rails.root.join('log', "pundit_security_#{Rails.env}.log")
if File.exist?(log_file)
puts "\nπ Latest #{lines} Pundit security warnings:\n"
puts 'β' * 80
system("tail -n #{lines} #{log_file}")
puts 'β' * 80
# Count warnings per controller
puts "\nπ Summary:"
warnings = File.readlines(log_file).select { |line| line.include?('SECURITY WARNING') }
controller_counts = warnings.group_by { |w| w[/(\w+Controller)#/, 1] }.transform_values(&:count)
controller_counts.sort_by { |_, count| -count }.each do |controller, count|
puts " β’ #{controller}: #{count} warnings"
end
puts "\nπ΄ Total: #{warnings.count} warnings\n\n"
else
puts "β No Pundit security log file found: #{log_file}"
end
end
desc 'Clear the Pundit security log'
task clear_log: :environment do
log_file = Rails.root.join('log', "pundit_security_#{Rails.env}.log")
if File.exist?(log_file)
File.truncate(log_file, 0)
puts "β
Pundit security log cleared: #{log_file}"
else
puts "β No log file found: #{log_file}"
end
end
desc 'Show live updates of the Pundit warnings'
task watch: :environment do
log_file = Rails.root.join('log', "pundit_security_#{Rails.env}.log")
if File.exist?(log_file)
puts "π Watching Pundit security log... (Ctrl+C to quit)\n\n"
system("tail -f #{log_file}")
else
puts "β No log file found: #{log_file}"
end
end
end