Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@andreyvit
Created February 7, 2013 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreyvit/4729243 to your computer and use it in GitHub Desktop.
Save andreyvit/4729243 to your computer and use it in GitHub Desktop.
LiveReload development instructions. Basically a wiki for LiveReload hackers.

Developing LiveReload on a Mac

Mac directory structure

Under ~/dev/livereload:

app/2_4/cli                 https://github.com/livereload/livereload-cli
modules/protocol            https://github.com/livereload/livereload-protocol
modules/client              https://github.com/livereload/livereload-client
modules/server              https://github.com/livereload/livereload-server
modules/core                https://github.com/livereload/livereload-core
generic/fsmonitor.js        https://github.com/andreyvit/fsmonitor.js
generic/jobqueue            https://github.com/livereload/jobqueue
generic/pathspec.js         https://github.com/andreyvit/pathspec.js
generic/reactive            https://github.com/andreyvit/reactive.js
generic/vfs-local           https://github.com/livereload/vfs-local
generic/vfs-test            https://github.com/livereload/vfs-test

These modules use each other, so you want to npm link them together for development.

Windows folder structure and backend override

Copy ~/dev/livereload from Mac to Windows into C:\Dev\livereload.

Set up the following directory junctions (best way is to use Alt-F6 in FAR Manager):

C:\Dev\livereload\node_modules\livereload-protocol     →        C:\Dev\livereload\modules\protocol
C:\Dev\livereload\node_modules\livereload-client       →        C:\Dev\livereload\modules\client
C:\Dev\livereload\node_modules\livereload-server       →        C:\Dev\livereload\modules\server
C:\Dev\livereload\node_modules\livereload-core         →        C:\Dev\livereload\modules\core
C:\Dev\livereload\node_modules\fsmonitor               →        C:\Dev\livereload\generic\fsmonitor.js
C:\Dev\livereload\node_modules\jobqueue                →        C:\Dev\livereload\generic\jobqueue
C:\Dev\livereload\node_modules\pathspec                →        C:\Dev\livereload\generic\pathspec.js
C:\Dev\livereload\node_modules\reactive                →        C:\Dev\livereload\generic\reactive
C:\Dev\livereload\node_modules\vfs-local               →        C:\Dev\livereload\generic\vfs-local
C:\Dev\livereload\node_modules\vfs-test                →        C:\Dev\livereload\generic\vfs-test

At this point, the backend should run:

cd C:\Dev\livereload\app\2_4\cli
node bin\livereload.js --help
node bin\livereload.js rpc server

Also you should be able to run LiveReload.exe with the following command-line arg:

-LRBackendOverride C:\Dev\livereload\app\2_4\cli

Now you can install Bitvise SSH Server, put your Mac public key in, and make sure you can connect to your VM:

$ ssh andreyvit@10.211.55.6

Add the following into your ~/.ssh/config to make things easier (replacing User and HostName as needed):

Host w8
  User andreyvit
  HostName 10.211.55.6
  ControlPath ~/.ssh/master-%l-%r@%h:%p

Now this should work:

$ ssh w8

Keep the following command running, and it should speed up subsequent ssh w8 a great deal:

# in Terminal 1...
$ ssh -MN w8
# in Terminal 2...
$ ssh w8    # this should work INSTANTLY 

Great! Now make sure you have npm install -g fsmonitor installed on your Mac, and run:

$ cd ~/dev/livereload
$ fsmonitor '-J%' '+*.js' '!/app/*/*' '+/app/*/cli' '!node_modules' '!*.lrplugin' '!.git' '!/support'  scp '%' 'w8:c:/dev/livereload/%'

This will upload any changes to your Windows VM. Check this out by doing:

$ date >~/dev/livereload/ok.js

and then verify that C:\Dev\livereload\ok.js contains the current time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment