class RepoCompare::GitRemoteUpdate

Update the remote source

Public Class Methods

new(config) click to toggle source
# File lib/repo-compare/git_remote_update.rb, line 6
def initialize(config)
  @config = config
end

Public Instance Methods

call() click to toggle source
# File lib/repo-compare/git_remote_update.rb, line 10
def call
  if `git remote`.split("\n").none? @config['source_name']
    `git remote add -f #{@config['source_name']} #{@config['source_repo']}`
    puts('error with git remote add') & exit if $?.exitstatus != 0
  end

  `git remote update > /dev/null 2>&1`
  puts('error with git remote update') & exit if $?.exitstatus != 0
end