class Gitload::Repo

Attributes

api_data[RW]
clone_urls[R]
cloned[RW]
fork[RW]
name[RW]
owner[RW]
owner_type[RW]
source[RW]

Public Class Methods

new(source, api_data) click to toggle source
# File lib/gitload/repo.rb, line 8
def initialize source, api_data
  @source = source
  @api_data = api_data
  @cloned = false
  @clone_urls = {}
end

Public Instance Methods

clone_to(dest, options = {}) click to toggle source
# File lib/gitload/repo.rb, line 27
def clone_to dest, options = {}
  if @cloned && !options[:force]
    return
  elsif File.exists? dest
    @cloned = true
    CommandLine.print "#{dest} already exists", color: :green
    return
  end

  command = [ :git, :clone, clone_url(options[:clone_url_type]), dest ]

  if options[:dry_run]
    CommandLine.print CommandLine.escape(command), color: :yellow
  else
    CommandLine.execute command
  end

  @cloned = true
end
clone_url(type = nil) click to toggle source
# File lib/gitload/repo.rb, line 23
def clone_url type = nil
  @clone_urls[type || :http]
end
cloned?() click to toggle source
# File lib/gitload/repo.rb, line 15
def cloned?
  !!@cloned
end
fork?() click to toggle source
# File lib/gitload/repo.rb, line 19
def fork?
  !!@fork
end