Class: PgBundle::PgxnSource

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

Overview

The GithubSource class defines a Github Source

Instance Attribute Summary

Attributes inherited from BaseSource

#path

Instance Method Summary collapse

Constructor Details

#initialize(dist, version) ⇒ PgxnSource

Returns a new instance of PgxnSource.



9
10
11
12
13
# File 'lib/pgbundle/pgxn_source.rb', line 9

def initialize(dist, version)
  @dist, @version = dist, version
  path = "http://master.pgxn.org/dist/%{dist}/%{version}/%{dist}-%{version}.zip" % {dist: dist, version: version}
  super(path)
end

Instance Method Details

#cleanObject



25
26
27
# File 'lib/pgbundle/pgxn_source.rb', line 25

def clean
  FileUtils.remove_dir(download_dir, true)
end

#load(host, user, dest) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/pgbundle/pgxn_source.rb', line 15

def load(host, user, dest)
  download
  unzip
  if host == 'localhost'
    copy_local("#{download_dir}/#{@dist}-#{@version}", dest)
  else
    copy_to_remote(host, user, "#{download_dir}/#{@dist}-#{@version}", dest)
  end
end