Return to Snippet

Revision: 2381
at February 6, 2007 17:00 by sudarkoff


Initial Code
#!/bin/bash

echo "########################################"
echo "This bash script creates a new rails project and do the initial svn import with ignoring/deleting files from subversion"
echo "Please send your feedback to Akhil Bansal<[email protected]>"
echo "I have tested this script and it works great on my system."
echo ""
echo ""
echo "                    ###### ATTENTION #######"
echo ""
echo ""
echo "Use this script at your own risk, if your computer explodes its not my fault :-) "
echo "#######################################"

echo "Enter svn username: "
read username
echo "Enter the svn url: "
read svn_url

echo "Enter Rails Application Path:(eg: /home/akhil/ror): "
read app_path
echo "Enter Application Name: "
read app_name

echo "######################################"
echo "Please verify the following variables: "
echo "Svn Username: ${username}"
echo "Svn URL: ${svn_url}"
echo "Application Path: ${app_path}"
echo "Application name: ${app_name}"

echo "Proceed (y/n)"
read proceed

if [ ${proceed} = n ] || [ ${proceed} = N ]
    then
    echo "Tenminating..."
    exit 0
elif [ ${proceed} = y ] || [ ${proceed} = Y ]
    then
    app_root="${app_path}/${app_name}"
    echo "Generating rails project: (${app_root})"
    rails ${app_root}

    echo "SVNinitial import: "
    svn import ${app_root} ${svn_url} -m "Initial Import" --username $username


   
    rm -rf ${app_root}
   
    echo "Checking out from svn: "

    svn checkout ${svn_url} ${app_root}
    cd ${app_root}
    echo "Removing all log files from SVN"
    svn remove log/*
    echo "commiting..."
    svn commit -m 'removing all log files from subversion'
    echo "Ignoring all log files under log dir"
    svn propset svn:ignore "*.log" log/
    echo "Updating and commiting..."
    svn update log/
    svn commit -m 'Ignoring all files in /log/ ending in .log'
    echo "Removing tmp directory from SVN"
    svn remove tmp/
    echo "commiting..."
    svn commit -m 'removing the temp directory from subversion'
    echo "Ignoring tmp dir"
    svn propset svn:ignore "*" tmp/
    echo "Updating and commiting again...."

    svn update tmp/
    svn commit -m 'Ignore the whole tmp/ directory, might not work on subdirectories?'
    echo "Moving database.yml to database.example"
    svn move config/database.yml config/database.example
    echo "commiting..."
    svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'
    echo "Ignoring database.yml , updating and commiting..."
    svn propset svn:ignore "database.yml" config/
    svn update config/
    svn commit -m 'Ignoring database.yml'

else
    echo "Unknown Input. Exiting..."
	exit 0
fi

Initial URL
http://webonrails.com/wp-content/uploads/create_rails_with_subversion

Initial Description

                                

Initial Title
Create RoR project skeleton in svn

Initial Tags
svn, Bash, rails, ruby

Initial Language
Bash