suzuki-shunsuke / issue

MIT License
4 stars 0 forks source link

asdf plugin を作ってみる #83

Closed suzuki-shunsuke closed 2 years ago

suzuki-shunsuke commented 2 years ago

aqua との比較を兼ねて、 asdf plugin を作ってみる とりあえず ci-info https://github.com/suzuki-shunsuke/ci-info の plugin を作ってみる。 手順とかをメモしたい。

suzuki-shunsuke commented 2 years ago

https://asdf-vm.com/plugins/create.html

suzuki-shunsuke commented 2 years ago

ドキュメントを読んでいるが、これを理解しないと作れないってのはハードル高いな。 まぁ Template があるから雰囲気でも作れたりするのかな?

suzuki-shunsuke commented 2 years ago

https://github.com/asdf-vm/asdf-plugin-template

suzuki-shunsuke commented 2 years ago

https://github.com/suzuki-shunsuke/asdf-ci-info

suzuki-shunsuke commented 2 years ago
$ bash setup.bash

を実行しろと書いてある。

suzuki-shunsuke commented 2 years ago

interactive に入力していく

$ bash setup.bash
Name for your plugin, starting with `asdf-`, eg. `asdf-foo`
> asdf-ci-info

Shell command for testing correct tool installation. eg. `foo --version` or `foo --help`
[ci-info --help] > 

Your GitHub username
> suzuki-shunsuke

Your name
[Suzuki Shunsuke] > Shunsuke Suzuki

The tool's GitHub homepage.
[https://github.com/suzuki-shunsuke/ci-info] > 

The tool's documentation homepage if necessary.
[https://github.com/suzuki-shunsuke/ci-info] > 

Please choose a LICENSE keyword.
See available license keywords at
https://help.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository#searching-github-by-license-type
License keyword:
mit/[apache-2.0]/agpl-3.0/unlicense > mit

Setting up plugin: asdf-ci-info

author:        Shunsuke Suzuki
plugin repo:   https://github.com/suzuki-shunsuke/asdf-ci-info
license:       https://choosealicense.com/licenses/mit/

ci-info github:   https://github.com/suzuki-shunsuke/ci-info
ci-info docs:     https://github.com/suzuki-shunsuke/ci-info
ci-info test:     `ci-info --help`

After confirmation, the `main` will be replaced with the generated
template using the above information. Please ensure all seems correct.
Type `yes` if you want to continue.
> yes
suzuki-shunsuke commented 2 years ago
Required Scripts
bin/list-all - lists all installable versions
bin/download - download source code or binary for the specified version
bin/install - installs the specified version

全部生成されたので、もしかしてもう動く?

suzuki-shunsuke commented 2 years ago

というかこのスクリプト Git の履歴書き換えている気がする? やりすぎでは

suzuki-shunsuke commented 2 years ago

とりあえず main に force push する

$ git push origin main -f

https://github.com/suzuki-shunsuke/asdf-ci-info

CI こけてるな https://github.com/suzuki-shunsuke/asdf-ci-info/runs/4479998526?check_suite_focus=true

* Downloading ci-info release 2.0.3-1...
  asdf-ci-info: Expected /tmp/asdf.6l1L/installs/ci-info/2.0.3-1/bin/ci-info to be executable.
  asdf-ci-info: An error ocurred while installing ci-info 2.0.3-1.
  FAILED: install exited with an error
  Error: Action failed with error Error: The process '/home/runner/.asdf/bin/asdf' failed with exit code 1

最新の release は v2.0.3 なんだが、 prerelease 版の v2.0.3-1 がダウンロードされている

suzuki-shunsuke commented 2 years ago

試しに install して使ってみる。

suzuki-shunsuke commented 2 years ago
$ asdf install
* Downloading ci-info release v2.0.3...
curl: (22) The requested URL returned error: 404
asdf-ci-info: Could not download https://github.com/suzuki-shunsuke/ci-info/archive/vv2.0.3.tar.gz

v は不要なのか

$ asdf install     
* Downloading ci-info release 2.0.3...
asdf-ci-info: Expected /Users/shunsuke-suzuki/.asdf/installs/ci-info/2.0.3/bin/ci-info to be executable.
asdf-ci-info: An error ocurred while installing ci-info 2.0.3.

失敗した

suzuki-shunsuke commented 2 years ago
$ ls /Users/shunsuke-suzuki/.asdf/installs/ci-info

空だった。ここは自分で書かないと駄目なのか

suzuki-shunsuke commented 2 years ago

面倒くさい。 https://github.com/looztra/asdf-conftest/blob/master/bin/install

面倒臭さが理解できたので終わる