lib/backup_repos/backup.rb in backup_repos-0.3.0 vs lib/backup_repos/backup.rb in backup_repos-0.4.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require_relative 'performers/base_git'
require_relative 'backup_github'
require_relative 'backup_bitbucket'
require_relative 'backup_gitlab_endpoint'
require_relative 'backup_gitlab'
@@ -20,20 +22,26 @@
process_gitlab
end
def process_github
return unless valid?
+ return unless BackupRepos.config.github_access_token
+
BackupGithub.new.process
end
def process_bitbucket
return unless valid?
+ return unless BackupRepos.config.bitbucket
+
BackupBitbucket.new.process
end
def process_gitlab
return unless valid?
+ return unless BackupRepos.config.gitlab
+
BackupGitlab.new.process
end
def valid?
errors.blank?
@@ -52,9 +60,10 @@
if backup_root.blank?
errors.push('Backup directory is not specified.') && return
end
return if File.exist?(backup_root)
+
errors << 'Backup directory does not exists.'
end
def inform_about_error!
puts errors.first.red