mix hex.retireした話(Elixir)

# はじめに
- [lwwsx](https://hex.pm/packages/lwwsx)というLivedoor Weather Web Service(LWWS)のAPIをラップした(だけの)[Hex](https://hex.pm/)をなんでもやってみようの精神で公開していました
- 残念なことに、Livedoor Weather Web Service(LWWS)は2020年7月31日（金）14:00に[サービス終了](https://help.livedoor.com/weather/index.html)となっておりまして、[lwwsx](https://hex.pm/packages/lwwsx)の公開を停止しようとおもって調べたことややったことを書いておきます
- まずは公開をしないことには始まらないのですが、そこは公式の[Publishing a package](https://hex.pm/docs/publish)をご参照くださいませ

# 調べたこと
- [FAQ](https://hex.pm/docs/faq)に`Can packages be removed from the repository?`の項がありました

> Instead of unpublishing we recommend to instead retire a package or release. This should be done if the maintainers no longer recommend its use, because it does not work, has security issues, been deprecated or any other reason. A package is retired with the mix hex.retire task. A retired package will still be resolvable and fetchable but users of the package will get a warning a message and the website will show the release as retired.

- `mix hex.retire`を使えばよさそうです
- ヘルプをみてみます

```
$ mix help hex.retire

                                 mix hex.retire                                 

Retires a package version.

    mix hex.retire PACKAGE VERSION REASON
    
    mix hex.retire PACKAGE VERSION --unretire

Mark a package as retired when you no longer recommend it's usage. A retired
package is still resolvable and usable but it will be flagged as retired in the
repository and a message will be displayed to users when they use the package.

## Retirement reasons

  • renamed - The package has been renamed, including the new package name
    in the message
  • deprecated - The package has been deprecated, if there's a replacing
    package include it in the message
  • security - There are security issues with this package
  • invalid - The package is invalid, for example it does not compile
    correctly
  • other - Any other reason not included above, clarify the reason in the
    message

## Command line options

  • --message "MESSAGE" - Required message (up to 140 characters)
    clarifying the retirement reason
  • --organization ORGANIZATION - Set this for private packages belonging
    to an organization

```

# ふむふむこんな感じかな

```
$ mix hex.retire lwwsx 0.1.2 invalid --message "Livedoor Weather Web Service(LWWS) is no longer available.

$ mix hex.retire lwwsx 0.1.1 invalid --message "Livedoor Weather Web Service(LWWS) is no longer available.

$ mix hex.retire lwwsx 0.1.0 invalid --message "Livedoor Weather Web Service(LWWS) is no longer available.
```
![スクリーンショット 2020-10-04 14.59.38.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/131808/1a4540ed-1d86-056d-ec2a-81f475bf4e13.png)

# retiredしている[Hex](https://hex.pm/)を`deps.get`するとどうなる?

```
$ mix new hello_lwwsx
```

```elixir:mix.exs
  defp deps do
    [
      {:lwwsx, "~> 0.1.2"}
    ]
  end
```

```
$ cd hello_lwwsx
$ mix deps.get
Resolving Hex dependencies...
Dependency resolution completed:
New:
  certifi 2.5.2
  hackney 1.16.0
  httpoison 1.7.0
  idna 6.0.1
  jason 1.2.2
  lwwsx 0.1.2 RETIRED!
    (invalid) Livedoor Weather Web Service(LWWS) is no longer available.
  metrics 1.0.1
  mimerl 1.2.0
  parse_trans 3.3.0
  ssl_verify_fun 1.1.6
  unicode_util_compat 0.5.0
```

- こんなふうになるのね
    - `RETIRED!`

# Wrapping Up
- `mix deps.get`したときになにかメッセージがでていないかはみておいたほうがよさそうですね
- [Enjoy](https://elixir-lang.org/) !!! :fire::rocket::rocket::rocket: