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, create, execute, instance_each, list, load_commands, register_alias, register_command, require_commands_from_directory

Methods included from Output

#perror, #pinfo, #psystem, #ptable, #pwarn

Instance Method Details

#arityObject



15
16
17
# File 'lib/mgit/commands/fetch.rb', line 15

def arity
  [nil, 0]
end

#descriptionObject



23
24
25
# File 'lib/mgit/commands/fetch.rb', line 23

def description
  'fetch all remote repositories'
end

#execute(_) ⇒ Object



5
6
7
8
9
10
11
12
13
# 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

#usageObject



19
20
21
# File 'lib/mgit/commands/fetch.rb', line 19

def usage
  'fetch'
end