Module: Capo::Init

Defined in:
lib/capo/init.rb

Class Method Summary collapse

Class Method Details

.fetch_repositoryObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/capo/init.rb', line 7

def fetch_repository
  repository_url = 'git://github.com/capoio/capo.git'

  puts "Pulling changes from remote repository"
  begin
    repo = with_timeout{Git.open Capo.repository_path}
    puts with_timeout{repo.lib.send :command, 'pull'} # repo.pull is broken in git-1.2.5, see: https://github.com/schacon/ruby-git/issues/32
  rescue
    puts "Repository doesn't seem to exist yet..."
    puts "Cloning repository from #{repository_url} to #{Capo.repository_path}"
    with_timeout{Git.clone repository_url, Capo.repository_path}
    retry
  end
end