Created
June 6, 2012 03:11
-
-
Save mtimkovich/2879629 to your computer and use it in GitHub Desktop.
CodeIgniter New Project Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Usage: $0 [app]" | |
exit | |
fi | |
cache_dir="$XDG_CONFIG_HOME/codeigniter" | |
if [ ! -d $cache_dir ]; then | |
mkdir -p $cache_dir || exit 1 | |
fi | |
original_dir=$PWD | |
download='http://www.codeigniter.com/download.php' | |
cd $cache_dir | |
file=$(curl -LI --max-redirs 1 $download 2>/dev/null | grep Location | tail -1 | sed 's#.*/##;s#\r##') || exit 1 | |
folder=$(echo $file | sed 's/\.zip$//') | |
if [ -z $(echo "$file" | grep 'CodeIgniter') ]; then | |
echo 'Error downloading CodeIgniter' 1>&2 | |
exit | |
fi | |
if [ ! -f $file ]; then | |
wget --trust-server-names $download || exit 1 | |
unzip $file || exit 1 | |
fi | |
cd $original_dir | |
cp -rn "$cache_dir/$folder" "$1" || exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment