使用SVN的新Rails项目的Bash脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用SVN的新Rails项目的Bash脚本相关的知识,希望对你有一定的参考价值。
#!/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
以上是关于使用SVN的新Rails项目的Bash脚本的主要内容,如果未能解决你的问题,请参考以下文章
在本地进行shell脚本中执行svn命令,为啥提示bash: svn: command not found?
SVN 通过Shell Bash 获取项目Reversion号码