lib/backup/storage/cycler.rb in backup-3.3.2 vs lib/backup/storage/cycler.rb in backup-3.4.0

- old
+ new

@@ -8,12 +8,13 @@ ## # Adds the given +package+ to the YAML storage file corresponding # to the given +storage+ and Package#trigger (Model#trigger). # Then, calls the +storage+ to remove the files for any older # packages that were removed from the YAML storage file. - def cycle!(storage, package) - @storage, @package = storage, package + def cycle!(storage) + @storage = storage + @package = storage.package @storage_file = storage_file update_storage_file! remove_packages! end @@ -50,13 +51,12 @@ ## # Return full path to the YAML data file, # based on the current values of @storage and @package def storage_file - type = @storage.class.to_s.split('::').last - suffix = @storage.storage_id.to_s.strip.gsub(/[\W]/, '_') - filename = suffix.empty? ? type : "#{type}-#{suffix}" - File.join(Config.data_path, @package.trigger, "#{filename}.yml") + filename = @storage.class.to_s.split('::').last + filename << "-#{ @storage.storage_id }" if @storage.storage_id + File.join(Config.data_path, @package.trigger, "#{ filename }.yml") end ## # Load Package objects from YAML file. # Returns an Array, sorted by @time descending.