What is the Standard Procedure for Creating a Plugin


#1

I want to create a plugin for cakephp/app but I am not really sure how to go about it…

At some point I need to create a repo for the plugin, thats a given, lets call that

CakePHPKitchen/SharpAgent

Ok, now that I have that, if my hard drive busts or something I will need another repo that contains the app skeleton with a composer entry that requires SharpAgent, lets call that

CakePHPKitchen/SharpAgentDemo

Ok, that sounds great, however, now I want to create another plugin, but that leads to me creating yet another Demo repo, so now I create just one Demo repo, lets call it

CakePHPKitchen/PluginDemos

Now my instinct at this point is to create git submodules inside PluginDemos of each plugin, ex: SharpAgent, however, we have composer involved now, is there a way for me to use require by composer and be able to push to SharpAgent from the PluginDemos repo?


#2

So this is what I ended up doing, please let me know how it compares to your method(s)

Created Repos

 1) SharpAgent
 2) PluginDemos

Bash Commands

git clone ... PluginDemos
cd PluginDemos
git remote add upstream cakephp/app
git pull upstream master
composer install
bin/cake bake plugin SharpAgent
cd ..
git clone ... SharpAgent
mv PluginDemos/plugins/SharpAgent/* SharpAgent/
mv PluginDemos/plugins/SharpAgent/.* SharpAgent/
cd SharpAgent
git add . && git commit -m 'Shotgun Commit' && git push origin master
cd PluginDemos/
rm -rf plugins/SharpAgent
git submodule add plugins/SharpAgent SharpAgent.git