Class: GitCloner

Inherits:
Object
  • Object
show all
Defined in:
lib/nod/git_cloner.rb

Instance Method Summary collapse

Constructor Details

#initialize(tmp_dir) ⇒ GitCloner

Returns a new instance of GitCloner.



6
7
8
9
# File 'lib/nod/git_cloner.rb', line 6

def initialize(tmp_dir)
  @tmp_dir = tmp_dir
  @gritty = Grit::Git.new(tmp_dir)
end

Instance Method Details

#clone_url(url, to_url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nod/git_cloner.rb', line 11

def clone_url(url, to_url)
  # puts "cloning #{url} to #{to_url}"
  begin
    @gritty.clone({:quiet => false, :verbose => true, :progress => true, :timeout => 320}, url, to_url)
    true
  rescue Exception => e 
    puts e.backtrace
    puts e.to_s
    puts "couldn't clone #{url}"
    false
  end
end