Class: MGit::FetchCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/mgit/commands/fetch.rb

Defined Under Namespace

Classes: NullThread

Instance Method Summary collapse

Methods inherited from Command

#check_arity, execute, instance_each, list, load_commands, register_alias, register_command

Methods included from Output

#perror, #pinfo, #ptable, #pwarn

Instance Method Details

#arityObject



17
18
19
# File 'lib/mgit/commands/fetch.rb', line 17

def arity
  [nil, 0]
end

#descriptionObject



25
26
27
# File 'lib/mgit/commands/fetch.rb', line 25

def description
  'fetch all remote repositories'
end

#execute(args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mgit/commands/fetch.rb', line 5

def execute(args)
  thread_class = Configuration.threads ? Thread : NullThread
  threads = []
  Registry.each do |repo|
    threads << thread_class.new do
      fetch(repo)
    end
  end

  threads.each { |t| t.join }
end

#usageObject



21
22
23
# File 'lib/mgit/commands/fetch.rb', line 21

def usage
  'fetch'
end