Skip to content

Commit

Permalink
#119: Move wget
Browse files Browse the repository at this point in the history
  • Loading branch information
fubarhouse committed Sep 29, 2019
1 parent 033ce5a commit 3b822d5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions version/legacy.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package version

import (
"fmt"
"os"
"os/exec"
"os/user"
Expand All @@ -26,6 +27,7 @@ func (drushVersion *DrushVersion) LegacyInstall() {
// Deprecated: Drush version manager no longer supports legacy installs.
func (drushVersion *DrushVersion) LegacyInstallTable() {
usr, _ := user.Current()
pwd, _ := os.Getwd()
log.Infoln("Fixing dependency issue with module Console_Table")
ctFileName := "Table.inc"
ctRemotePath := "https://raw.githubusercontent.com/pear/Console_Table/master/Table.php"
Expand All @@ -36,7 +38,7 @@ func (drushVersion *DrushVersion) LegacyInstallTable() {
if wgetErr != nil {
log.Infoln("wget returned error:", wgetErr)
}
tmpFile := "Table.php"
tmpFile := fmt.Sprintf("%v%vTable.php", pwd, sep)
move(tmpFile, ctFile)
}

Expand All @@ -45,19 +47,20 @@ func (drushVersion *DrushVersion) LegacyInstallTable() {
// Deprecated: Drush version manager no longer supports legacy installs.
func (drushVersion *DrushVersion) LegacyInstallVersion() {
usr, _ := user.Current()
log.Infoln("Downloading and extracting legacy Drush version ", drushVersion.majorVersion)
log.Infoln(fmt.Sprintf("Downloading and extracting legacy Drush version %v.", drushVersion.fullVersion))
zipFileName := drushVersion.fullVersion + ".zip"
remotePath := "https://github.com/drush-ops/drush/archive/" + zipFileName
zipPath := usr.HomeDir + sep + ".dvm" + sep + "versions" + sep
zipFile := zipPath + zipFileName
zipPathFull := fmt.Sprintf("%v%v.dvm%vversions%v%v", usr.HomeDir, sep, sep, sep, zipFileName)
mkdir(zipPath, 0755)
_, wgetErr := wget.Run(remotePath)
if wgetErr != nil {
log.Warnln("wget returned error:", wgetErr)
log.Warnln(remotePath)
}
move(zipFile, zipPath)
exec.Command("sh", "-c", "cd "+zipPath+" && unzip "+zipFile).Run()
move(zipFileName, zipPathFull)
exec.Command("sh", "-c", "cd "+zipPath+" && unzip "+zipFileName).Run()
remove(zipFile)
drushVersion.Status()
}

0 comments on commit 3b822d5

Please sign in to comment.