rework notify system (wip)

This commit is contained in:
Leon van Kammen 2025-10-29 10:47:55 +01:00
parent 2d558bf6f0
commit 2228c8035d
12 changed files with 22 additions and 2 deletions

View file

@ -88,7 +88,7 @@ start_hook_daemon(){
echocolor "[$APPNAME]" "listening to inotify events in $dir"
# scan for '/mnt/experiences/creatorname/#234/ MODIFY foo.glb' e.g.
# scan for '/mnt/experiences/creatorname/#234/ MOVED_TO foo.glb' e.g.
inotifywait -r -m $dir | awk '$2 ~ /(CREATE|MODIFY|MOVED_TO|DELETE)/ { system("'$0' hook inotify_"$2" "$1""$3) }' &
inotifywait -r -m $dir | awk '/.*/ { print $0 }; $2 ~ /(CREATE|MODIFY|MOVED_TO|DELETE)/ && $3 ~ /datapackage/ { system("'$0' hook datapackage_"$2" "$1""$3) }' &
done
# force-trigger processing hooks in /mnt

View file

@ -0,0 +1 @@
datapackage_MODIFY

View file

@ -1 +0,0 @@
inotify_MODIFY

View file

@ -0,0 +1,20 @@
Rails.application.config.to_prepare do
Model # Zeitwerk autoload model
# Reopen the Model class to add new functionality
# This must match the name of your ActiveRecord class exactly.
class Model
# The 'after_save' macro is now run within the context of the existing Model class.
after_save :execute_initializer_after_save
# Define the new method to be executed on save.
def execute_initializer_after_save
# Your custom logic to execute after Model.save or Model.update! goes here.
# 📝 Example Logic:
puts "\n-------- JA --------- #{self.id}\n\n"
end
end
end