4
votes

I'm missing Phoenix specific mix tasks, e.g. mix phoenix.gen.html

$ mix help | grep -i phoenix

mix local.phoenix # Updates Phoenix locally

mix phoenix.new # Creates a new Phoenix v1.2.1 application

$ mix -v

Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Mix 1.3.4

$ elixir -v

Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.3.4

I've re-installed Erlang, Node, Elixir, Phoenix on my Mac (using brew) and nothing seems to resolve the issue.

Here is the output running it from the Phoenix app directory

$ mix phoenix.new hello

$ cd hello

$ ls
README.md       brunch-config.js    deps            mix.exs            node_modules     priv            web _build          config          lib         mix.lock        package.json        test

$ mix -h | fgrep phoenix
mix local.phoenix     # Updates Phoenix locally
mix phoenix.new       # Creates a new Phoenix v1.2.1 application
1

1 Answers

8
votes

All tasks other than local.phoenix and phoenix.new, like phoenix.gen.html are only available from inside a Phoenix app's diretory. You should see them in mix help if you run it from inside an app's directory.

Note: You'll have to compile the app once using mix compile if you want to see it appear in mix help in a brand new app that has never been compiled. If you directly to run one of those task though, it will succeed since mix will compile the app before trying to run it.

Outside any app's directory:

$ mix help | grep phoenix
mix local.phoenix     # Updates Phoenix locally
mix phoenix.new       # Creates a new Phoenix v1.2.1 application

Inside an app's directory (make sure the app is compiled by running mix compile first):

$ mix help | grep phoenix
mix local.phoenix        # Updates Phoenix locally
mix phoenix.digest       # Digests and compress static files
mix phoenix.gen.channel  # Generates a Phoenix channel
mix phoenix.gen.html     # Generates controller, model and views for an HTML based resource
mix phoenix.gen.json     # Generates a controller and model for a JSON based resource
mix phoenix.gen.model    # Generates an Ecto model
mix phoenix.gen.presence # Generates a Presence tracker
mix phoenix.gen.secret   # Generates a secret
mix phoenix.new          # Creates a new Phoenix v1.2.1 application
mix phoenix.routes       # Prints all routes
mix phoenix.server       # Starts applications and their servers