-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add abs module installer #277
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one! I have a few comments (small stuff) but I also want to bring a couple things up here:
- the binary size skyrocketed due to go-getter, and I think we should revert and try either another library or implement a small HTTP client to fetch dependencies from github only
~/projects/abs (pr-277 ✔) ᐅ du -hs ./builds/*
22M ./builds/abs
15M ./builds/abs-1.8.0-darwin-386
18M ./builds/abs-1.8.0-darwin-amd64
14M ./builds/abs-1.8.0-linux-386
17M ./builds/abs-1.8.0-linux-amd64
14M ./builds/abs-1.8.0-linux-arm
16M ./builds/abs-1.8.0-linux-arm64
16M ./builds/abs-1.8.0-linux-ppc64
16M ./builds/abs-1.8.0-linux-ppc64le
14M ./builds/abs-1.8.0-windows-386.exe
17M ./builds/abs-1.8.0-windows-amd64.exe
2.2M ./builds/builds.zip
~/projects/abs (pr-277 ✔) ᐅ ck 1.8.x
Switched to branch '1.8.x'
Your branch is up-to-date with 'origin/1.8.x'.
~/projects/abs (1.8.x ✔) ᐅ make release
go build -o builds/abs main.go
./builds/abs ./scripts/release.abs
Deleting previous builds...
Running builds for version 1.8.0, confirm by typing "y"
y
Building linux 386
Building linux amd64
Building linux arm
Building linux arm64
Building linux ppc64
Building linux ppc64le
Building linux arm
Building linux arm64
Building windows amd64
Building windows 386
Building darwin amd64
Building darwin 386
Building js wasm
done
~/projects/abs (1.8.x ✘)✹ ᐅ du -hs ./builds/*
3.9M ./builds/abs
2.6M ./builds/abs-1.8.0-darwin-386
3.0M ./builds/abs-1.8.0-darwin-amd64
2.4M ./builds/abs-1.8.0-linux-386
2.8M ./builds/abs-1.8.0-linux-amd64
2.4M ./builds/abs-1.8.0-linux-arm
2.7M ./builds/abs-1.8.0-linux-arm64
2.8M ./builds/abs-1.8.0-linux-ppc64
2.8M ./builds/abs-1.8.0-linux-ppc64le
2.5M ./builds/abs-1.8.0-windows-386.exe
3.0M ./builds/abs-1.8.0-windows-amd64.exe
2.2M ./builds/builds.zip
- tests are not passing on travis -- if you need some help lmk! It's something funny with dependencies, so I'm also not sure what's up (everything passes on my local machine)
- could we have some installer-specific tests on travis? Just download a couple dependencies with the same "last name", and test their aliases in a simple script
a8f5bb4
to
c2f2746
Compare
return | ||
} | ||
|
||
err := getZip(module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to print out the stages we're at:
- downloading (with %)
- unpacking
- creating alias
- done...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The percent part needs some discussion 😄 it seems like HEAD github zip header does not return content-length so we need to think about a work-around
➜ ~ curl https://github.com/mingwho/abs/archive/master.zip
<html><body>You are being <a href="https://codeload.github.com/mingwho/abs/zip/master">redirected</a>.</body></html>%
➜ ~ curl -I https://codeload.github.com/mingwho/abs/zip/master
HTTP/1.1 200 OK
...
Content-Type: application/zip
Content-Disposition: attachment; filename=abs-master.zip
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's forget about this for now then -- let's just use a CLI loader like this:
package main
import (
"fmt"
"time"
)
func main() {
symbols := []string{"🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "}
i := 0
for true {
fmt.Printf("\r" + symbols[i] + " - downloading archive")
time.Sleep(100 * time.Millisecond)
i++
if i > len(symbols)-1 {
i = 0
}
}
}
Later on we can figure out how to print the progress bar :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOW THIS IS COOL 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added CLI loader for download archive!
a958c6b
to
822747c
Compare
TODO: I still need to write some tests for this 😄 |
77c33fa
to
b7614b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yoo-hoo, I see this is almost done!
return | ||
} | ||
|
||
err := getZip(module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's forget about this for now then -- let's just use a CLI loader like this:
package main
import (
"fmt"
"time"
)
func main() {
symbols := []string{"🌑 ", "🌒 ", "🌓 ", "🌔 ", "🌕 ", "🌖 ", "🌗 ", "🌘 "}
i := 0
for true {
fmt.Printf("\r" + symbols[i] + " - downloading archive")
time.Sleep(100 * time.Millisecond)
i++
if i > len(symbols)-1 {
i = 0
}
}
}
Later on we can figure out how to print the progress bar :)
util/util.go
Outdated
@@ -40,6 +44,21 @@ func ExpandPath(path string) (string, error) { | |||
return filepath.Join(usr.HomeDir, path[1:]), nil | |||
} | |||
|
|||
func FindAlias(path string) (string, error) { | |||
if len(packageAlias) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the alias file is empty will this always be true, leading to us opening the file everytime instead of memoizing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the note! I just added one memoization function. It should work smoothly now
Planning to merge this today, and release 1.8 (might get delayed to tomm if I don't get enough time). I might make some small amends to this or later on, but great stuff! This is great! |
Thanks for the update 👍! I will have a look on the amends also 😄! |
We can run something like
get github.com/hashicorp/go-getter
to install a package into./vendor
folder. This will create a JSON filealias
in the current directory containing a mapping of alias and relative pathIn an abs script, we can use
g = require("go-getter")
to use the packageUpdate:
The current implementation uses https protocol to get a zip file from Github repository and unzips it under the
/vendor
directory.The unzip file part is copied from https://golangcode.com/unzip-files-in-go/
Some parts are a bit hack-ish. We can discuss further.