class MGit::FetchCommand
Public Instance Methods
arity()
click to toggle source
# File lib/mgit/commands/fetch.rb, line 15 def arity [nil, 0] end
description()
click to toggle source
# File lib/mgit/commands/fetch.rb, line 23 def description 'fetch all remote repositories' end
execute(_)
click to toggle source
# File lib/mgit/commands/fetch.rb, line 5 def execute(_) thread_class = Configuration.threads ? Thread : NullThread threads = Registry.map do |repo| thread_class.new { fetch(repo) } end threads.each { |t| t.join } end
usage()
click to toggle source
# File lib/mgit/commands/fetch.rb, line 19 def usage 'fetch' end
Private Instance Methods
fetch(repo)
click to toggle source
# File lib/mgit/commands/fetch.rb, line 35 def fetch(repo) sc = System.git('remote', chdir: repo.path) unless sc.success? perror "Failed to read remotes for repository #{repo.name}! Abort." return end sc.stdout.strip.split.each do |remote| if System.git("fetch #{prune_switch} #{remote}", chdir: repo.path).success? pinfo "Fetched #{remote} in repository #{repo.name}." else perror "Failed to fetch #{remote} in repository #{repo.name}! Abort." break end end end
prune_switch()
click to toggle source
# File lib/mgit/commands/fetch.rb, line 31 def prune_switch Configuration.prune ? '--prune' : '' end