Author: tkoomzaaskz Date: 2010-05-02 13:37:20 +0200 (Sun, 02 May 2010) New Revision: 29335
Modified: plugins/sfApplicationMapPlugin/trunk/LICENSE plugins/sfApplicationMapPlugin/trunk/README plugins/sfApplicationMapPlugin/trunk/config/map.ini plugins/sfApplicationMapPlugin/trunk/lib/task/ plugins/sfApplicationMapPlugin/trunk/lib/task/sfProjectApplicationMapTask.class.php plugins/sfApplicationMapPlugin/trunk/package.xml Log: [application map] components support added - release 1.2.0 Modified: plugins/sfApplicationMapPlugin/trunk/LICENSE =================================================================== --- plugins/sfApplicationMapPlugin/trunk/LICENSE 2010-05-01 13:09:03 UTC (rev 29334) +++ plugins/sfApplicationMapPlugin/trunk/LICENSE 2010-05-02 11:37:20 UTC (rev 29335) @@ -1,4 +1,4 @@ -Copyright (c) 2009 Tomasz Ducin +Copyright (c) 2009-2010 Tomasz Ducin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Modified: plugins/sfApplicationMapPlugin/trunk/README =================================================================== --- plugins/sfApplicationMapPlugin/trunk/README 2010-05-01 13:09:03 UTC (rev 29334) +++ plugins/sfApplicationMapPlugin/trunk/README 2010-05-02 11:37:20 UTC (rev 29335) @@ -43,14 +43,22 @@ ============= All visual settings of the images can be set in the __config/map.ini__ file of -the plugin. Check GraphViz documentation for more details. +the plugin. Example settings look like the following: + app_shape = doublecircle + app_style = filled + app_fillcolor = goldenrod2 + +You can find all properties properly interpreted by GraphViz in its +documentation, such as [colors](http://www.graphviz.org/doc/info/colors.html) or +[shapes](http://www.graphviz.org/doc/info/shapes.html). + Important notes =============== - * All actions in _actions.class.php_ must be documented for the plugin to - parse them. Use the default action skeleton documentation block provided - with symfony. + * All actions in _actions.class.php_ or _components.class.php_ must be + documented for the plugin to parse them. Use the default action skeleton + documentation block provided with symfony. Application map examples ======================== @@ -63,13 +71,24 @@  +## dot example with components + + + +## fdp example with components + + + Prerequisites ============= * You must have [GraphViz](http://www.graphviz.org/Documentation.php) installed on your system. -Coming soon -=========== +Additional +========== - * support for plugin modules + * coming soon: support for plugin modules + + * thanks for all comments, suggestions and bug reports, they help a lot! Feel + free to write me. Modified: plugins/sfApplicationMapPlugin/trunk/config/map.ini =================================================================== --- plugins/sfApplicationMapPlugin/trunk/config/map.ini 2010-05-01 13:09:03 UTC (rev 29334) +++ plugins/sfApplicationMapPlugin/trunk/config/map.ini 2010-05-02 11:37:20 UTC (rev 29335) @@ -1,15 +1,18 @@ -root_shape = doubleoctagon -root_style = filled -root_fillcolor = goldenrod3 -app_shape = doublecircle -app_style = filled -app_fillcolor = goldenrod2 -module_shape = diamond -module_style = filled -module_fillcolor = goldenrod1 -admin_shape = component -admin_style = filled -admin_fillcolor = bisque2 -action_shape = rectangle -action_style = filled -action_fillcolor = beige +root_shape = doubleoctagon +root_style = filled +root_fillcolor = goldenrod3 +app_shape = doublecircle +app_style = filled +app_fillcolor = goldenrod2 +module_shape = diamond +module_style = filled +module_fillcolor = goldenrod1 +admin_shape = component +admin_style = filled +admin_fillcolor = bisque2 +action_shape = rectangle +action_style = filled +action_fillcolor = beige +component_shape = tab +component_style = filled +component_fillcolor = azure2 Property changes on: plugins/sfApplicationMapPlugin/trunk/lib/task ___________________________________________________________________ Added: svn:ignore + .directory Modified: plugins/sfApplicationMapPlugin/trunk/lib/task/sfProjectApplicationMapTask.class.php =================================================================== --- plugins/sfApplicationMapPlugin/trunk/lib/task/sfProjectApplicationMapTask.class.php 2010-05-01 13:09:03 UTC (rev 29334) +++ plugins/sfApplicationMapPlugin/trunk/lib/task/sfProjectApplicationMapTask.class.php 2010-05-02 11:37:20 UTC (rev 29335) @@ -177,39 +177,64 @@ } else // actions reading { - $actions_file_path = $dir_mod.$file_mod.'/actions/actions.class.php'; - $actions_file = file($actions_file_path); - $actions_content = implode("", $actions_file); - $matches = array(); - $pattern = "/\/\*\*((.|\n)*?)public function execute([0-9A-Za-z_]*)/"; - preg_match_all($pattern, $actions_content, $matches); - $content[$file_app][$file_mod]['comments'] = $matches[1]; - $content[$file_app][$file_mod]['actions'] = $matches[3]; - $pattern_internal = "/\/\*\*((.|\n)*?)\*\//"; - preg_match($pattern_internal, $content[$file_app][$file_mod]['comments'][0], $content[$file_app][$file_mod]['comments'][0]); - $content[$file_app][$file_mod]['comments'][0] = $content[$file_app][$file_mod]['comments'][0][0]; + $actions_dir = $dir_mod.$file_mod.'/actions/'; + $element_files = array(); - // lowercasing action names - foreach($content[$file_app][$file_mod]['actions'] as $key => &$action) + // actions + $actions_file_path = $actions_dir.'actions.class.php'; + if (file_exists($actions_file_path)) { - $action = strtolower($action); + $element_files['action'] = file($actions_file_path); } + + // components + $components_file_path = $actions_dir.'components.class.php'; + if (file_exists($components_file_path)) + { + $element_files['component'] = file($components_file_path); + } + + foreach($element_files as $type => $file) + { + $file_content = implode("", $file); + $matches = array(); + $pattern = "/\/\*\*((.|\n)*?)public function execute([0-9A-Za-z_]*)/"; + preg_match_all($pattern, $file_content, $matches); + $content[$file_app][$file_mod][$type]['comments'] = $matches[1]; + $content[$file_app][$file_mod][$type]['elements'] = $matches[3]; + $pattern_internal = "/\/\*\*((.|\n)*?)\*\//"; + preg_match($pattern_internal, $content[$file_app][$file_mod][$type]['comments'][0], $content[$file_app][$file_mod][$type]['comments'][0]); + $content[$file_app][$file_mod][$type]['comments'][0] = $content[$file_app][$file_mod][$type]['comments'][0][0]; + } + // lowercasing action/component names + foreach($content[$file_app][$file_mod] as $type => &$elements) + { + foreach($elements['elements'] as $key => &$element) + { + $element[0] = strtolower($element[0]); // lowercase only the first letter + // lcfirst available since (PHP 5 >= 5.3.0) + } + } + // retrieving comment text - foreach($content[$file_app][$file_mod]['comments'] as $key => &$comment) + foreach($content[$file_app][$file_mod] as $type => &$elements) { - // creating temporary lines array - $lines = explode("\n", $comment); + foreach($elements['comments'] as $key => &$comment) + { + // creating temporary lines array + $lines = explode("\n", $comment); - // destroying first line which is either whitespaced or '/**' - unset($lines[0]); + // destroying first line which is either whitespaced or '/**' + unset($lines[0]); - // result comment array - $lines_res = array(); - for($ind = 1; $ind <= count($lines) && trim($lines[$ind]) != "*"; $ind++) - { - $lines_res[] = trim(substr(trim($lines[$ind]), 2)); + // result comment array + $lines_res = array(); + for($ind = 1; $ind <= count($lines) && trim($lines[$ind]) != "*"; $ind++) + { + $lines_res[] = trim(substr(trim($lines[$ind]), 2)); + } + $comment = implode(" ", $lines_res); } - $comment = implode(" ", $lines_res); } } } @@ -288,20 +313,24 @@ 'comment' => $mod_name.' module', 'style' => $config['module_style'], 'fillcolor' => $config['module_fillcolor'])); - foreach($mod_content['actions'] as $act_index => $act_name) + // loop iterating each action/component + foreach($mod_content as $type => $elements) { - $act_comment = $this->getFormattedComment($mod_content['comments'][$act_index]); - $graph->addNode( - $app_name.'_'.$mod_name.'_'.$act_name, - array( - 'label' => "<table border=\"0\" cellborder=\"0\"><tr><td><font color=\"chartreuse4\" face=\"Courier-New\" point-size=\"16\">".$act_name."</font></td></tr>\n<tr><td width=\"5\">$act_comment</td></tr></table>", - 'shape' => $config['action_shape'], - 'comment' => $act_name.' module', - 'width' => '1.0', - 'style' => $config['action_style'], - 'fillcolor' => $config['action_fillcolor'])); - // link module to an action - $graph->addEdge(array($app_name.'_'.$mod_name => $app_name.'_'.$mod_name.'_'.$act_name)); + foreach($elements['elements'] as $elem_index => $elem_name) + { + $elem_comment = $this->getFormattedComment($mod_content[$type]['comments'][$elem_index]); + $graph->addNode( + $app_name.'_'.$mod_name.'_'.$elem_name, + array( + 'label' => "<table border=\"0\" cellborder=\"0\"><tr><td><font color=\"chartreuse4\" face=\"Courier-New\" point-size=\"16\">".$elem_name."</font></td></tr>\n<tr><td width=\"5\">$elem_comment</td></tr></table>", + 'shape' => $config[$type.'_shape'], + 'comment' => $elem_name.' module', + 'width' => '1.0', + 'style' => $config[$type.'_style'], + 'fillcolor' => $config[$type.'_fillcolor'])); + // link module to an action/component + $graph->addEdge(array($app_name.'_'.$mod_name => $app_name.'_'.$mod_name.'_'.$elem_name)); + } } } // link application to a module Modified: plugins/sfApplicationMapPlugin/trunk/package.xml =================================================================== --- plugins/sfApplicationMapPlugin/trunk/package.xml 2010-05-01 13:09:03 UTC (rev 29334) +++ plugins/sfApplicationMapPlugin/trunk/package.xml 2010-05-02 11:37:20 UTC (rev 29335) @@ -10,10 +10,10 @@ <email>[email protected]</email> <active>yes</active> </lead> - <date>2010-01-01</date> + <date>2010-05-02</date> <time>11:00:00</time> <version> - <release>1.1.1</release> + <release>1.2.0</release> <api>1.0.0</api> </version> <stability> @@ -85,6 +85,23 @@ <release> <version> + <release>1.2.0</release> + <api>1.0.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <license uri="http://www.symfony-project.org/license">MIT license</license> + <date>2010-05-02</date> + <license>MIT</license> + <notes> + * distinguish between actions and components + </notes> + </release> + + <release> + <version> <release>1.1.0</release> <api>1.0.0</api> </version> -- You received this message because you are subscribed to the Google Groups "symfony SVN" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-svn?hl=en.
