Skip to content

Instantly share code, notes, and snippets.

@ctcherry
Created January 17, 2009 09:27
Show Gist options
  • Save ctcherry/48299 to your computer and use it in GitHub Desktop.
Save ctcherry/48299 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -d $1 ]; then
echo "Directory $1 already exists"
exit
else
echo "Creating Rails project in ./$1 using edge rails..."
echo "- Making directory $1"
mkdir $1
cd $1
echo "- Using git to clone edge rails into vendor/rails"
git clone -q --depth 1 git://github.com/rails/rails.git vendor/rails
echo "- Removing unnecissary rails .git directory and .gitignore file"
rm -Rf vendor/rails/.git
rm vendor/rails/.gitignore
echo "- Using rails command from vendor/rails to initialize project"
ruby vendor/rails/railties/bin/rails .
echo "- Initializing local git repository"
git init -q
echo "- Ignoring tmp, log, sqlite, and other useless files"
echo ".DS_Store" >> .gitignore
echo "log/*.log" >> .gitignore
echo "tmp/**/*" >> .gitignore
echo "db/*.sqlite3" >> .gitignore
touch tmp/.gitignore
touch log/.gitignore
echo "- Commit initial project setup"
git add .
git commit -q -m "Create default edge rails project: $1"
echo "- For developer database privacy, rename the default database.yml to database.yml-sample"
mv config/database.yml config/database.yml-sample
echo "- Ignore the config/database.yml that will exist, so there are no passwords in the repository"
echo "config/database.yml" >> .gitignore
echo "- Commit database config file changes"
git add config/database.yml-sample
git commit -a -q -m "Ignore and rename database config file to avoid commiting passwords into the repository"
echo "Done!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment