Show HN: Sync.js – Upload changed local files to remote server
github.com
github.com
Why do we do this?
I used to code PHP and made a transition to Ruby at some point. After programming Ruby/Rails for a bit I decided to create a rails-like MVC framework for PHP. There are plenty of those in existence. I could have just read the ruby code, which I did a bit, but I wanted to understand a bit better why certain decisions were made.
Doing that little exercise helped out a good bit with that.
After trying to replicate some of rsync's functionality you discover edge cases and other complications you might never have thought about and appreciate all the more how well rsync manages to work for your specific use case and more generally.
while true; do rsync -azP $PWD/ <remote>:$PWD/; sleep 2; done
Or even better: https://code.google.com/p/lsyncd/lsyncd uses inotify/fsevents, meaning you don't have to traverse the filesystem to poll for changes.
Edit: I like the idea - make something you need, not struggle with overly complicated sync algorithms/apps to achieve the simple result.
I manage my changes from my local so I can use any editor I want in the mean time this script uploads all my changes to development server.
I think this is the general use case.
Using this technique you're stuck, because only one person can develop on the same project without interfering with each other. Also, git-hooks are not /that/ hard to use, you should really look into it, as it solves two problems: You have version control and you have easy deployment.
We have development servers for each developer like 'username.dev.myapp.com' so you don't have to install the application on your machine. Most people work on the server using 'ssh: screen/tmux - vi/emacs', but I want to work on my local because it's faster. So I needed a system to upload my changes to my remote box. and commit my changes from local.
Most companies use this technique so that you know how your code will behave on production while developing it, because it has the same exact architecture.
I hope it's more clear now. It's funny that you would think I don't use a version control system :) what year is this.