Skip to content

Commit

Permalink
lessen strictness of os/arch matching
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora committed Feb 25, 2017
1 parent 3055df9 commit 81f4505
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ var (
fileExtRe = regexp.MustCompile(`(\.[a-z][a-z0-9]+)+$`)
isTermRe = regexp.MustCompile(`(?i)^(curl|wget)\/`)
isHomebrewRe = regexp.MustCompile(`(?i)^homebrew`)
posixOSRe = regexp.MustCompile(`(darwin|linux|(net|free|open)bsd)`)
archRe = regexp.MustCompile(`(arm|386|amd64)`)
posixOSRe = regexp.MustCompile(`(darwin|linux|(net|free|open)bsd|mac|osx)`)
archRe = regexp.MustCompile(`(arm|386|amd64|32|64)`)
cache = map[string]cacheItem{}
cacheMut = sync.Mutex{}
)
Expand Down Expand Up @@ -225,8 +225,16 @@ func getAssets(user, repo, release string) ([]asset, string, error) {
url := ga.BrowserDownloadURL
os := posixOSRe.FindString(ga.Name)
arch := archRe.FindString(ga.Name)
if os == "" || arch == "" {
continue
if os == "" {
continue //unknown os
}
if os == "mac" || os == "osx" {
os = "darwin"
}
if arch == "64" || arch == "" {
arch = "amd64" //default
} else if arch == "32" {
arch = "386"
}
assets = append(assets, asset{
Name: ga.Name,
Expand Down

0 comments on commit 81f4505

Please sign in to comment.