devops-works / binenv

One binary to rule them all. Manage all those pesky binaries (kubectl, helm, terraform, ...) easily.
MIT License
367 stars 44 forks source link

Add support tbz #167

Closed patsevanton closed 2 years ago

patsevanton commented 2 years ago

./binenv update -f btop

2021-10-13T13:44:40Z WRN "tbz" install method for "btop" is not implemented
updating distributions 100% |███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (1/1, 13662 it/s)

./binenv install btop

2021-10-13T13:44:45Z WRN "tbz" install method for "btop" is not implemented
2021-10-13T13:44:45Z WRN version for "btop" not specified; using "1.0.15"
fetching btop version 1.0.15 100% |█████████████████████████████████████████████████████████████████████████████████████████████████████████████████| (1.5/1.5 MB, 11.452 MB/s)        
2021-10-13T13:44:46Z ERR unable to install "btop" (1.0.15) error="no installer found for btop"
patsevanton commented 2 years ago

I dont know what need write. I dont know how fix " ERR unable to install "btop" (1.0.15) error="no installer found for btop""

leucos commented 2 years ago

You are pretty close @patsevanton You need to add tbz to the switch here https://github.com/devops-works/binenv/blob/develop/internal/install/install.go#L40

Don't forget to gofmt the code too.

Don't hesitate asking if you need more help. Good luck !

patsevanton commented 2 years ago

❯ go build

# github.com/devops-works/binenv/internal/install
internal/install/install.go:35:10: undefined: Tbz
internal/install/tgz.go:15:6: Tgz redeclared in this block
        /home/apatsev/github/binenv/internal/install/tbz.go:17:6: previous declaration
internal/install/tgz.go:20:14: Tgz.Install redeclared in this block
        /home/apatsev/github/binenv/internal/install/tbz.go:22:6: previous declaration

❯ go version go version go1.17.2 linux/amd64

I remove golang 1.10 and install golang 1.17

patsevanton commented 2 years ago

Check after commit

on EPRUPETW0BA2@binenv on patch-2 [!] via 🐹 v1.17.2 [ github.com/patsevanton/binenv]
❯ ./binenv update btop -f
updating distributions 100% |███████████████████████████████████████████████████████████████████████████████████████████████████████████████| (1/1, 17331 it/s)

on EPRUPETW0BA2@binenv on patch-2 [!] via 🐹 v1.17.2 [ github.com/patsevanton/binenv]
❯ ./binenv install btop
2021-10-20T17:03:40+06:00 WRN version for "btop" not specified; using "1.0.18"
2021-10-20T17:03:40+06:00 ERR unable to install "btop" (1.0.18) error="unable to download binary at https://github.com/aristocratos/btop/releases/download/v1.0.18/btop-1.0.18-linux-x86-64.tbz: 404 Not Found"
patsevanton commented 2 years ago

If use code

  btop:
    description: A monitor of resources
    map:
      amd64: x86_64
    list:
      type: github-releases
      url: https://api.github.com/repos/aristocratos/btop/releases
    fetch:
      url: https://github.com/aristocratos/btop/releases/download/v{{ .Version }}/btop-{{ .Version }}-{{ .Arch }}-{{ .OS }}-musl.tbz
    install:
      type: tbz
      binaries:
        - btop
on EPRUPETW0BA2@binenv on patch-2 [!] via 🐹 v1.17.2 [ github.com/patsevanton/binenv]
❯ ./binenv install btop
2021-10-20T17:12:00+06:00 WRN version for "btop" not specified; using "1.0.18"
fetching btop version 1.0.18 100% |██████████████████████████████████████████████████████████████████████████████████████████████████| (833/833 kB, 1.763 MB/s)        
2021-10-20T17:12:01+06:00 INF "btop" (1.0.18) installed
leucos commented 2 years ago

Looking good ! Want to remove "WIP" status ?

patsevanton commented 2 years ago

Rename PR

leucos commented 2 years ago

Thanks a lot @patsevanton Will release soon :+1:

leucos commented 2 years ago

https://github.com/devops-works/binenv/releases/tag/v0.15.0