livereload / LiveReload

LiveReload.app for Mac and Windows. See “develop” branch for the latest Windows release and LiveReload 3 progress. (NOTE: renamed from LiveReload2.)
http://livereload.com/
Other
1.43k stars 166 forks source link

LiveReload 3

LiveReload is an essential tool for web developers, and is currently the top paid developer tool on the Mac App Store in many countries.

License

Copyright 2012–2015, Andrey Tarantsov — andrey@tarantsov.com

Purchasing policy notice: All users of the software are expected to purchase a license from Andrey Tarantsov unless they have a good reason not to pay. Users that don't purchase a license are encouraged to apply for a free one at support@livereload.com. The users are free to:

This software is available under the Open Community Indie Software License:

Permission to use, copy, modify, and/or distribute this software for any purpose is hereby granted, free of charge, subject to the following conditions:

In the event that no new official binary releases of the software are published for two consecutive years, the above conditions are permanently waived, and the software is additionally made available under the terms of the MIT license.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Building LiveReload for Windows

Follow windows/README.md.

Building LiveReload for Mac

Note: right now this branch is in a transitional state; I'm doing active development of Mac v3.0.x. See the ‘master’ branch for the latest stable Mac version (v2.3.x).

Prerequisites:

For running tests:

Building:

  1. Don’t forget to pull all submodules after getting the source code.

  2. Install and compile the backend modules:

    cd node_modules/livereload-new     && npm install && grunt &&
    cd ../livereload-service-dummy     && npm install && grunt
    cd ../livereload-service-server    && npm install && grunt
    cd ../livereload-service-reloader  && npm install && grunt
    cd ../livereload-soa               && npm install && grunt
    cd ../livereload-server            && coffee -c lib
    cd ../livereload-protocol          && coffee -c lib
    cd ../pathspec                     && coffee -c lib
  3. Package the backend modules into mac/backend:

    cd scripts && npm install
    cd ..
    scripts/node_modules/.bin/_coffee scripts/package-backend.coffee_ node_modules/livereload-new mac/backend

    During development, use override mode instead — open Xcode scheme settings and set LRBackendOverride env var to the full path of node_modules/livereload-new/bin/livereload.js.

  4. Open LiveReload/LiveReload.xcodeproj

  5. Build some subprojects in the correct order (because the dependencies between subprojects aren't properly tracked — let me know if you know a way to specify those), you can do this from Xcode or on the command line:

    cd mac
    make
  6. Build the app, you can do this from Xcode or on the command line:

    xcodebuild -project LiveReload.xcodeproj -scheme LiveReload -configuration Debug build

Until the project is configured correctly, you may need to clean & rebuild often before running tests. Use mac/rebuild.sh for that.

LR for Mac hacking tips

Running tests

The tests are under mac/LiveReloadTestProjects.

First, build & run LiveReload, open the main window, click the gears icon in title bar, then choose ‘Allow Access to Folder...’ and pick the LiveReloadTestProjects folder.

Then, for a testing configuration, set environment variable LRRunTests to point to the absolute path of LiveReloadTestProjects directory, e.g.

LRRunTests=/Users/andreyvit/dev/livereload/devel/mac/LiveReloadTestProjects

Additionally, you may want to add -LogToConsole YES to the list of launch arguments, so that you can see the entire output when testing.

You may also want to set LRBundledPluginsOverride environment variable, as described above.

git-subdir

We're using git-subdir to sync commits between this repository and the repositories of individual projects.

This probably is of no concern to you, but in case you need it, you can run the following commands to set it up:

git subdir node_modules/livereload/ -r cli --url git@github.com:livereload/livereload-cli.git --method squash,linear
git subdir node_modules/livereload-core/ -r core --url git@github.com:livereload/livereload-core.git --method squash,linear
git subdir node_modules/livereload-server/ -r server --url git@github.com:livereload/livereload-server.git --method squash,linear
git subdir node_modules/livereload-client/ -r client --url git@github.com:livereload/livereload-client.git --method squash,linear
git subdir node_modules/livereload-protocol/ -r protocol --url git@github.com:livereload/livereload-protocol.git --method squash,linear

git subdir node_modules/fsmonitor/ -r fsmonitor --url git@github.com:andreyvit/fsmonitor.js.git --method squash,linear
git subdir node_modules/jobqueue/ -r jobqueue --url git@github.com:livereload/jobqueue.git --method squash,linear
git subdir node_modules/pathspec/ -r pathspec --url git@github.com:andreyvit/pathspec.js.git --method squash,linear
git subdir node_modules/reactive/ -r reactive --url git@github.com:andreyvit/reactive.js.git --method squash,linear

git subdir node_modules/vfs-local/ -r vfs-local --url git@github.com:livereload/vfs-local.git --method squash,linear
git subdir node_modules/vfs-test/ -r vfs-test --url git@github.com:livereload/vfs-test.git --method squash,linear

git-subdir mac/ATPathSpec --url git@github.com:andreyvit/ATPathSpec.git --method squash,linear

Signing the bundled Node.js binary

Copy:

cp /usr/local/bin/node LiveReload/Resources/LiveReloadNodejs

Sign:

codesign -f -s "3rd Party Mac Developer Application: Andrey Tarantsov" --entitlements LiveReload/Resources/LiveReloadNodejs.entitlements LiveReload/Resources/LiveReloadNodejs

Verify:

codesign -dvvv ./LiveReload/Resources/LiveReloadNodejs

AppNewsKit

(See Stats.h/m. This is a seriously cool shit to communicate with your live users. Consider those files to be under MIT. I’ll extract and document it properly soon.)

Example ping.txt:

    {
        "see_explanation_at": "http://help.livereload.com/kb/about-us/usage-statistics-privacy-policy",
        "messages": [
            {
                "title": "MyApp on the Mac App Store!",
                "message": "MyApp 2.1 has been released on the Mac App Store, and is on sale (50% off)! Do you want to learn more about it?",
                "id": "myapp-2.0.0-release",
                "version": [">=2.0 <3.0"],
                "status": ["unregistered"],
                "stats": {
                    "stat.reloads": { "min": 10 }
                },
                "delay_if_nagged_within": "3d",
                "remind_later_in": "5d",
                "deliver_after": "2011-12-08 16:33:00",
                "wait_until_good_time": true,
                "delivery_on_stats": {
                    "or": {
                        "stat.reloads.last": { "within": 30 },
                        "stat.launch.first": { "within": 120 }
                    }
                },
                "random_percentage": 50,
                "primary_button_url": "http://myapp.com/mas/",
                "primary_button_title": "Visit Mac App Store"
            }
        ]
    }