Задача "документы" не найдена.Вы имели в виду "делать"? - PullRequest
2 голосов
/ 23 мая 2019

Как создать документацию для смешанного проекта? Как это можно сделать?

Порядок работы с микс-проектом Elixir:

  • Я создаю проект командой mix new greeter.
  • Я добавляю блок комментариев в файл greeter.ex.
  • Я добавляю зависимости в файл mix.exs.
  • Я пытаюсь сгенерировать документацию к mix docs команда.

mix help не может предоставить docs задачу в списке возможных вариантов:

mix                   # Runs the default task (current: "mix run")
mix app.start         # Starts all registered apps
mix app.tree          # Prints the application tree
mix archive           # Lists installed archives
mix archive.build     # Archives this project into a .ez file
mix archive.install   # Installs an archive locally
mix archive.uninstall # Uninstalls archives
mix clean             # Deletes generated application files
mix cmd               # Executes the given command
mix compile           # Compiles source files
mix deps              # Lists dependencies and their status
mix deps.clean        # Deletes the given dependencies' files
mix deps.compile      # Compiles dependencies
mix deps.get          # Gets all out of date dependencies
mix deps.tree         # Prints the dependency tree
mix deps.unlock       # Unlocks the given dependencies
mix deps.update       # Updates the given dependencies
mix dialyzer          # Runs dialyzer with default or project-defined flags.
mix dialyzer.build    # Build the required plt(s) and exit.
mix dialyzer.clean    # Delete plt(s) and exit.
mix dialyzer.explain  # Display information about dialyzer warnings.
mix do                # Executes the tasks separated by comma
mix escript           # Lists installed escripts

Когда я запускаю команду mix docs, я получаю сообщение-микс:

**(Mix) The task "docs" could not be found. Did you mean "do"?

Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:
  earmark 1.3.2
  ex_doc 0.20.2
  makeup 0.8.0
  makeup_elixir 0.13.0
  nimble_parsec 0.5.0
All dependencies are up to date

В чем моя ошибка?

Ответы [ 2 ]

6 голосов
/ 23 мая 2019

Задача mix docs доступна с ExDoc .Убедитесь, что у вас установлена ​​зависимость.Обязательно ознакомьтесь с документами и установите их правильно.Тогда вы сможете использовать команду mix docs.

Вот как это установить:

  • Добавить ее в свой deps:

для эликсира> = 1,7:

def deps do
  [
    {:ex_doc, "~> 0.19", only: :dev, runtime: false},
  ]
end

эликсир <1,7: </p>


def deps do
  [
    {:ex_doc, "~> 0.18.0", only: :dev, runtime: false},
  ]
end
  • Выполнить mix deps.get
  • Теперь вы можете запустить mix docs

Есть некоторые вещи, которые вы можете настроить в функции проекта вашего файла микса.Такие как имя, source_url и homepage_url.Обязательно ознакомьтесь с документацией ExDoc для получения более подробной информации.

2 голосов
/ 23 мая 2019

Я удаляю каталог _build, удаляю все содержимое каталога deps, удаляю mix.lock.

Затем в командной строке mix-проекта я делаю команды:

  1. mix deps.clean --all
  2. mix deps.update --all
  3. mix deps.get --all

После этого я запускаю mix docs и генерируется документация.

Команда mix help docs печатать документацию ExDoc тоже.

...