you are here: codestackercodes [RSS] → tag subversion [RSS]

ignored rails' files in subversion

svn propset svn:ignore '*' log
svn propset svn:ignore '*' tmp/cache
svn propset svn:ignore '*' tmp/pids
svn propset svn:ignore '*' tmp/sessions
svn propset svn:ignore '*' tmp/sockets
svn commit -m "Set various ignores"

ignore all files from a folder

ignores all files in 'photo' folder

svn propset svn:ignore “*” public/photo/

reverting a file with subversion

svn up -r PREV yourfile

bash script to create rails and subversion structure

#!/bin/bash

echo "########################################"
echo ""
echo ""
echo "This bash script creates a new rails project and do the initial svn import with ignoring/deleting files from subversion"
echo ""
echo ""
echo "#######################################"

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

echo "Enter Rails Application Path:(eg: /home/leonardofaria/Sites/): "
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 "Terminating..."
    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 "Ignoring cache, sessions, sockets inside tmp dir"
    svn propset svn:ignore "*" tmp/sessions tmp/cache tmp/sockets
    echo "commiting tmp "
    svn commit -m "Ignoring all files in /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'
    echo "Finished."

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

remove SVN control

removes all .svn directories recursively

find . -name .svn -exec rm -rf {} \; 

find . -name .svn -print0 | xargs -0 rm -rf
Displaying all 5 Code