Offline <code>git push</code> and <code>npm publish</code> for cyberhobos
This module is gifted to cyberhobo extraordinaire, dominictarr.
npm publishwhile you're offline!
npm install -g cyberhobo
cyberhobowill run first.
alias git='cyberhobo git'alias npm='cyberhobo npm'
cyberhobo will detect if you're offline and intercept
git push and
commands, queueing them to run later when you're back online. If you're online or
if you run a non
publish command, then it will run normally.
If you're back in civilization and you have an internet connection, the next time you run
cyberhobo will run all the commands that were queued up
while you were offline. They will run in order.
If any of them fails with a non-zero exit code then
cyberhobo bails, printing out the remaining
commands so you can run them manually. (TODO)
$ touch test.txt$ git add test.txt# oh no! lost internet connection now. keep working...$ git commit -m "wrote some awesome code"[master 4f5f136] wrote some awesome code1 file changed, 0 insertions(+), 0 deletions(-)create mode 100644 test.txt$ git pushCYBER HOBO ACTIVATED! Command saved for later!$ npm publishCYBER HOBO ACTIVATED! Command saved for later!# more commits, pushes, etc., ...# later, we have internet again! Run any git/npm command to push queued commands!$ git status============================================================HEY, YOU HAVE INTERNET NOW!Time to re-run the commands you saved while you were offline================================================================ Running "git push" in /Users/feross/code/cyberhobo ====Counting objects: 3, done.Delta compression using up to 8 threads.Compressing objects: 100% (2/2), done.Writing objects: 100% (2/2), 229 bytes | 0 bytes/s, done.Total 2 (delta 1), reused 0 (delta 0)To firstname.lastname@example.org:feross/cyberhobo.git1174974..4f5f136 master -> master==== Running "npm publish" in /Users/feross/code/cyberhobo ===npm http PUTnpm http 201+ email@example.comCYBER HOBO MISSION COMPLETE: all up to dateOn branch masterYour branch is up-to-date with 'origin/master'.
This may be a horrible idea. I don't know.
MIT. Copyright Feross Aboukhadijeh.