Skip to content

Instantly share code, notes, and snippets.

@roooodcastro
Created July 28, 2016 17:57
Show Gist options
  • Save roooodcastro/a5358bcb8f44e5986fc08bc3a0c2039e to your computer and use it in GitHub Desktop.
Save roooodcastro/a5358bcb8f44e5986fc08bc3a0c2039e to your computer and use it in GitHub Desktop.
Atalhos workspace Ruby on Rails & Git
alias "preparar-deploy"="~/preparar-deploy.sh"
alias gpm='git push origin master'
alias gphlog='git push origin homologacao'
alias gpp='git push origin producao'
alias gphfix='git push origin hotfix'
alias gplm='git pull origin master'
alias gplhlog='git pull origin homologacao'
alias gplp='git pull origin producao'
alias gplhfix='git pull origin hotfix'
alias ghtop='git checkout producao && git merge hotfix && git push origin producao'
alias gits='git status'
alias gitb='git branch'
alias gita='git add .'
#!/bin/bash
version_file="$PWD/config/initializers/version.rb"
while IFS= read -r var
do
regex="VERSAO = '([0-9]*\.[0-9]*\.)([0-9]*)'"
[[ $var =~ $regex ]]
base_version="${BASH_REMATCH[1]}"
patch_version="${BASH_REMATCH[2]}"
if [[ ! -z $patch_version ]]
then
new_version=$(($patch_version + 1))
new_version="${base_version}${new_version}"
echo "Atualizando versão de ${base_version}${patch_version} para ${new_version}"
sed -i -e "s/[0-9]*\.[0-9]*\.[0-9]*/${new_version}/g" $version_file
fi
done < "$version_file"
eval "git add ."
eval "git status"
eval "git commit -m \"por rodrigo.castro: Preparando para deploy\""
eval "git tag -a v${new_version} -m \"${1}\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment