Changelog from svn/git

Development related discussion.
Post Reply
User avatar
jonkristian
Newbie
Posts: 5
Joined: Thu Dec 29, 2011 2:04 am

Changelog from svn/git

Post by jonkristian » Wed Feb 01, 2012 10:24 pm

Hello, I have an idea.



I am aware that there won't be any svn/git integration rolled out in the core, but just wanted to ask about a possible feature if something like that gets written into a plugin.



My idea is simple, once a commit is made the changelog includes info about which files are modifed, the commit message and a possibility to close active tickets directly from the changelog windows. Of course each changelog would have some db relations to tickets. Maybe even possible to add a ticket based on current changelog, this way the backlog would be a lot more detailed.



Don't know about you guys, but I sometimes find myself fixing things that doesn't necessarily have a ticket.



So my question is, how easy will it be for a pluing to modify certain aspects of the control-panel, for instance the changelog screen.



Also, what do you guys think of this?

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Changelog from svn/git

Post by Jack » Fri Feb 03, 2012 2:34 pm

Plugins will (hopefully) be able to do a lot of stuff, including changing what the views look like by either view/template hooks or completely changing what view file is loaded.



For example, once I start adding all the plugin hooks, the __shutdown() method (called once the app is finished being executed) will have a hook name something like "controller_shutdown" (most likely different) that plugins can hook into, check what page is being loaded and change the view if needed.



If a plugin needs to hook into a certain part of the code where there is no hook, a hook location can be requested and will be added into the next version ASAP.



If you like, you can start requesting hook locations now ready for when Traq 3.0 is released.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Changelog from svn/git

Post by arturo182 » Wed Feb 08, 2012 9:05 pm

For adding such advance functionality like code repositories I think plugins will have to do more than just install hooks. They should be able to at least copy new files on install and remove them on uninstall, this way plugins could add new models, views, controllers and more.

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Changelog from svn/git

Post by Jack » Wed Feb 08, 2012 11:19 pm

[quote='arturo182' pid='635' dateline='1328695525']They should be able to at least copy new files on install and remove them on uninstall, this way plugins could add new models, views, controllers and more.

[/quote]



Personally I don't like the idea of having plugins copying files around, things can get messy when trying to upgrade and such.



Which got my thinking, instead of having files being added all over the place (controllers, views, models, etc) I will create a way for the framework to allow applications (or plugins in this case) specify other locations to look for files.



For example, say our "Forum" plugin wants to add a controller without having the user copy the forum controller to the controllers directory.



The plugin can hook into the "pre-initiation" hook and tell the framework (Avalon) to also look for files in the "plugins/forum/controllers" directory, so when Avalon is trying to find the forum controller file and it's not in the normal location, it will look at the extra files array and look for it there.



Now the array work two different ways.



The first being an array of directories it loops over, or an array of exact locations for the file name, for example:

Code: Select all


$controllers = array(

    "plugins/forum/controllers"

);



// or



// Most likely candidate, so as to not waste time

// looping through an array for the right file.

$controllers = array(

    'ForumController' => "plugins/forum/controllers/forum_controller.php"

);

 


I will most likely start working on this on the weekend, been busy with birthdays.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Changelog from svn/git

Post by arturo182 » Mon Feb 13, 2012 2:34 pm

It sounds great. I think it should be done like this: every plugin gets its own folder and inside that folder it can have directories like "controllers", "views", "models", "helpers" and so on. The framework when loading a plugin checks if those directories exist, if they do, they are added to the lookup list.



For example here's lightbox plugin for Redmine: https://github.com/zipme/redmine_lightbox

it has the same directory structure as Redmine but it's kept in a separate folder.

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Changelog from svn/git

Post by Jack » Mon Feb 13, 2012 3:32 pm

I could try both.



Give plugins the option to register the location of controllers/models/etc and eventually fall back to searching plugin directories.



For example, say we're looking for the "ForumController" (which hasn't been registered by the plugin), the file finder will look in the registered controllers array and find nothing, then in Traq's controllers directory and find nothing, it will then check plugin directories and find it in "plugins/forum/controllers/" and load it.
Last edited by Jack on Mon Feb 13, 2012 3:33 pm, edited 1 time in total.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Changelog from svn/git

Post by arturo182 » Mon Feb 13, 2012 9:08 pm

If the plugin developer is going to know that the framework is going to search the plugin's "controllers" directory if he adds the controller manually or not, is he going to bother adding the controller? I think not ;)



Also searching a "static" list of controllers is going to take some time and the performance will decrease.

User avatar
Jack
Advanced Member
Posts: 666
Joined: Fri Mar 27, 2009 7:37 pm
Location: Australia

Re: Changelog from svn/git

Post by Jack » Mon Feb 13, 2012 9:54 pm

[quote='arturo182' pid='647' dateline='1329127688']

Also searching a "static" list of controllers is going to take some time and the performance will decrease.

[/quote]



Not exactly, for example:


Code: Select all


// Checking if the controller is registered

if (isset($controllers['ForumController']))

{

    require $controllers['ForumController'];

}



// as apposed to

foreach (scandir('plugins') as $dir)

{

    if ($file = file_exists($dir . '/controllers/' . $controller . '.php'))

    {

        require $file;

    }

}

 


The first option saves having to search possibly dozens of plugin directories, it also allows plugins to change the default controllers, say for a better project wiki for example.

User avatar
arturo182
Advanced Member
Posts: 151
Joined: Mon Mar 22, 2010 10:28 am
Contact:

Re: Changelog from svn/git

Post by arturo182 » Mon Feb 13, 2012 10:53 pm

You're right, not sure why but I thought that iterating the list was necessary and it's not ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest