Skip to content

Commit

Permalink
abs installer: remove zip after extraction, closes #292
Browse files Browse the repository at this point in the history
  • Loading branch information
mingwho authored and odino committed Dec 26, 2019
1 parent 8ab9b60 commit 08303e6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions install/install.go
Expand Up @@ -39,12 +39,12 @@ func Install(module string) {
return
}

fmt.Printf("\nInstall Success. You can use the module with `require(\"%s\")`\n", alias)
fmt.Printf("Install Success. You can use the module with `require(\"%s\")`\n", alias)
return
}

func printLoader(done chan int64, message string) {
var stop bool = false
var stop = false
symbols := []string{"🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "}
i := 0

Expand Down Expand Up @@ -122,7 +122,7 @@ func getZip(module string) error {

// Unzip will decompress a zip archive
func unzip(module string) error {
fmt.Printf("\nUnpacking...")
fmt.Printf("Unpacking...\n")
src := fmt.Sprintf("./vendor/%s-master.zip", module)
dest := filepath.Dir(src)

Expand Down Expand Up @@ -181,11 +181,18 @@ func unzip(module string) error {
return err
}
}

// remove the zip file after we extract it
err = os.Remove(src)
if err != nil {
fmt.Printf("Could not remove archive zip file at %s, err: %s\n", src, err)
}

return nil
}

func createAlias(module string) (string, error) {
fmt.Printf("\nCreating alias...")
fmt.Printf("Creating alias...\n")
f, err := os.OpenFile("./packages.abs.json", os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
fmt.Printf("Could not open alias file %s\n", err)
Expand Down

0 comments on commit 08303e6

Please sign in to comment.