Пример #1
0
func downloadPackages() {
	errMsg := "\nProblem while downloading the assets from the internet for the first time. Trace: %s"

	installedDir, err := utils.Install(PackagesURL, packagesInstallDir)
	if err != nil {
		printer.Dangerf(errMsg, err.Error())
		return
	}

	// installedDir is the packagesInstallDir+PackagesExportedName, we will copy these contents to the parent, to the packagesInstallDir, because of import paths.

	err = utils.CopyDir(installedDir, packagesInstallDir)
	if err != nil {
		printer.Dangerf(errMsg, err.Error())
		return
	}

	// we don't exit on errors here.

	// try to remove the unzipped folder
	utils.RemoveFile(installedDir[0 : len(installedDir)-1])
}
Пример #2
0
// Install is just the flow of the: DownloadZip->Unzip->Remove the zip
func (d *pluginDownloadManager) Install(remoteFileZip string, targetDirectory string) (string, error) {
	return utils.Install(remoteFileZip, targetDirectory)
}