Exclude reference directory workaround
I just wanted to put this up since there have been a lot of threads recently discussing how to exclude directories and still access the code in them...the short answer is you can't. ;\
My solution is as follows. Note: I'm using Github to track my projects[paid account for 5 private repositories].
My repository structure is as follows:
Repository: Clients
Branch: Master : empty repository to serve as a model
build,deploy,docs,libs,sites,tests,tmp,config
config/phpstorm : empty
Exclude: cache/, administrator/cache/, .idea/
Branch: Joomla Projects: almost empty repository to serve as a model
build,deploy,docs,libs,sites,tests,tmp,config
config/phpstorm : empty
libs/joomla-platform : submodule uses the Joomla org's read only platform rep link
libs/joomla-cms : submodule uses the Joomla org's read only cms rep link
Exclude: cache/, administrator/cache/, .idea/
Branch: <Clientname>: client code
build,deploy,docs,libs,sites,tests,tmp,config
config/phpstorm : periodic copy of the contents of .idea
libs/joomla-platform : submodule uses the Joomla org's read only platform rep link
libs/joomla-cms : submodule uses the Joomla org's read only cms rep link
sites/clientsite : client website that I'm working on
Git Exclude: sites/clientsite/cache/, sites/clientsite/administrator/cache/, sites/clientsite/tmp, .idea/
PHPStorm configuration:
Project is opened/created in the repository directory which is switched to the project branch
I copy anything in config/phpstorm to .idea - setting my default configuration for the project
Content Root: project root,
Exclude: libs
Test Sources: tests
Resource Root: sites
Next I configure PHPStorm for this project:
Directories: build,deploy,docs,libs,sites,tests,tmp,config *nochange*
Subdirs: config/phpstorm, libs/joomla-platform,libs/joomla-cms,sites/clientsite *nochange*
Git Exclude: sites/clientsite/cache/, sites/clientsite/administrator/cache/, sites/clientsite/tmp, .idea/ *nochange*
Content Root: project root,
PHPStorm Exclude: libs
PHPStorm Test Sources: tests
PHPStorm Resource Root: sites
With this done, I copy everything in .idea to config/phpstorm. This allows me to keep a copy of my IDE configuration, without constantly updating it with minor config file changes. That way when I want to work on a different system, I can checkout the entire project, copy over the config information and everything is setup as I want it. Note: this means that in general, if given a choice between making a scope "shared" or not, always choose shared... shared places it in the .idea directory, not shared places it in my users/[username]/.WebIDE40 directory!
With that done, I now create 2 ADDITIONAL PHP projects. Project 1 is opened in the directory [project root]/libs/joomla-platform and project 2 is opened in the directory [project root]/libs/joomla-cms
When working, I use 3 instances of PHPStorm. One instance for the master project. One instance for Joomla-Platform. One instance for Joomla-CMS. If I want to check on one of the library sources to see how something is done there[or perhaps snag some updated code for the website] I switch to the other project. It's not as convenient as running a single instance, but it works.
I also use SmartGit in addition to PHPStorm's built in repository tools. Most of the time, PHPStorm works fine, but every now and then I just need a bit more functionality in order to deal with the submodules.
Please sign in to leave a comment.