class Gpr::Commands::Fetch

Public Class Methods

new(thor) click to toggle source
# File lib/gpr/commands/fetch.rb, line 10
def initialize(thor)
  thor.class_eval do
    include ::Gpr::Actions::Fetch

    desc 'fetch', 'Fetch the registered repositories.'
    def fetch(remote = 'origin', branch = nil, path = nil)
      if path.nil?
        repositories = repository_list
        repositories.each do |repository|
          repo_info = parse_repository(repository)

          puts "#{repo_info[:host].color(:yellow)} - #{repo_info[:repository].color(:blue)}"

          git_fetch(repository, remote, branch)
        end
      else
        repo_info = parse_repository(path)

        puts "#{repo_info[:host].color(:yellow)} - #{repo_info[:repository].color(:blue)}"

        git_fetch(path, remote, branch)
      end
    end
  end
end

Public Instance Methods

fetch(remote = 'origin', branch = nil, path = nil) click to toggle source
# File lib/gpr/commands/fetch.rb, line 15
def fetch(remote = 'origin', branch = nil, path = nil)
  if path.nil?
    repositories = repository_list
    repositories.each do |repository|
      repo_info = parse_repository(repository)

      puts "#{repo_info[:host].color(:yellow)} - #{repo_info[:repository].color(:blue)}"

      git_fetch(repository, remote, branch)
    end
  else
    repo_info = parse_repository(path)

    puts "#{repo_info[:host].color(:yellow)} - #{repo_info[:repository].color(:blue)}"

    git_fetch(path, remote, branch)
  end
end