Author: tkoomzaaskz Date: 2010-05-02 14:00:47 +0200 (Sun, 02 May 2010) New Revision: 29337
Modified: plugins/sfApplicationMapPlugin/branches/1.2/LICENSE plugins/sfApplicationMapPlugin/branches/1.2/README plugins/sfApplicationMapPlugin/branches/1.2/config/map.ini plugins/sfApplicationMapPlugin/branches/1.2/lib/task/sfProjectApplicationMapTask.class.php plugins/sfApplicationMapPlugin/branches/1.2/package.xml plugins/sfApplicationMapPlugin/branches/1.4/config/map.ini plugins/sfApplicationMapPlugin/branches/1.4/lib/task/sfProjectApplicationMapTask.class.php Log: [application map] updated 1.2 branch Modified: plugins/sfApplicationMapPlugin/branches/1.2/LICENSE =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.2/LICENSE 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.2/LICENSE 2010-05-02 12:00:47 UTC (rev 29337) @@ -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/branches/1.2/README =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.2/README 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.2/README 2010-05-02 12:00:47 UTC (rev 29337) @@ -10,7 +10,7 @@ Install the plugin via the subversion repository by executing the following command from the project root directory: - $ svn co http://svn.symfony-project.com/plugins/sfApplicationMapPlugin/branches/1.2 plugins/sfApplicationMapPlugin + $ svn co http://svn.symfony-project.com/plugins/sfApplicationMapPlugin/branches/1.4 plugins/sfApplicationMapPlugin or by using the default symfony plugin install command: @@ -24,7 +24,7 @@ $ ./symfony project:application-map -which creates few files under the _doc/graph_ directory: +which creates the _doc/graph_ directory and few files inside it: * __application-map.dot__ - source graphviz file for all image files @@ -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,8 +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. + +Additional +========== + + * 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/branches/1.2/config/map.ini =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.2/config/map.ini 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.2/config/map.ini 2010-05-02 12:00:47 UTC (rev 29337) @@ -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 Modified: plugins/sfApplicationMapPlugin/branches/1.2/lib/task/sfProjectApplicationMapTask.class.php =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.2/lib/task/sfProjectApplicationMapTask.class.php 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.2/lib/task/sfProjectApplicationMapTask.class.php 2010-05-02 12:00:47 UTC (rev 29337) @@ -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/branches/1.2/package.xml =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.2/package.xml 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.2/package.xml 2010-05-02 12:00:47 UTC (rev 29337) @@ -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.0.2</release> + <release>1.0.3</release> <api>1.0.0</api> </version> <stability> @@ -68,6 +68,23 @@ <release> <version> + <release>1.0.3</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.0.2</release> <api>1.0.0</api> </version> Modified: plugins/sfApplicationMapPlugin/branches/1.4/config/map.ini =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.4/config/map.ini 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.4/config/map.ini 2010-05-02 12:00:47 UTC (rev 29337) @@ -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 Modified: plugins/sfApplicationMapPlugin/branches/1.4/lib/task/sfProjectApplicationMapTask.class.php =================================================================== --- plugins/sfApplicationMapPlugin/branches/1.4/lib/task/sfProjectApplicationMapTask.class.php 2010-05-02 11:47:17 UTC (rev 29336) +++ plugins/sfApplicationMapPlugin/branches/1.4/lib/task/sfProjectApplicationMapTask.class.php 2010-05-02 12:00:47 UTC (rev 29337) @@ -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 -- 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.
