Class: PgBundle::GitSource

Inherits:
BaseSource show all
Defined in:
lib/pgbundle/git_source.rb

Overview

The GithubSource class defines a Github Source

Direct Known Subclasses

GithubSource

Instance Attribute Summary collapse

Attributes inherited from BaseSource

#path

Instance Method Summary collapse

Constructor Details

#initialize(path, branch = 'master') ⇒ GitSource

Returns a new instance of GitSource.



7
8
9
10
# File 'lib/pgbundle/git_source.rb', line 7

def initialize(path, branch = 'master')
  @branch = branch || 'master'
  super(path)
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



5
6
7
# File 'lib/pgbundle/git_source.rb', line 5

def branch
  @branch
end

Instance Method Details

#cleanObject



21
22
23
# File 'lib/pgbundle/git_source.rb', line 21

def clean
  FileUtils.remove_dir(clone_dir, true)
end

#load(host, user, dest) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/pgbundle/git_source.rb', line 12

def load(host, user, dest)
  clone
  if host == 'localhost'
    copy_local("#{clone_dir}/", dest)
  else
    copy_to_remote(host, user, "#{clone_dir}/", dest)
  end
end