From 1b85b0e48f7bd92638727456b3beb8787d753dc3 Mon Sep 17 00:00:00 2001 From: Ryan Neufeld Date: Mon, 12 Feb 2018 12:33:25 -0600 Subject: [PATCH] First cut at Phoenix 1.3 projections. Fixes #10 Based on working .projections.json from: https://gist.github.com/rkneufeld/a2c1a1efc53f9edf73cdad03ddeb201a --- autoload/phoenix.vim | 66 +++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/autoload/phoenix.vim b/autoload/phoenix.vim index 6eea48c..10f56a1 100644 --- a/autoload/phoenix.vim +++ b/autoload/phoenix.vim @@ -235,46 +235,54 @@ function! phoenix#setup_custom_transformations() endfunction endfunction +" TODO: Missing channel function! phoenix#projections() abort return { - \ "web/controllers/*_controller.ex": { - \ "type": "controller", - \ "alternate": "test/controllers/{}_controller_test.exs", - \ "template": s:template_for('controller', 'Controller') + \ "lib/*.ex": { + \ "type": "module", + \ "alternate": "test/{}_test.exs" \ }, - \ "web/models/*.ex": { - \ "type": "model", - \ "alternate": "test/models/{}_test.exs", - \ "template": s:template_for('model', 'Model') + \ "test/*_test.exs": { + \ "type": "test", + \ "alternate": "lib/{}.ex" \ }, - \ "web/channels/*_channel.ex": { - \ "type": "channel", - \ "alternate": "test/channels/{}_channel_test.exs", - \ "template": s:template_for('channel', 'Channel') + \ "lib/**/controllers/*_controller.ex": { + \ "type": "controller", + \ "alternate": "test/{dirname}/controllers/{basename}_controller_test.exs", + \ "template": s:template_for('controller', 'Controller') \ }, - \ "web/views/*_view.ex": { - \ "type": "view", - \ "alternate": "test/views/{}_view_test.exs", - \ "template": s:template_for('view', 'View') + \ "lib/**/templates/*.html.eex": { + \ "type": "template", + \ "alternate": "lib/{dirname}/views/{basename}_view.ex" \ }, - \ "test/*_test.exs": { - \ "type": "test", - \ "alternate": "web/{}.ex", - \ "template": s:template_for('test', 'Test') + \ "lib/**/views/*_view.ex": { + \ "type": "view", + \ "alternate": "test/{dirname}/views/{basename}_view_test.ex", + \ "template": s:template_for('view', 'View') \ }, - \ "web/templates/*.html.eex": { - \ "type": "template", - \ "alternate": "web/views/{dirname|basename}_view.ex" + \ "lib/*/router.ex": { + \ "type": "router", + \ "alternate": "lib/{}/router.ex" \ }, - \ "web/static/css/*.css": { "type": "stylesheet" }, - \ "web/static/js/*.js": { "type": "javascript" }, - \ "web/router.ex": { "type": "router" }, + \ "README.md": { "type": "docs" }, + \ "docs/*.md": { "type": "docs" }, + \ "assets/css/*.css": { "type": "css" }, + \ "assets/js/*.js": { "type": "js" }, \ "config/*.exs": { "type": "config" }, - \ "mix.exs": { "type": "mix" }, - \ "*": { "start": "mix phoenix.server", - \ "path": "web/**" + \ "config/config.exs": { "type": "config" }, + \ "mix.exs": { "type": "mix" }, + \ "priv/repo/seeds.exs": { "type": "seeds" }, + \ "priv/repo/migrations/*.exs": { + \ "type": "migration", + \ "make": "mix ecto.migrate" + \ }, + \ "*": { + \ "console": "iex -S mix", + \ "make": "mix compile", + \ "start": "mix phx.server" \ }, \ } + endfunction " }}}