I want to generate a full engine, rather than a mountable one. I don't know if this issue also exists with mountable engines. I'm using IntelliJ IDEA 12.1.2 with Ruby Plugin 5.4.0 and running Ruby on Rails 4.0.0.rc1. I know that there is support when creating a new project to just tick a box to generate a mountable engine, but what I want to create is a base user_aaa engine which will form the authentication/authorisation of pretty much every site I design. I've not worked with engines before, but my understanding is that a moutable engine is completely namespaced away from the main app. I can see where this would make sense in the case of a /forum subsection of a site or similar, but I don't see that it makes sense to namespace my basic User/Group/Permissions/Logging models etc (This is partly for my own interest and learning, so i'm not wanting to know if someone else has already done this before me to save me time).
Anyway, I couldn't find an option in IDEA to generate an engine that was full rather than mountable, so I went ahead and did it on the command line. I then went to File->Import Project in IDEA and pointed it at my generated project directory. It found 3 routes.rb files, and decided the root of my project was project_root/test/dummy/, i.e. the location of the shell rails project that is generated for engines purely for the purpose of loading the engine and testing it's models, controllers etc. This clearly wasn't right. I could run a rails console, but any generators etc I used generated from root/test/dummy, so all my controllers, models etc were going inside there instead of in the correct place in my project root.
I deleted the .idea folder and project_name.iml file and tried redoing a few times. Same deal. Then I tried File->New Project instead of Import Project. This worked better. My project root is in the correct place, generators do the right thing. IDEA even seems to recognise that this is an engine and thus the irb console and server it should run up are the ones in the test/dummy directory. But when I try to run the server to see how things are going I get the error message:
"Error running Development: project_name: Rails server launcher 'project_name/test/dummy/script/rails' wasn't found in project"
This is a valid error message. dummy/script/rails doesn't exist. In rails 4 it's dummy/bin/rails. I once again tried deleting the .idea and .iml files a few times and reloading to see if it was a persistent problem, and it was.
When I generate a normal rails project using rails 4 IDEA find rails in the root/bin/ folder just fine. For some reason when it loads a (full) engine it still looks in the old root/dummy/script/ folder. I've temporarily fixed the problem by creating dummy/script and a symlink rails in there to ../bin/rails, now I can run the dummy server up to see how things look, but it does seem like the Ruby Plugin is getting something wrong here and dropping back to looking for things in the old rails 3.x locations. I've not even got the gem installed for any earlier versions of rails, so I assume as long as commands execute correctly they'll be done in the rails 4 way. I had a grep through the .iml file and .idea directory to see if there was a mention of script/rails that I could edit, but found nothing. I also had a hunt through all the settings I could find in IDEA to specify the project root differently from what it was first detected as or change the server launcher location, but came up blank.
Is this actually a bug in the Ruby Plugin, or am I missing something obvious that I should be doing?