Skip to content

Commit

Permalink
Follow symlinks, save files in export folder
Browse files Browse the repository at this point in the history
  • Loading branch information
zamoroka committed Feb 8, 2021
1 parent dfba153 commit 64833cc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
./.git
./.idea
./vendor
./export
*.dot
*.pdf
*.svg
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
## usage
- `cd magento-dependency-graph`
- `sh getDependencyGraph.sh "path-to-the-magento-2-folder" "ModuleVendor"` to generate `.dot`, `.pdf` and `.svg` files.
- view files in root folder
- view files in "export" folder

## example of generated dependency graph
![example](https://github.com/zamoroka/magento-dependency-graph/blob/master/example.svg?raw=true)
Expand Down
2 changes: 1 addition & 1 deletion app/ClassFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function rSearch($folder, $pattern)
if (!is_dir($folder)) {
return $fileList;
}
$dir = new \RecursiveDirectoryIterator($folder);
$dir = new \RecursiveDirectoryIterator($folder, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
$ite = new \RecursiveIteratorIterator($dir);
$files = new \RegexIterator($ite, $pattern, \RegexIterator::GET_MATCH);
foreach ($files as $file) {
Expand Down
15 changes: 12 additions & 3 deletions getDependencyGraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ fi
FILE_MAGENTO="$1/bin/magento"

if [ -f "$FILE_MAGENTO" ]; then
[ -d export ] || mkdir export

FILE_PDF=./export/"$(date +%Y-%m-%d)".pdf
FILE_SVG=./export/"$(date +%Y-%m-%d)".svg
FILE_DOT=./export/"$(date +%Y-%m-%d)".dot

echoinf "Starting .dot generation at: $(date +%Y\.%m\.%d) $(date +%H:%M:%S)"
php index.php --magento-dir "$1" --module-vendor "$2" >"$(date +%Y-%m-%d)".dot
php index.php --magento-dir "$1" --module-vendor "$2" >"$FILE_DOT"
echoinf "Completed .dot generation at: $(date +%Y\.%m\.%d) $(date +%H:%M:%S)"
dot -Tpdf -o"$(date +%Y-%m-%d)".pdf -Tsvg -o"$(date +%Y-%m-%d)".svg "$(date +%Y-%m-%d)".dot
echosuc "Done."
dot -Tpdf -o "$FILE_PDF" -Tsvg -o "$FILE_SVG" "$FILE_DOT"
echosuc "Done:"
echosuc " $FILE_PDF"
echosuc " $FILE_SVG"
echosuc " $FILE_DOT"
else
echoerr "Provided directory '$1' is missing Magento 2 files"
fi

0 comments on commit 64833cc

Please sign in to comment.