Refactor Mix tasks
authorJorty <jorty@jort.space>
Fri, 29 Jun 2018 00:24:51 +0000 (20:24 -0400)
committerJorty <jorty@jort.space>
Thu, 23 Aug 2018 15:33:16 +0000 (11:33 -0400)
commit8a1dc0de92c8c99bd6216281355be829cbcfb21f
tree9fec29d696ed1942feff171c80ade6371f0bd08a
parente416469a409e6ff4bea84da40a5af43fe532a2ce
Refactor Mix tasks

1. Move Mix tasks into a `pleroma` namespace, to avoid
   collisions with dependent packages.

2. Rename and condense tasks  into two `pleroma.user` and
   `pleroma.gen.instance` tasks for consistency with Hex and Phoenix.

3. Add additional functionality to the tasks to make them more
   user-friendly. Arguments with sensible defaults were demoted to flags
   and in the interactive `generate_config` (renamed to
   `pleroma.gen.instance`), flags were added to allow non-interactive
   use, though interactive use remains the primary interface. That task
   also now prompts the user for database parameters.

4. Documentation has been added to both tasks such that `mix help` now
   shows useful information.

5. Finally, use of IO.puts in tasks has been replaced with Mix.shell()
   equivalents to make the behavior more consistent with Mix tasks in
   other packages, and such that variables like MIX_QUIET are respected.
   The only exception is in `mix pleroma.user reset_password`, wherein
   the URL must always be printed regardless of the value of MIX_QUIET
   since that's its entire purpose.
13 files changed:
lib/mix/tasks/deactivate_user.ex [deleted file]
lib/mix/tasks/fix_ap_users.ex [deleted file]
lib/mix/tasks/generate_config.ex [deleted file]
lib/mix/tasks/generate_password_reset.ex [deleted file]
lib/mix/tasks/make_moderator.ex [deleted file]
lib/mix/tasks/pleroma/gen_instance.ex [new file with mode: 0644]
lib/mix/tasks/pleroma/sample_config.eex [moved from lib/mix/tasks/sample_config.eex with 68% similarity]
lib/mix/tasks/pleroma/sample_psql.eex [new file with mode: 0644]
lib/mix/tasks/pleroma/user.ex [new file with mode: 0644]
lib/mix/tasks/register_user.ex [deleted file]
lib/mix/tasks/rm_user.ex [deleted file]
lib/mix/tasks/sample_psql.eex [deleted file]
lib/mix/tasks/set_locked.ex [deleted file]