Created
October 11, 2013 01:47
-
-
Save D3xx73r/6928430 to your computer and use it in GitHub Desktop.
Deployment using Rails + Git + Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set the rails environment | |
export RAILS_ENV=environment | |
#If app directory is present | |
if [ -d /some/app/directory ]; then | |
cd /some/app/directory | |
#Fetch latest changes from origin and update our local branch | |
git fetch origin | |
git reset --hard origin/master | |
#Installing gems | |
bundle install | |
#This is only necesary if you added your database.yml file to your .gitignore | |
#Also you will need to previously add the database.yml file to a directory in your server | |
#Copy database configuration file to the right place | |
cp /path/to/database-to-copy.yml config/database.yml | |
#If the directory does not exist | |
else | |
#First run: we need to clone the repo. | |
cd /desired/directory | |
git clone [email protected]:PATH/to.git | |
cd git_repo | |
#Installing gems | |
bundle install | |
#This is only necesary if you added your database.yml file to your .gitignore | |
#Also you will need to previously add the database.yml file to a directory in your server | |
#Copy database configuration file to the right place | |
cp /path/to/database-to-copy.yml config/database.yml | |
#Create the database | |
rake db:create | |
fi | |
bundle exec rake db:migrate | |
#If app's tmp directory exist | |
#This is only necesary if you're using a web server to serve the app(nginx, apache) | |
#And passenger as the application server | |
if [ -d /some/app/directory ]; then | |
echo "El directorio ya existe" | |
else | |
mkdir tmp | |
fi | |
#Restart the application process | |
touch tmp/restart.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any contributions are welcome 😄