message =
"The task \"acronym.http\" could not be found because the module is named " <>
"Mix.Tasks.Acronym.HTTP instead of Mix.Tasks.Acronym.Http as expected. " <>
"Please rename it and try again"
assert_raise Mix.NoTaskError, message, fn ->
Mix.Task.run("acronym.http")
end
So it would seem that mix task modules are an exception to the convention (i.e. conventions tend to be broken if there is a good reason - in this case to keep the logic of transforming mix task module names to command names and vice versa as simple as possible).
Wow, I am terribly late to the party, however I think I have your solution…
In your mix project configuration, you can configure a custom namespace for your app:
config :url_shorten,
namespace: URLShorten
Like @peerreynders mentioned, you’re doing something contrary to the defaults, so mix tooling doesn’t know how to generate the “correct” PascalCase form. Explicitly configuring the :namespace config option seems to fix all of mix’s broken assumptions.
With that being said, it’s a good idea to stick to the defaults for this reason.