toolshed icon indicating copy to clipboard operation
toolshed copied to clipboard

Remove nerves-specific helpers

Open mnishiguchi opened this issue 2 years ago • 0 comments

Description

We want to move Nerves-specific helpers to a new project called elixir-toolshed/toolshed_nerves so that toolshed will contain only generic helpers.

as per issue https://github.com/elixir-toolshed/toolshed/issues/57

Since this is a breaking change for Nerves users, ideally we want to show friendly warnings for smooth transition.

Here are the changes for Nerves projects at the high level:

dependencies in a Nerves project

from

{:toolshed, "~> 0.2.0"}

to

{:toolshed_nerves, "~> 0.1.0"},

usage in a Nerves project

from

use Toolshed

to

use Toolshed.Nerves

Lack of installing :toolshed_nerves for a Nerves project would result in missing some essential Nerves helpers like exit and reboot.

A version with this feature should be released together with elixir-toolshed/toolshed_nerves.

Changes

  • Remove nerves-specific helpers
  • Remove :nerves_runtime from dependencies
  • Adjust docs
    • README.md
    • lib/toolshed.ex
  • Print a warning message
    • when use Toolshed is invoked with Nerves.Runtime loaded but Toolshed.Nerves not loaded
use Toolshed

Toolshed imported. Run h(Toolshed) for more info.
warning: Nerves-specific helpers have been removed from :toolshed.
Add :toolshed_nerves to your Nerves project's dependencies.

  (stdlib 4.0.1) erl_eval.erl:744: :erl_eval.do_apply/7
  (elixir 1.13.4) src/elixir.erl:296: :elixir.recur_eval/3
  (elixir 1.13.4) src/elixir.erl:274: :elixir.eval_forms/3
  (iex 1.13.4) lib/iex/evaluator.ex:310: IEx.Evaluator.handle_eval/3
  (iex 1.13.4) lib/iex/evaluator.ex:285: IEx.Evaluator.do_eval/3
  (iex 1.13.4) lib/iex/evaluator.ex:274: IEx.Evaluator.eval/3

:ok

Notes

  • It would be better if we can print the warning message at compile time, but it seems difficult... Maybe we could do it in :nerves_bootstrap?

Next steps

  • [ ] release :toolshed with this feature, probably as v0.3.0
  • [ ] point :toolshed_nerves to :toolshed v0.3.0 and above (probably ~> 0.3 is good)
  • [ ] release :toolshed_nerves
  • [ ] update the Nerves project template
  • [ ] update Nerves example projects' mix.exs and iex.exs
  • [ ] update other docs if as needed

mnishiguchi avatar Sep 08 '22 12:09 mnishiguchi