class Gitl::Init

Public Instance Methods

run() click to toggle source
# File lib/commands/init.rb, line 13
def run
  mutex = Mutex.new
  threads = []
  self.gitl_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.gitl_config.projects.size} projects init success.".green
end