Introducing Gdn_PScaffold a plugin scaffold/mini framework for your convenience
x00
MVP
I'm releasing Gdn_Scaffold shortly on an MIT licence, which is a utility/script which will help your organise, often cluttered plugins.
https://github.com/x00/Gdn_PScaffold
Requires php >= 5.2 to run
For those that already have IDE templating and automation regimes, you probably don't need this. You might want to look at the utility methods though.
What it is NOT for:
- Plugins that only have one or two files and a few lines of code (as it will create extra files).
- Plugns that already have a more specific organised structure
You can use on a plugin that needs some organisation, or a new project.
It is a scaffold it does not make your plugin automatically work, you need to implement along the lines suggested.
Treat it like beta software. It does backup within the plugin file, but it is not substitute for an external backup regime.
This is a tool/helper, don't trust it to be perfect.
grep is your friend.
6
Comments
Without further ado an explanation
ABOUT
SETUP
GENERAL USAGE
EXAMPLES
HELP
grep is your friend.
Don't forget to implement required method
PluginSetupin your plugin file even if empty.grep is your friend.
pluggability should now work in the mini dispatcher
So not only can you do stuff like
protected function Name_PseudoController($Sender, &$Args){ $this->AddCssFile($this->GetResource('design/somestyle.css', FALSE, FALSE)); $this->AddCssFile($this->GetResource('js/somescript.js', FALSE, FALSE)); $this->MiniDispatcher($Sender,'PseudoController','PseudoController'); } public function PseudoController_Index($Sender){ $Sender->Render($this->ThemeView('index')); } public function PseudoController_Browse($Sender){ $Sender->Render($this->ThemeView('browse')); }but in another plugin you can do
public function PseudoController_AllNewMethod_Create($Sender){ .... }if you need the updated class.utility.php class grab the latest copy of Gdn_PScaffold, make, remove the old and run gdn_ps
grep is your friend.
I have added a new utility method
DynamicRouteYou can add a new route like so (note due to
$OneWay = TRUEdirect access to destination is blocked).public function VanillaController_SomePage_Create($Sender){ exit('hello world!'); } public function Base_BeforeLoadRoutes_Handler($Sender, &$Args){ $this->DynamicRoute($Args['Routes'],C('Plugins.TestPlugin.SomePageURI', 'somepage'),'vanilla/somepage','Internal', TRUE); }I've made gdn_ps's
--dirargument friendlier, it should be able to use absolute, relative urls and does posix tilde expansion.grep is your friend.
I have created a
--lightto create stripped down pluginsgrep is your friend.
I'll try it for my next plugin.
There was an error rendering this rich post.
cool what OS do you develop on?
grep is your friend.
On Ubuntu 12.10 (to be updated to 13.04 in some weeks, maybe...).
There was an error rendering this rich post.
ok that should work
grep is your friend.
a few gremlins with the path and mini dispatcher to be expected....
grep is your friend.
If there are going to be a lot of utility functions, it would make sense to put them in a special plugin that loads that class to keep things DRY.
Then they could be overridden in YourPluginUtility if necessary.
The problem is that, this is released MIT, which fine as it is standalone generation function, but it uses templates.
The code generated, and the templates, I don't want it to be too restrictive for those that use it. I'm going to make a new post concerning the continue lack of clarity extension licensing.
In parallel, where this plugin would be primarily a garden extension, so I don't think would an issue, however GPl complicates things more than people like to admit.
Also is this going to be annoying, or you think it is fine, requiring such a plugin? It would mean it would automatically require it to be there. It won't have to be enabled.
At the moment it is just a handful of convenience methods, so it probably isn't worth doing.
grep is your friend.
Are there any plugin that use this? (from yours plugins @x00)
I'll trying it but with a working example everything should be easier. Thank you.
There was an error rendering this rich post.