you are in: codestackercodes [RSS]bash script to create rails and subversion structure

bash script to create rails and subversion structure Delicious Email

show/hide lines
   1  #!/bin/bash
   2  
   3  echo "########################################"
   4  echo ""
   5  echo ""
   6  echo "This bash script creates a new rails project and do the initial svn import with ignoring/deleting files from subversion"
   7  echo ""
   8  echo ""
   9  echo "#######################################"
  10  
  11  echo "Enter svn username: "
  12  read username
  13  echo "Enter the svn url: "
  14  read svn_url
  15  
  16  echo "Enter Rails Application Path:(eg: /home/leonardofaria/Sites/): "
  17  read app_path
  18  echo "Enter Application Name: "
  19  read app_name
  20  
  21  echo "######################################"
  22  echo "Please verify the following variables: "
  23  echo "Svn Username: ${username}"
  24  echo "Svn URL: ${svn_url}"
  25  echo "Application Path: ${app_path}"
  26  echo "Application name: ${app_name}"
  27  
  28  echo "Proceed (y/n)"
  29  read proceed
  30  
  31  if [ ${proceed} = n ] || [ ${proceed} = N ]
  32      then
  33      echo "Terminating..."
  34      exit 0
  35  elif [ ${proceed} = y ] || [ ${proceed} = Y ]
  36      then
  37      app_root="${app_path}/${app_name}"
  38      echo "Generating rails project: (${app_root})"
  39      rails ${app_root}
  40  
  41      echo "SVNinitial import: "
  42      svn import ${app_root} ${svn_url} -m "Initial Import" --username $username
  43  
  44      rm -rf ${app_root}
  45     
  46      echo "Checking out from svn: "
  47  
  48      svn checkout ${svn_url} ${app_root}
  49      cd ${app_root}
  50      echo "Removing all log files from SVN"
  51      svn remove log/*
  52      echo "commiting..."
  53      svn commit -m 'removing all log files from subversion'
  54      echo "Ignoring all log files under log dir"
  55      svn propset svn:ignore "*.log" log/
  56      echo "Updating and commiting..."
  57      svn update log/
  58      svn commit -m 'Ignoring all files in /log/ ending in .log'
  59  
  60      echo "Ignoring cache, sessions, sockets inside tmp dir"
  61      svn propset svn:ignore "*" tmp/sessions tmp/cache tmp/sockets
  62      echo "commiting tmp "
  63      svn commit -m "Ignoring all files in /tmp/"
  64      echo "Updating and commiting again...."
  65  
  66      svn update tmp/
  67      svn commit -m 'Ignore the whole tmp/ directory, might not work on subdirectories?'
  68      echo "Moving database.yml to database.example"
  69      svn move config/database.yml config/database.example
  70      echo "commiting..."
  71      svn commit -m 'Moving database.yml to database.example to provide a template for anyone who checks out the code'
  72      echo "Ignoring database.yml , updating and commiting..."
  73      svn propset svn:ignore "database.yml" config/
  74      svn update config/
  75      svn commit -m 'Ignoring database.yml'
  76      echo "Finished."
  77  
  78  else
  79      echo "Unknown Input. Terminating..."
  80  	exit 0
  81  fi
created by leozera — 15 November 2008 — get a short url — tags: rails subversion embed

Comments



We dont send spam :)

If checked, it's highlights your comment
simple_captcha.jpg
Are you a human? Type the code from the image