# File lib/backup/cli/utility.rb, line 31 def perform ## # Silence Backup::Logger from printing to STDOUT, if --quiet was specified Logger.quiet = options[:quiet] ## # Update Config variables based on the given options Config.update(options) ## # Load the configuration file Config.load_config! ## # Ensure the :log_path, :cache_path and :tmp_path are created # if they do not yet exist [Config.log_path, Config.cache_path, Config.tmp_path].each do |path| FileUtils.mkdir_p(path) end ## # Truncate log file if needed Logger.truncate! ## # Prepare all trigger names by splitting them by ',' # and finding trigger names matching wildcard triggers = options[:trigger].split(",") triggers.map!(&:strip).map! {|t| t.include?('*') ? Model.find_matching(t).map(&:trigger) : t }.flatten! ## # Process each trigger triggers.each do |trigger| ## # Find the model for this trigger # Will raise an error if not found model = Model.find(trigger) ## # Prepare and Perform the backup model.prepare! model.perform! ## # Clear the Log Messages for the next potential run Logger.clear! end rescue => err Logger.error Errors::CLIError.wrap(err) exit(1) end