lib/phoenix-cli/cli.rb in phoenix-cli-0.0.2 vs lib/phoenix-cli/cli.rb in phoenix-cli-0.0.3
- old
+ new
@@ -1,6 +1,7 @@
require 'thor'
+require 'active_support/inflector'
require 'phoenix-cli'
trap("SIGINT") { exit! }
module PhoenixCli
@@ -30,9 +31,27 @@
end
desc "console", "Run phoenix console"
def console
exec("iex -S mix")
+ end
+
+ desc "migrate", "Run ecto migrations"
+ def migrate
+ exec("mix ecto.migrate")
+ end
+
+ desc "generate", "Run generators"
+ def generate(generator, resource_name, *args)
+ if generator == 'scaffold'
+ commands = args.join(' ')
+ exec("mix phoenix.gen.html #{resource_name.camelize} #{resource_name.pluralize} #{commands}")
+ end
+ end
+
+ desc "routes", "Show phoenix routes"
+ def routes
+ exec("mix phoenix.routes")
end
desc 'version', 'phoenix-cli version'
def version
puts PhoenixCli::VERSION