Class: Downlow::Git

Inherits:
Fetcher show all
Defined in:
lib/downlow/fetchers/git.rb

Instance Attribute Summary

Attributes inherited from Fetcher

#destination, #local_path, #options, #tmp_dir, #url

Instance Method Summary collapse

Methods inherited from Fetcher

fetch, #fetched?, fetcher_for, handles, #initialize

Constructor Details

This class inherits a constructor from Downlow::Fetcher

Instance Method Details

#fetchObject



6
7
8
9
10
11
# File 'lib/downlow/fetchers/git.rb', line 6

def fetch
  self.destination = destination.dirname + destination.stem
  git_clone
  rm_dot_git unless options[:keep_git]
  @local_path = destination
end

#git_cloneObject



13
14
15
# File 'lib/downlow/fetchers/git.rb', line 13

def git_clone
  system "`which git` clone #{url} #{destination.expand_path}"
end

#rm_dot_gitObject



17
18
19
# File 'lib/downlow/fetchers/git.rb', line 17

def rm_dot_git
  FileUtils.rm_rf(destination + '.git')
end