Skip to content

Commit

Permalink
Polish the deprecation message in "mix hex.docs" (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide authored and ericmj committed Sep 24, 2016
1 parent c89dda8 commit 4a76aa1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
12 changes: 8 additions & 4 deletions lib/mix/tasks/hex/docs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ defmodule Mix.Tasks.Hex.Docs do

case args do
[] ->
deprecation_msg = """
[deprecation] Calling mix hex.docs without a command is deprecated, please use:
mix hex.publish docs
Mix.raise """
[deprecation] The "mix hex.docs" command has changed. To use the old
behaviour (publishing docs), use:
mix hex.publish docs
The new "mix hex.docs" command has to be invoked with at least one
argument. Call "mix help hex.docs" for more information.
"""
Mix.raise deprecation_msg
["fetch" | remaining] ->
fetch_docs(remaining, opts)
["open" | remaining] ->
Expand Down
9 changes: 2 additions & 7 deletions test/mix/tasks/hex/docs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,8 @@ defmodule Mix.Tasks.Hex.DocsTest do
end

test "invalid arguments for docs task" do
deprecation_msg = """
[deprecation] Calling mix hex.docs without a command is deprecated, please use:
mix hex.publish docs
"""
assert_raise Mix.Error, deprecation_msg, fn ->
Mix.Tasks.Hex.Docs.run([])
end
exception = assert_raise Mix.Error, fn -> Mix.Tasks.Hex.Docs.run([]) end
assert Exception.message(exception) =~ ~s([deprecation] The "mix hex.docs" command has changed)

invalid_args_msg = """
invalid arguments, expected one of:
Expand Down

0 comments on commit 4a76aa1

Please sign in to comment.