Skip to content

Add a link.sh script to ease debugging Flex apps #24708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions link.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Author: Kévin Dunglas

if [ $# -eq 0 ]
then
echo "Link dependencies to components to a local clone of the monolithic Symfony repository"
echo ""
echo "Usage: ./link.sh /path/to/the/project"
exit
fi

# Can't use maps because Mac OS doesn't ship Bash 4 by default...
declare -a dirs names

for dir in $(find $(pwd)/src/Symfony/{Bundle,Bridge,Component} -type d -maxdepth 1 -mindepth 1)
do
dirs+=($dir)
names+=($(cat $dir/composer.json | egrep -o '"name": "symfony/[a-zA-Z0-9-]+"' | egrep -o 'symfony/[a-zA-Z0-9-]+'))
done

for vendor in $(find $1/vendor/symfony -type d -maxdepth 1 -mindepth 1)
do
vendorName=$(echo $vendor | rev | cut -sd / -f -2 | rev)
for i in "${!names[@]}"
do
name=${names[$i]}

if [ "$name" = "$vendorName" ]
then
mv $vendor $vendor.back
ln -s ${dirs[$i]} $vendor
echo "$vendorName linked to ${dirs[$i]}"
continue
fi
done
done