Method: Gb::Init#run

Defined in:
lib/commands/init.rb

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/commands/init.rb', line 13

def run
  mutex = Mutex.new
  threads = []
  self.gb_config.projects.each do |project|
    t = Thread.new do
      project_path = File.expand_path(project.name, './')
      if File.exist?(project_path)
        mutex.synchronize do
          info project.name + ' exists, skip.'
        end
      else
        Git.clone_without_env(project.git, project.name, :path => './')
      end
    end
    threads << t
  end
  threads.each do |t| 
    t.join
  end
  puts "#{self.gb_config.projects.size} projects init success.".green
end