Last active
December 19, 2016 19:56
-
-
Save sandrocarval/b493a48d4be15b5602ab1fe1830954d1 to your computer and use it in GitHub Desktop.
Script para facilitar a mudança de tags/commits nos diretórios das gems quando se dá checkout no branch do projeto principal (Jericó, JIS, JPS)
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
#!/bin/bash | |
# Salve este arquivo no $HOME/bin e adicione o caminho no $PATH | |
REPO_BASE="$HOME/repos" | |
CURRENT_REPO=$(pwd) | |
git checkout $1 | |
for REPO in $(egrep "adtsys-cloud|diegoaltheman" $CURRENT_REPO/Gemfile | awk -F'"' '{print $2}') | |
do | |
CHECKOUT_VALUE=$(grep "$REPO" $CURRENT_REPO/Gemfile | awk -F'"' '{print $6}') | |
echo "$REPO: checking out $CHECKOUT_VALUE" | |
cd $REPO_BASE/$REPO && git checkout $CHECKOUT_VALUE >/dev/null 2>&1 | |
done |
Funciona se a linha no Gemfile estiver em um desses formatos:
gem "gem-interna-123", git: "xpto/gem-interna-123.git", tag: "v0.0.6.9"
gem "gem-interna-234", git: "xpto/gem-interna-234.git", ref: "6669e6d594d34f6e1a2b28352331719685864666"
gem "gem-interna-345", git: "xpto/gem-interna-345.git", branch: "homolog"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exemplo de saída: