Skip to content

Instantly share code, notes, and snippets.

@patcoll
Created April 13, 2011 15:26
Show Gist options
  • Save patcoll/917747 to your computer and use it in GitHub Desktop.
Save patcoll/917747 to your computer and use it in GitHub Desktop.
Copy only certain Zend Framework libs and their dependencies into a specified directory
#!/bin/bash
#
# Copy only certain Zend Framework libs and their dependencies into a specified directory.
#
# This script was created because copying the entire Zend Framework into an existing project
# is not really necessary if you only want to use part of it. However you fall into dependency
# hell because most sub-libraries use multi-purpose libs like Zend_Exception and Zend_Validate.
#
# Put this script in a fresh copy of ZF's `library` folder and run it as follows:
#
# USAGE:
# ./copy_zf_files.sh Zend/Barcode <DESTINATION FOLDER>
#
lib=$1
dest=$2
for pattern in $(grep -Ehor "Zend_[A-Za-z0-9]+" $lib | sort | uniq | sed 's=_=/=') Zend/Loader; do
if [[ -d $pattern || -f $pattern.php ]]; then
ls -1d $pattern* | xargs -J % cp -rp % $dest
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment