Sha256: 9f0c3ea4998a15c423466c55c151ecd0ed88e2a460de7c42ac08bd4f5202129f
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true namespace :oh_my_log do desc 'Generate the observers for each ActiveRecord model' # in futuro fare che puoi passare parametri e in base a quello limita gli observer da generare task generate_observers: :environment do raise "Cannot create observers without an initializer, did you created it with 'oh_my_log:generate_initializer'" unless File.file?(Rails.root + 'config/initializers/oh_my_log_initializer.rb') OhMyLog::ObserverFactory.generate_collection end desc 'Generate a template initializer for OhMyLog' # in futuro puoi passare direttamente qui alcune impostazioni dell' initialize task generate_initializer: :environment do raise 'The initializer has been already generated!' if File.file?(Rails.root + 'config/initializers/oh_my_log_initializer') OhMyLog.generate_initializer end desc 'Install the gem by building initializer and observers' task install: :environment do OhMyLog.generate_initializer p "generated initializer" sleep(1) require Rails.root + "config/initializers/oh_my_log_initializer.rb" OhMyLog::ObserverFactory.generate_collection p "generated collections" end desc 'Clean observers and initializer' task clean: :environment do OhMyLog.destroy_initializer OhMyLog::ObserverFactory.remove_collection end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oh_my_log-1.0.1 | lib/tasks/oh_my_log.rake |