Posted By

tictoc on 01/12/07


Tagged

svn Bash rails


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

leachypeachy


Bash script for new Rails project with SVN


 / Published in: Bash
 

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

  1. #!/bin/bash
  2.  
  3. echo "########################################"
  4. echo "This bash script creates a new rails project and do the initial svn import with ignoring/deleting files from subversion"
  5. echo "Please send your feedback to Akhil Bansal<[email protected]>"
  6. echo "I have tested this script and it works great on my system."
  7. echo ""
  8. echo ""
  9. echo " ###### ATTENTION #######"
  10. echo ""
  11. echo ""
  12. echo "Use this script at your own risk, if your computer explodes its not my fault :-) "
  13. echo "#######################################"
  14.  
  15. echo "Enter svn username: "
  16. read username
  17. echo "Enter the svn url: "
  18. read svn_url
  19.  
  20. echo "Enter Rails Application Path:(eg: /home/akhil/ror): "
  21. read app_path
  22. echo "Enter Application Name: "
  23. read app_name
  24.  
  25. echo "######################################"
  26. echo "Please verify the following variables: "
  27. echo "Svn Username: ${username}"
  28. echo "Svn URL: ${svn_url}"
  29. echo "Application Path: ${app_path}"
  30. echo "Application name: ${app_name}"
  31.  
  32. echo "Proceed (y/n)"
  33. read proceed
  34.  
  35. if [ ${proceed} = n ] || [ ${proceed} = N ]
  36. then
  37. echo "Tenminating..."
  38. exit 0
  39. elif [ ${proceed} = y ] || [ ${proceed} = Y ]
  40. then
  41. app_root="${app_path}/${app_name}"
  42. echo "Generating rails project: (${app_root})"
  43. rails ${app_root}
  44.  
  45. echo "SVNinitial import: "
  46. svn import ${app_root} ${svn_url} -m "Initial Import" --username $username
  47.  
  48.  
  49.  
  50. rm -rf ${app_root}
  51.  
  52. echo "Checking out from svn: "
  53.  
  54. svn checkout ${svn_url} ${app_root}
  55. cd ${app_root}
  56. echo "Removing all log files from SVN"
  57. svn remove log/*
  58. echo "commiting..."
  59. svn commit -m 'removing all log files from subversion'
  60. echo "Ignoring all log files under log dir"
  61. svn propset svn:ignore "*.log" log/
  62. echo "Updating and commiting..."
  63. svn update log/
  64. svn commit -m 'Ignoring all files in /log/ ending in .log'
  65. echo "Removing tmp directory from SVN"
  66. svn remove tmp/
  67. echo "commiting..."
  68. svn commit -m 'removing the temp directory from subversion'
  69. echo "Ignoring tmp dir"
  70. svn propset svn:ignore "*" tmp/
  71. echo "Updating and commiting again...."
  72.  
  73. svn update tmp/
  74. svn commit -m 'Ignore the whole tmp/ directory, might not work on subdirectories?'
  75. echo "Moving database.yml to database.example"
  76. svn move config/database.yml config/database.example
  77. echo "commiting..."
  78. svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'
  79. echo "Ignoring database.yml , updating and commiting..."
  80. svn propset svn:ignore "database.yml" config/
  81. svn update config/
  82. svn commit -m 'Ignoring database.yml'
  83.  
  84. else
  85. echo "Unknown Input. Exiting..."
  86. exit 0
  87. fi

Report this snippet  

You need to login to post a comment.