lib/backup_repos/backup.rb in backup_repos-0.1.0 vs lib/backup_repos/backup.rb in backup_repos-0.2.0

- old
+ new

@@ -1,8 +1,10 @@ require_relative 'performers/base_git' require_relative 'backup_github' require_relative 'backup_bitbucket' +require_relative 'backup_gitlab_endpoint' +require_relative 'backup_gitlab' module BackupRepos class Backup attr_reader :errors @@ -11,16 +13,30 @@ validate! end def process + process_github + process_bitbucket + process_gitlab + end + + def process_github return unless valid? + BackupGithub.new.process + end - BackupGithub.process - BackupBitbucket.process + def process_bitbucket + return unless valid? + BackupBitbucket.new.process end + def process_gitlab + return unless valid? + BackupGitlab.new.process + end + def valid? errors.blank? end private @@ -35,12 +51,11 @@ if backup_root.blank? errors.push('Backup directory is not specified.') && return end - unless File.exist?(backup_root) - errors << 'Backup directory is not exists.' - end + return if File.exist?(backup_root) + errors << 'Backup directory does not exists.' end def inform_about_error! puts errors.first.red end