Skip to content

Instantly share code, notes, and snippets.

@archy-bold
Last active September 16, 2015 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archy-bold/119ff3c7752a9fcbba51 to your computer and use it in GitHub Desktop.
Save archy-bold/119ff3c7752a9fcbba51 to your computer and use it in GitHub Desktop.
Script to clone a SliMVC instance and do some basic setup, including changing project name and setting up the git repositry.
#!/bin/bash
# Input the project details
echo "Enter the project name:"
read name
echo "Enter a description for the project:"
read description
echo "Enter the git repo for the project:"
read repo
echo "Cloning..."
# Clone the repo
git clone git@github.com:archy-bold/slimvc.git $name
echo "Initialising..."
cd $name
# Reset the repo
rm -rf .git
git init
# Alter the json files with the correct project details
sed -i "s/\"name\": \"slimvc\"/\"name\": \"${name}\"/g" bower.json
sed -i "s/\"name\": \"slimvc\"/\"name\": \"${name}\"/g" package.json
sed -i "s/\"name\": \"slimvc\"/\"name\": \"${name}\"/g" project.json
sed -i "s/\"version\": \"[0-9.]*\"/\"version\": \"0.0.0\"/g" bower.json
sed -i "s/\"version\": \"[0-9.]*\"/\"version\": \"0.0.0\"/g" package.json
sed -i "s/\"version\": \"[0-9.]*\"/\"version\": \"0.0.0\"/g" project.json
sed -i "s/\"description\": \"[A-Za-z0-9\s_.,!'/$]*\"/\"description\": \"${description}\"/g" package.json
sed -i "s/\"description\": \"[A-Za-z0-9\s_.,!'/$]*\"/\"description\": \"${description}\"/g" project.json
sed -i "s,\"url\": \"git@github.com:archy-bold/slimvc.git\",\"url\": \"${repo}\"," package.json
# Do an initial commit
git add .
git commit -m "Initial commit, empty SliMVC project."
git flow init -d
git remote add origin $repo
git push -u origin --all
git push -u origin --tag
composer install
echo "Initialised an empty repo. Just add a remote origin and get coding!"
echo "Run `npm install` followed by `gulp` to begin compressing assets."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment