Last active
December 10, 2015 06:08
-
-
Save arboleya/4392081 to your computer and use it in GitHub Desktop.
This gist will setup all the serpentem's repos connected, it incluses `fs-util`, `coffee-toaster`, `theoricus` `and `theoricus-demo-app`. Read all the code and comments to be apart everything.
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
# Basic configs | |
USER='serpentem' | |
NPM='sudo npm' | |
# Initializes the repo (cloning, remotes, etc) | |
function clone() | |
{ | |
repo=$1 | |
remotes=$2 | |
npmlink=$3 | |
printf "..... Initializing '$repo' \n\n" | |
sudo rm -rf $repo | |
git clone [email protected]:$USER/$repo.git && cd $repo | |
git submodule update --init && git fetch origin | |
for remote in $remotes; do | |
git remote add $remote git://github.com/$remote/$repo.git | |
done | |
if [ $repo = 'coffee-toaster' ]; then | |
cd build/coffee-toaster && npm install | |
cd ../../ | |
fi | |
[ $npmlink = true ] && $NPM link | |
cd ../ | |
} | |
# Links one repo as a `node_module` of another | |
function link() | |
{ | |
origin=$1 | |
target=$2 | |
printf "\n..... Linking '$origin' inside '$target' \n" | |
cd $target/node_modules && sudo rm -rf $origin | |
ln -s ../../$origin $origin && ls -la && cd ../../ | |
} | |
# Initialize all repos | |
clone 'fs-util' '' true | |
clone 'coffee-toaster' 'hems giuliandrimba bolster G3z' true | |
clone 'theoricus' 'hems giuliandrimba' true | |
clone 'theoricus-demo-app' 'hems giuliandrimba' false | |
# Linking FsUtil inside Toaster | |
link 'fs-util' 'coffee-toaster' | |
# Linking Toaster inside Theoricus | |
link 'coffee-toaster' 'theoricus' | |
printf "\n\n\nHappy coding. :)\n\n\n" | |
############################## | |
# FINAL NOTES | |
############################## | |
# Everytime you run `npm install` inside CoffeeToaster, the FsUtil symlink will | |
# most likely be overrided, the same applies to the CoffeeToaster symlink inside | |
# Theoricus. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment