├── src ├── .nuget │ ├── nuget.exe │ └── NuGet.Config ├── lib │ ├── Nancy │ │ ├── Nancy.dll │ │ └── Nancy.pdb │ ├── ZipSharp │ │ └── ICSharpCode.SharpZipLib.dll │ └── Nancy.Bootstarappers.Ninject │ │ ├── Nancy.Bootstrappers.Ninject.dll │ │ └── Nancy.Bootstrappers.Ninject.pdb ├── Candidate.Nancy.Selfhosted │ ├── Raven.Studio.xap │ ├── Client │ │ ├── content │ │ │ ├── images │ │ │ │ ├── glyphicons-halflings.png │ │ │ │ └── glyphicons-halflings-white.png │ │ │ ├── style.css │ │ │ └── spacing.css │ │ ├── scripts │ │ │ ├── templates │ │ │ │ ├── dashboard │ │ │ │ │ ├── topButtons.html │ │ │ │ │ ├── sitesList.html │ │ │ │ │ ├── site.html │ │ │ │ │ └── addNewSiteModalView.html │ │ │ │ └── configure │ │ │ │ │ └── mainMenu.html │ │ │ ├── components │ │ │ │ └── Mediator.js │ │ │ ├── models │ │ │ │ ├── sites.js │ │ │ │ └── Site.js │ │ │ ├── views │ │ │ │ ├── configure │ │ │ │ │ ├── subviews │ │ │ │ │ │ ├── HistoryView.js │ │ │ │ │ │ ├── OverviewView.js │ │ │ │ │ │ ├── DeploymentsView.js │ │ │ │ │ │ ├── ConfigurationView.js │ │ │ │ │ │ ├── MainMenuView.js │ │ │ │ │ │ └── ContentView.js │ │ │ │ │ └── MainView.js │ │ │ │ └── dashboard │ │ │ │ │ ├── subviews │ │ │ │ │ ├── SiteRowView.js │ │ │ │ │ ├── TopButtonsView.js │ │ │ │ │ ├── SitesListView.js │ │ │ │ │ └── AddNewSiteModalView.js │ │ │ │ │ └── MainView.js │ │ │ ├── viewManager.js │ │ │ ├── apps │ │ │ │ ├── DashboardApp.js │ │ │ │ └── ConfigureApp.js │ │ │ ├── applicationRouter.js │ │ │ ├── main.js │ │ │ ├── shared │ │ │ │ └── BaseView.js │ │ │ └── libs │ │ │ │ └── domReady.js │ │ └── views │ │ │ ├── account │ │ │ └── Login.cshtml │ │ │ └── master.html │ ├── App │ │ ├── Installer.cs │ │ ├── Modules │ │ │ ├── InstallModule.cs │ │ │ ├── HomeModule.cs │ │ │ ├── Api │ │ │ │ ├── SitesModule.cs │ │ │ │ └── SiteModule.cs │ │ │ └── AccountModule.cs │ │ ├── PathProvider.cs │ │ ├── UserMapper.cs │ │ └── Infrastructure │ │ │ └── Serializers │ │ │ └── JsonNetSerializer.cs │ ├── web.config │ ├── app.config │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── app.manifest │ ├── packages.config │ └── Require.JS - LICENSE.txt ├── Candidate.Core │ ├── Model │ │ └── Site.cs │ ├── Settings │ │ └── ApplicationDirectories.cs │ ├── Logger │ │ └── Logger.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Setup │ │ └── ApplicationDirectories.cs │ └── Candidate.Core.csproj └── Candidate.sln ├── livereload.cmd ├── tools └── livereload │ ├── node_modules │ └── livereload │ │ ├── node_modules │ │ └── websocket.io │ │ │ ├── .npmignore │ │ │ ├── node_modules │ │ │ ├── debug │ │ │ │ ├── head.js │ │ │ │ ├── tail.js │ │ │ │ ├── .npmignore │ │ │ │ ├── index.js │ │ │ │ ├── Makefile │ │ │ │ ├── example │ │ │ │ │ ├── wildcards.js │ │ │ │ │ ├── app.js │ │ │ │ │ ├── worker.js │ │ │ │ │ └── browser.html │ │ │ │ ├── package.json │ │ │ │ ├── History.md │ │ │ │ ├── debug.js │ │ │ │ ├── debug.component.js │ │ │ │ └── lib │ │ │ │ │ └── debug.js │ │ │ ├── ws │ │ │ │ ├── examples │ │ │ │ │ ├── fileapi │ │ │ │ │ │ ├── .npmignore │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── public │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ ├── app.js │ │ │ │ │ │ │ └── uploader.js │ │ │ │ │ │ └── server.js │ │ │ │ │ ├── serverstats │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── server.js │ │ │ │ │ │ └── public │ │ │ │ │ │ │ └── index.html │ │ │ │ │ └── serverstats-express_3 │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ ├── server.js │ │ │ │ │ │ └── public │ │ │ │ │ │ └── index.html │ │ │ │ ├── node_modules │ │ │ │ │ ├── commander │ │ │ │ │ │ ├── .npmignore │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ ├── .travis.yml │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── History.md │ │ │ │ │ ├── options │ │ │ │ │ │ ├── test │ │ │ │ │ │ │ └── fixtures │ │ │ │ │ │ │ │ └── test.conf │ │ │ │ │ │ ├── .npmignore │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── lib │ │ │ │ │ │ │ └── options.js │ │ │ │ │ └── tinycolor │ │ │ │ │ │ ├── .npmignore │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── example.js │ │ │ │ │ │ ├── package.json │ │ │ │ │ │ └── tinycolor.js │ │ │ │ ├── .npmignore │ │ │ │ ├── .travis.yml │ │ │ │ ├── build │ │ │ │ │ ├── Release │ │ │ │ │ │ ├── bufferutil.exp │ │ │ │ │ │ ├── bufferutil.lib │ │ │ │ │ │ ├── bufferutil.node │ │ │ │ │ │ ├── bufferutil.pdb │ │ │ │ │ │ ├── validation.exp │ │ │ │ │ │ ├── validation.lib │ │ │ │ │ │ ├── validation.node │ │ │ │ │ │ └── validation.pdb │ │ │ │ │ ├── config.gypi │ │ │ │ │ ├── bufferutil.vcxproj.filters │ │ │ │ │ ├── validation.vcxproj.filters │ │ │ │ │ └── binding.sln │ │ │ │ ├── lib │ │ │ │ │ ├── Validation.fallback.js │ │ │ │ │ ├── BufferUtil.js │ │ │ │ │ ├── Validation.js │ │ │ │ │ ├── ErrorCodes.js │ │ │ │ │ ├── BufferUtil.fallback.js │ │ │ │ │ ├── BufferPool.js │ │ │ │ │ ├── Sender.hixie.js │ │ │ │ │ └── Receiver.hixie.js │ │ │ │ ├── binding.gyp │ │ │ │ ├── index.js │ │ │ │ ├── test │ │ │ │ │ ├── fixtures │ │ │ │ │ │ ├── request.pem │ │ │ │ │ │ ├── certificate.pem │ │ │ │ │ │ ├── key.pem │ │ │ │ │ │ └── textfile │ │ │ │ │ ├── Sender.test.js │ │ │ │ │ ├── autobahn-server.js │ │ │ │ │ ├── WebSocket.integration.js │ │ │ │ │ ├── autobahn.js │ │ │ │ │ ├── Validation.test.js │ │ │ │ │ ├── BufferPool.test.js │ │ │ │ │ ├── hybi-common.js │ │ │ │ │ ├── Receiver.hixie.test.js │ │ │ │ │ └── Sender.hixie.test.js │ │ │ │ ├── Makefile │ │ │ │ ├── package.json │ │ │ │ ├── install.js │ │ │ │ ├── bench │ │ │ │ │ ├── sender.benchmark.js │ │ │ │ │ ├── util.js │ │ │ │ │ ├── speed.js │ │ │ │ │ └── parser.benchmark.js │ │ │ │ └── src │ │ │ │ │ └── bufferutil.cc │ │ │ └── .bin │ │ │ │ ├── wscat.cmd │ │ │ │ └── wscat │ │ │ ├── index.js │ │ │ ├── .travis.yml │ │ │ ├── lib │ │ │ ├── protocols │ │ │ │ ├── index.js │ │ │ │ └── hybi.js │ │ │ ├── util.js │ │ │ ├── websocket.io.js │ │ │ ├── socket.js │ │ │ └── server.js │ │ │ ├── Makefile │ │ │ ├── test │ │ │ ├── common.js │ │ │ └── websocket.io.js │ │ │ ├── examples │ │ │ └── echo │ │ │ │ └── server.js │ │ │ ├── package.json │ │ │ └── History.md │ │ ├── Cakefile │ │ ├── package.json │ │ ├── LICENSE │ │ ├── README.md │ │ └── livereload.coffee │ └── server.js ├── .gitignore └── README.md /src/.nuget/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/.nuget/nuget.exe -------------------------------------------------------------------------------- /livereload.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | node ./tools/livereload/server.js ./src/Candidate.Nancy.Selfhosted/Client/ -------------------------------------------------------------------------------- /src/lib/Nancy/Nancy.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/lib/Nancy/Nancy.dll -------------------------------------------------------------------------------- /src/lib/Nancy/Nancy.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/lib/Nancy/Nancy.pdb -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | node_modules 3 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/head.js: -------------------------------------------------------------------------------- 1 | ;(function(){ 2 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/fileapi/.npmignore: -------------------------------------------------------------------------------- 1 | uploaded 2 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/websocket.io'); 2 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | - 0.8 5 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/tail.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = debug; 3 | 4 | })(); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | *.sock 5 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = require('./lib/debug'); -------------------------------------------------------------------------------- /src/lib/ZipSharp/ICSharpCode.SharpZipLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/lib/ZipSharp/ICSharpCode.SharpZipLib.dll -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Raven.Studio.xap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/Candidate.Nancy.Selfhosted/Raven.Studio.xap -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/commander/.npmignore: -------------------------------------------------------------------------------- 1 | support 2 | test 3 | examples 4 | *.sock 5 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/commander/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = require('./lib/commander'); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build 6 | 7 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/Makefile: -------------------------------------------------------------------------------- 1 | 2 | debug.component.js: head.js debug.js tail.js 3 | cat $^ > $@ 4 | 5 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/options/test/fixtures/test.conf: -------------------------------------------------------------------------------- 1 | { 2 | "a": "foobar", 3 | "b": false 4 | } -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/commander/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.4 4 | - 0.6 5 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | npm_args: --ws:native 3 | node_js: 4 | - 0.6 5 | - 0.7 6 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/options/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build/ 6 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/tinycolor/.npmignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | node_modules 3 | .*.swp 4 | .lock-* 5 | build/ 6 | -------------------------------------------------------------------------------- /src/lib/Nancy.Bootstarappers.Ninject/Nancy.Bootstrappers.Ninject.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/lib/Nancy.Bootstarappers.Ninject/Nancy.Bootstrappers.Ninject.dll -------------------------------------------------------------------------------- /src/lib/Nancy.Bootstarappers.Ninject/Nancy.Bootstrappers.Ninject.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/lib/Nancy.Bootstarappers.Ninject/Nancy.Bootstrappers.Ninject.pdb -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/options/README.md: -------------------------------------------------------------------------------- 1 | # options.js # 2 | 3 | A very light-weight in-code option parsers for node.js. 4 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/tinycolor/README.md: -------------------------------------------------------------------------------- 1 | # tinycolor # 2 | 3 | This is a no-fuzz, barebone, zero muppetry color module for node.js. -------------------------------------------------------------------------------- /src/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/content/images/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/Candidate.Nancy.Selfhosted/Client/content/images/glyphicons-halflings.png -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/templates/dashboard/topButtons.html: -------------------------------------------------------------------------------- 1 |
2 | Add site 3 |
4 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/commander/Makefile: -------------------------------------------------------------------------------- 1 | 2 | TESTS = $(shell find test/test.*.js) 3 | 4 | test: 5 | @./test/run $(TESTS) 6 | 7 | .PHONY: test -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/views/account/Login.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/content/images/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/src/Candidate.Nancy.Selfhosted/Client/content/images/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Installer.cs: -------------------------------------------------------------------------------- 1 | namespace Candidate.Nancy.Selfhosted.App 2 | { 3 | public class Installer 4 | { 5 | public bool Check() 6 | { 7 | return true; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/components/Mediator.js: -------------------------------------------------------------------------------- 1 | define(function (require) { 2 | 3 | var Mediator = function () { 4 | 5 | }; 6 | 7 | _.extend(Mediator.prototype, Backbone.Events); 8 | 9 | return Mediator; 10 | 11 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.exp -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.lib -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.node -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/bufferutil.pdb -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.exp -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.lib -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.node: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.node -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexbeletsky/candidate/HEAD/tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/Release/validation.pdb -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/tinycolor/example.js: -------------------------------------------------------------------------------- 1 | require('./tinycolor'); 2 | console.log('this should be red and have an underline!'.grey.underline); 3 | console.log('this should have a blue background!'.bgBlue); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/.bin/wscat.cmd: -------------------------------------------------------------------------------- 1 | :: Created by npm, please don't edit manually. 2 | @IF EXIST "%~dp0\node.exe" ( 3 | "%~dp0\node.exe" "%~dp0\..\ws\bin\wscat" %* 4 | ) ELSE ( 5 | node "%~dp0\..\ws\bin\wscat" %* 6 | ) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Oo]bj/ 2 | [Bb]in/ 3 | *.user 4 | /TestResults 5 | *.vspscc 6 | *.vssscc 7 | deploy 8 | deploy/* 9 | *.suo 10 | *.cache 11 | packages/ 12 | msbuild.log 13 | artifacts/log 14 | artifacts/ 15 | post-build* 16 | _ReSharper.* 17 | *deploy-to-ec2* 18 | *ncrunch* -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/Cakefile: -------------------------------------------------------------------------------- 1 | {print} = require 'util' 2 | {spawn} = require 'child_process' 3 | 4 | task 'build', 'Build CoffeeScript source files', -> 5 | coffee = spawn 'coffee', ['-cw', 'livereload.coffee'] 6 | coffee.stdout.on 'data', (data) -> print data.toString() 7 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/models/sites.js: -------------------------------------------------------------------------------- 1 | define(['./Site'], 2 | function (Site) { 3 | 4 | var SitesCollection = Backbone.Collection.extend({ 5 | url: '/api/sites', 6 | 7 | model: Site 8 | }); 9 | 10 | return SitesCollection; 11 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/lib/protocols/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Export websocket protocols. 4 | */ 5 | 6 | module.exports = { 7 | drafts: require('./drafts') 8 | , 7: require('./hybi') 9 | , 8: require('./hybi') 10 | , 13: require('./hybi') 11 | }; 12 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/example/wildcards.js: -------------------------------------------------------------------------------- 1 | 2 | var debug = { 3 | foo: require('../')('test:foo'), 4 | bar: require('../')('test:bar'), 5 | baz: require('../')('test:baz') 6 | }; 7 | 8 | debug.foo('foo') 9 | debug.bar('bar') 10 | debug.baz('baz') -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/Makefile: -------------------------------------------------------------------------------- 1 | 2 | TESTS = test/*.js 3 | REPORTER = dot 4 | 5 | test: 6 | @./node_modules/.bin/mocha \ 7 | --require should \ 8 | --require test/common.js \ 9 | --reporter $(REPORTER) \ 10 | --growl \ 11 | $(TESTS) 12 | 13 | .PHONY: test bench 14 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/.bin/wscat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -x "`dirname "$0"`/node" ]; then 3 | "`dirname "$0"`/node" "`dirname "$0"`/../ws/bin/wscat" "$@" 4 | ret=$? 5 | else 6 | node "`dirname "$0"`/../ws/bin/wscat" "$@" 7 | ret=$? 8 | fi 9 | exit $ret 10 | -------------------------------------------------------------------------------- /tools/livereload/server.js: -------------------------------------------------------------------------------- 1 | var argv = process.argv; 2 | var dirname = argv[2]; 3 | 4 | if (!dirname) { 5 | console.log('usage: server.js dirname'); 6 | return; 7 | } 8 | 9 | var livereload = require('livereload'); 10 | var server = livereload.createServer({ 11 | debug: true, 12 | ext: 'tmpl' 13 | }); 14 | 15 | server.watch(dirname); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Modules/InstallModule.cs: -------------------------------------------------------------------------------- 1 | using Nancy; 2 | 3 | namespace Candidate.Nancy.Selfhosted.App.Modules 4 | { 5 | public class InstallModule : NancyModule 6 | { 7 | public InstallModule() : base("/install") 8 | { 9 | Get["/"] = p => "Install"; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/Validation.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports.Validation = { 8 | isValidUTF8: function(buffer) { 9 | return true; 10 | } 11 | }; 12 | 13 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/options/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | 3 | run-tests: 4 | @./node_modules/.bin/mocha \ 5 | -t 2000 \ 6 | $(TESTFLAGS) \ 7 | $(TESTS) 8 | 9 | test: 10 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 11 | 12 | .PHONY: test 13 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/test/common.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Require should. 4 | */ 5 | 6 | should = require('should'); 7 | 8 | /** 9 | * Require parser utilities. 10 | */ 11 | 12 | require('../support/parser-common'); 13 | 14 | /** 15 | * Require server utilities. 16 | */ 17 | 18 | require('../support/server-common'); 19 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Modules/HomeModule.cs: -------------------------------------------------------------------------------- 1 | using Nancy; 2 | 3 | namespace Candidate.Nancy.Selfhosted.App.Modules 4 | { 5 | public class HomeModule : NancyModule 6 | { 7 | public HomeModule() : base("/") 8 | { 9 | //this.RequiresAuthentication(); 10 | 11 | Get["/(.*)"] = o => View["Master"]; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/subviews/HistoryView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView'], 2 | function (BaseView) { 3 | 4 | var HistoryView = BaseView.extend({ 5 | 6 | template: function () { 7 | return '

History

Overview information is here

'; 8 | } 9 | 10 | }); 11 | 12 | return HistoryView; 13 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/subviews/OverviewView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView'], 2 | function (BaseView) { 3 | 4 | var OverviewView = BaseView.extend({ 5 | 6 | template: function () { 7 | return '

Overview

Overview information is here

'; 8 | } 9 | 10 | }); 11 | 12 | return OverviewView; 13 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | 'targets': [ 3 | { 4 | 'target_name': 'validation', 5 | 'cflags': [ '-O3' ], 6 | 'sources': [ 'src/validation.cc' ] 7 | }, 8 | { 9 | 'target_name': 'bufferutil', 10 | 'cflags': [ '-O3' ], 11 | 'sources': [ 'src/bufferutil.cc' ] 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/PathProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Nancy; 4 | 5 | namespace Candidate.Nancy.Selfhosted.App 6 | { 7 | public class PathProvider : IRootPathProvider 8 | { 9 | public string GetRootPath() 10 | { 11 | return Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\")); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/subviews/DeploymentsView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView'], 2 | function (BaseView) { 3 | 4 | var DeploymentsView = BaseView.extend({ 5 | 6 | template: function () { 7 | return '

Deployments

Overview information is here

'; 8 | } 9 | 10 | }); 11 | 12 | return DeploymentsView; 13 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/subviews/ConfigurationView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView'], 2 | function (BaseView) { 3 | 4 | var ConfigurationView = BaseView.extend({ 5 | 6 | template: function () { 7 | return '

Configuration

Overview information is here

'; 8 | } 9 | 10 | }); 11 | 12 | return ConfigurationView; 13 | 14 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/index.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports = require('./lib/WebSocket'); 8 | module.exports.Server = require('./lib/WebSocketServer'); 9 | module.exports.Sender = require('./lib/Sender'); 10 | module.exports.Receiver = require('./lib/Receiver'); 11 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/UserMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Nancy; 3 | using Nancy.Authentication.Forms; 4 | using Nancy.Security; 5 | 6 | namespace Candidate.Nancy.Selfhosted.App 7 | { 8 | public class UserMapper : IUserMapper 9 | { 10 | public IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context) 11 | { 12 | throw new NotImplementedException(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/serverstats/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "", 3 | "name": "serverstats", 4 | "version": "0.0.0", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/einaros/ws.git" 8 | }, 9 | "engines": { 10 | "node": ">0.4.0" 11 | }, 12 | "dependencies": { 13 | "express": "2.x" 14 | }, 15 | "devDependencies": {}, 16 | "optionalDependencies": {} 17 | } 18 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/serverstats-express_3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "", 3 | "name": "serverstats", 4 | "version": "0.0.0", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/einaros/ws.git" 8 | }, 9 | "engines": { 10 | "node": ">0.4.0" 11 | }, 12 | "dependencies": { 13 | "express": "~3.0.0" 14 | }, 15 | "devDependencies": {}, 16 | "optionalDependencies": {} 17 | } 18 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/example/app.js: -------------------------------------------------------------------------------- 1 | 2 | var debug = require('../')('http') 3 | , http = require('http') 4 | , name = 'My App'; 5 | 6 | // fake app 7 | 8 | debug('booting %s', name); 9 | 10 | http.createServer(function(req, res){ 11 | debug(req.method + ' ' + req.url); 12 | res.end('hello\n'); 13 | }).listen(3000, function(){ 14 | debug('listening'); 15 | }); 16 | 17 | // fake worker of some kind 18 | 19 | require('./worker'); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/config.gypi: -------------------------------------------------------------------------------- 1 | # Do not edit. File was generated by node-gyp's "configure" step 2 | { 3 | "target_defaults": { 4 | "cflags": [], 5 | "defines": [], 6 | "include_dirs": [], 7 | "libraries": [], 8 | "default_configuration": "Release" 9 | }, 10 | "variables": { 11 | "target_arch": "ia32", 12 | "nodedir": "C:\\Users\\alexander.beletsky\\.node-gyp\\0.6.17", 13 | "copy_dev_lib": "true" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/fileapi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "", 3 | "name": "fileapi", 4 | "version": "0.0.0", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/einaros/ws.git" 8 | }, 9 | "engines": { 10 | "node": "~0.6.8" 11 | }, 12 | "dependencies": { 13 | "express": "latest", 14 | "ansi": "https://github.com/einaros/ansi.js/tarball/master" 15 | }, 16 | "devDependencies": {}, 17 | "optionalDependencies": {} 18 | } 19 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/viewManager.js: -------------------------------------------------------------------------------- 1 | define(function () { 2 | 3 | var ViewManager = function () { 4 | return { 5 | show: _showView 6 | }; 7 | }; 8 | 9 | function _showView(view) { 10 | if (this.currentView) { 11 | this.currentView.close(); 12 | } 13 | 14 | this.currentView = view; 15 | this.currentView.render(); 16 | 17 | $("#app").html(this.currentView.el); 18 | } 19 | 20 | return ViewManager; 21 | 22 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/templates/dashboard/sitesList.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 |
11 |
-------------------------------------------------------------------------------- /src/Candidate.Core/Model/Site.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Candidate.Core.Model 8 | { 9 | public class Site 10 | { 11 | public string Id { get; set; } 12 | 13 | [Required] 14 | public string Name { get; set; } 15 | 16 | public string Description { get; set; } 17 | public string Status { get; set; } 18 | public DateTime Created { get; set; } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/BufferUtil.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | try { 8 | module.exports = require('../build/Release/bufferutil'); 9 | } catch (e) { try { 10 | module.exports = require('../build/default/bufferutil'); 11 | } catch (e) { try { 12 | module.exports = require('./BufferUtil.fallback'); 13 | } catch (e) { 14 | console.error('bufferutil.node seems to not have been built. Run npm install.'); 15 | throw e; 16 | }}} 17 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/Validation.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | try { 8 | module.exports = require('../build/Release/validation'); 9 | } catch (e) { try { 10 | module.exports = require('../build/default/validation'); 11 | } catch (e) { try { 12 | module.exports = require('./Validation.fallback'); 13 | } catch (e) { 14 | console.error('validation.node seems to not have been built. Run npm install.'); 15 | throw e; 16 | }}} 17 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/example/worker.js: -------------------------------------------------------------------------------- 1 | 2 | // DEBUG=* node example/worker 3 | // DEBUG=worker:* node example/worker 4 | // DEBUG=worker:a node example/worker 5 | // DEBUG=worker:b node example/worker 6 | 7 | var a = require('../')('worker:a') 8 | , b = require('../')('worker:b'); 9 | 10 | function work() { 11 | a('doing lots of uninteresting work'); 12 | setTimeout(work, Math.random() * 1000); 13 | } 14 | 15 | work(); 16 | 17 | function workb() { 18 | b('doing some work'); 19 | setTimeout(workb, Math.random() * 2000); 20 | } 21 | 22 | workb(); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/bufferutil.vcxproj.filters: -------------------------------------------------------------------------------- 1 | {739DB09A-CC57-A953-A6CF-F64FA08E4FA7}{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}....\src -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/validation.vcxproj.filters: -------------------------------------------------------------------------------- 1 | {739DB09A-CC57-A953-A6CF-F64FA08E4FA7}{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}....\src -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/templates/dashboard/site.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | {{name}} 4 | {{status}} 5 | 6 | 7 | 8 |
9 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/example/browser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | debug() 4 | 5 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/templates/configure/mainMenu.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/models/Site.js: -------------------------------------------------------------------------------- 1 | define(function () { 2 | 3 | var Site = Backbone.Model.extend({ 4 | urlRoot: '/api/site', 5 | 6 | defaults: { 7 | 'name': null, 8 | 'status': null, 9 | 'description': null 10 | }, 11 | 12 | validate: function (attributes) { 13 | attributes = attributes || this.attributes; 14 | 15 | var name = attributes.name; 16 | if (!_.isString(name) || name.length <= 0) { 17 | return { field: 'name', message: 'Site name is required field' }; 18 | } 19 | } 20 | 21 | }); 22 | 23 | return Site; 24 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/apps/DashboardApp.js: -------------------------------------------------------------------------------- 1 | define(['../views/dashboard/MainView', '../models/Sites'], 2 | function (MainView, Sites) { 3 | 4 | // boostsrapper 5 | var bootstrap = function (callback) { 6 | var sites = new Sites(); 7 | sites.fetch({ success: function () { 8 | callback(sites); 9 | }}); 10 | }; 11 | 12 | var DashboardApp = { 13 | run: function (viewManager) { 14 | bootstrap(function (sites) { 15 | var view = new MainView({ collection: sites }); 16 | viewManager.show(view); 17 | }); 18 | } 19 | }; 20 | 21 | return DashboardApp; 22 | 23 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/fixtures/request.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIBhDCB7gIBADBFMQswCQYDVQQGEwJubzETMBEGA1UECAwKU29tZS1TdGF0ZTEh 3 | MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB 4 | AQUAA4GNADCBiQKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEC 5 | hrR/3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0W 6 | ZxXgf72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwID 7 | AQABoAAwDQYJKoZIhvcNAQEFBQADgYEAjsUXEARgfxZNkMjuUcudgU2w4JXS0gGI 8 | JQ0U1LmU0vMDSKwqndMlvCbKzEgPbJnGJDI8D4MeINCJHa5Ceyb8c+jaJYUcCabl 9 | lQW5Psn3+eWp8ncKlIycDRj1Qk615XuXtV0fhkrgQM2ZCm9LaQ1O1Gd/CzLihLjF 10 | W0MmgMKMMRk= 11 | -----END CERTIFICATE REQUEST----- 12 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/serverstats/server.js: -------------------------------------------------------------------------------- 1 | var WebSocketServer = require('../../').Server 2 | , http = require('http') 3 | , express = require('express') 4 | , app = express.createServer(); 5 | 6 | app.use(express.static(__dirname + '/public')); 7 | app.listen(8080); 8 | 9 | var wss = new WebSocketServer({server: app}); 10 | wss.on('connection', function(ws) { 11 | var id = setInterval(function() { 12 | ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ }); 13 | }, 100); 14 | console.log('started client interval'); 15 | ws.on('close', function() { 16 | console.log('stopping client interval'); 17 | clearInterval(id); 18 | }) 19 | }); 20 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/fileapi/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 |

This example will upload an entire directory tree to the node.js server via a fast and persistent WebSocket connection.

17 |

Note that the example is Chrome only for now.

18 |

19 | Upload status: 20 |
Please select a directory to upload.
21 | 22 | 23 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/serverstats-express_3/server.js: -------------------------------------------------------------------------------- 1 | var WebSocketServer = require('../../').Server 2 | , http = require('http') 3 | , express = require('express') 4 | , app = express(); 5 | 6 | app.use(express.static(__dirname + '/public')); 7 | 8 | var server = http.createServer(app); 9 | server.listen(8080); 10 | 11 | var wss = new WebSocketServer({server: server}); 12 | wss.on('connection', function(ws) { 13 | var id = setInterval(function() { 14 | ws.send(JSON.stringify(process.memoryUsage()), function() { /* ignore errors */ }); 15 | }, 100); 16 | console.log('started client interval'); 17 | ws.on('close', function() { 18 | console.log('stopping client interval'); 19 | clearInterval(id); 20 | }) 21 | }); 22 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/apps/ConfigureApp.js: -------------------------------------------------------------------------------- 1 | define(['../views/configure/MainView', '../models/Site'], 2 | function (MainView, Site) { 3 | 4 | // bootsrapper 5 | var bootsrapper = function (id, callback) { 6 | var site = new Site({ id: id}); 7 | site.fetch({ 8 | success: function() { 9 | callback(site); 10 | } 11 | }); 12 | }; 13 | 14 | var ConfigureApp = { 15 | run: function (context, viewManager) { 16 | bootsrapper(context.id, function (site) { 17 | var view = new MainView({ model: site, id: context.id, section: context.section || 'overview' }); 18 | viewManager.show(view); 19 | }); 20 | } 21 | }; 22 | 23 | return ConfigureApp; 24 | 25 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/tinycolor/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Einar Otto Stangvik", 4 | "email": "einaros@gmail.com", 5 | "url": "http://2x.io" 6 | }, 7 | "name": "tinycolor", 8 | "description": "a to-the-point color module for node", 9 | "version": "0.0.1", 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/einaros/tinycolor.git" 13 | }, 14 | "engines": { 15 | "node": ">=0.4.0" 16 | }, 17 | "dependencies": {}, 18 | "devDependencies": {}, 19 | "main": "tinycolor", 20 | "_id": "tinycolor@0.0.1", 21 | "optionalDependencies": {}, 22 | "_engineSupported": true, 23 | "_npmVersion": "1.1.24", 24 | "_nodeVersion": "v0.6.17", 25 | "_defaultsLoaded": true, 26 | "_from": "tinycolor@0.x" 27 | } 28 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/subviews/MainMenuView.js: -------------------------------------------------------------------------------- 1 | define(['Hogan', '../../../shared/BaseView', 'text!/scripts/templates/configure/mainMenu.html'], 2 | function (Hogan, BaseView, template) { 3 | 4 | var MainMenuView = BaseView.extend({ 5 | className: 'span3', 6 | 7 | initialize: function (options) { 8 | if (!(options && options.id)) { 9 | throw 'Configure.MainMenu: id is required'; 10 | } 11 | 12 | this.id = options.id; 13 | }, 14 | 15 | template: function (context) { 16 | return Hogan.compile(template).render(context); 17 | }, 18 | 19 | templateContext: function () { 20 | return { id: this.id }; 21 | } 22 | 23 | }); 24 | 25 | return MainMenuView; 26 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "debug", 3 | "version": "0.7.0", 4 | "description": "small debugging utility", 5 | "keywords": [ 6 | "debug", 7 | "log", 8 | "debugger" 9 | ], 10 | "author": { 11 | "name": "TJ Holowaychuk", 12 | "email": "tj@vision-media.ca" 13 | }, 14 | "dependencies": {}, 15 | "devDependencies": { 16 | "mocha": "*" 17 | }, 18 | "main": "index", 19 | "browserify": "debug.component.js", 20 | "engines": { 21 | "node": "*" 22 | }, 23 | "component": { 24 | "scripts": { 25 | "debug": "debug.component.js" 26 | } 27 | }, 28 | "_id": "debug@0.7.0", 29 | "optionalDependencies": {}, 30 | "_engineSupported": true, 31 | "_npmVersion": "1.1.24", 32 | "_nodeVersion": "v0.6.17", 33 | "_defaultsLoaded": true, 34 | "_from": "debug@*" 35 | } 36 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/ErrorCodes.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports = { 8 | isValidErrorCode: function(code) { 9 | return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || 10 | (code >= 3000 && code <= 4999); 11 | }, 12 | 1000: 'normal', 13 | 1001: 'going away', 14 | 1002: 'protocol error', 15 | 1003: 'unsupported data', 16 | 1004: 'reserved', 17 | 1005: 'reserved for extensions', 18 | 1006: 'reserved for extensions', 19 | 1007: 'inconsistent or invalid data', 20 | 1008: 'policy violation', 21 | 1009: 'message too big', 22 | 1010: 'extension handshake missing', 23 | 1011: 'an unexpected condition prevented the request from being fulfilled', 24 | }; -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/fixtures/certificate.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICATCCAWoCCQDPufXH86n2QzANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJu 3 | bzETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 4 | cyBQdHkgTHRkMB4XDTEyMDEwMTE0NDQwMFoXDTIwMDMxOTE0NDQwMFowRTELMAkG 5 | A1UEBhMCbm8xEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0 6 | IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtrQ7 7 | +r//2iV/B6F+4boH0XqFn7alcV9lpjvAmwRXNKnxAoa0f97AjYPGNLKrjpkNXXhB 8 | JROIdbRbZnCNeC5fzX1a+JCo7KStzBXuGSZr27TtFmcV4H+9gIRIcNHtZmJLnxbJ 9 | sIhkGR8yVYdmJZe4eT5ldk1zoB1adgPF1hZhCBMCAwEAATANBgkqhkiG9w0BAQUF 10 | AAOBgQCeWBEHYJ4mCB5McwSSUox0T+/mJ4W48L/ZUE4LtRhHasU9hiW92xZkTa7E 11 | QLcoJKQiWfiLX2ysAro0NX4+V8iqLziMqvswnPzz5nezaOLE/9U/QvH3l8qqNkXu 12 | rNbsW1h/IO6FV8avWFYVFoutUwOaZ809k7iMh2F2JMgXQ5EymQ== 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/dashboard/subviews/SiteRowView.js: -------------------------------------------------------------------------------- 1 | define(['Hogan', '../../../shared/BaseView', 'text!/scripts/templates/dashboard/site.html'], 2 | function (Hogan, BaseView, template) { 3 | 4 | var SiteRowView = BaseView.extend({ 5 | initialize: function () { 6 | _.bindAll(this); 7 | }, 8 | 9 | events: { 10 | 'click span.delete a': 'onDelete' 11 | }, 12 | 13 | template: function (context) { 14 | return Hogan.compile(template).render(context); 15 | }, 16 | 17 | templateContext: function () { 18 | return this.model.toJSON(); 19 | }, 20 | 21 | onDelete: function(e) { 22 | e.preventDefault(); 23 | 24 | this.model.destroy(); 25 | } 26 | 27 | }); 28 | 29 | return SiteRowView; 30 | 31 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/Sender.test.js: -------------------------------------------------------------------------------- 1 | var Sender = require('../lib/Sender'); 2 | require('should'); 3 | 4 | describe('Sender', function() { 5 | describe('#frameAndSend', function() { 6 | it('does not modify a masked binary buffer', function() { 7 | var sender = new Sender({ write: function() {} }); 8 | var buf = new Buffer([1, 2, 3, 4, 5]); 9 | sender.frameAndSend(2, buf, true, true); 10 | buf[0].should.eql(1); 11 | buf[1].should.eql(2); 12 | buf[2].should.eql(3); 13 | buf[3].should.eql(4); 14 | buf[4].should.eql(5); 15 | }); 16 | 17 | it('does not modify a masked text buffer', function() { 18 | var sender = new Sender({ write: function() {} }); 19 | var text = 'hi there'; 20 | sender.frameAndSend(1, text, true, true); 21 | text.should.eql('hi there'); 22 | }); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/Makefile: -------------------------------------------------------------------------------- 1 | ALL_TESTS = $(shell find test/ -name '*.test.js') 2 | ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') 3 | 4 | all: 5 | node-gyp configure build 6 | 7 | clean: 8 | node-gyp clean 9 | 10 | run-tests: 11 | @./node_modules/.bin/mocha \ 12 | -t 2000 \ 13 | $(TESTFLAGS) \ 14 | $(TESTS) 15 | 16 | run-integrationtests: 17 | @./node_modules/.bin/mocha \ 18 | -t 5000 \ 19 | $(TESTFLAGS) \ 20 | $(TESTS) 21 | 22 | test: 23 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests 24 | 25 | integrationtest: 26 | @$(MAKE) NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests 27 | 28 | benchmark: 29 | @node bench/sender.benchmark.js 30 | @node bench/parser.benchmark.js 31 | 32 | autobahn: 33 | @NODE_PATH=lib node test/autobahn.js 34 | 35 | autobahn-server: 36 | @NODE_PATH=lib node test/autobahn-server.js 37 | 38 | .PHONY: test 39 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/autobahn-server.js: -------------------------------------------------------------------------------- 1 | var WebSocketServer = require('../').Server; 2 | 3 | process.on('uncaughtException', function(err) { 4 | console.log('Caught exception: ', err, err.stack); 5 | }); 6 | 7 | process.on('SIGINT', function () { 8 | try { 9 | console.log('Updating reports and shutting down'); 10 | var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); 11 | ws.on('close', function() { 12 | process.exit(); 13 | }); 14 | } 15 | catch(e) { 16 | process.exit(); 17 | } 18 | }); 19 | 20 | var wss = new WebSocketServer({port: 8181}); 21 | wss.on('connection', function(ws) { 22 | console.log('new connection'); 23 | ws.on('message', function(data, flags) { 24 | ws.send(flags.buffer, {binary: flags.binary === true}); 25 | }); 26 | ws.on('error', function() { 27 | console.log('error', arguments); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/options/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Einar Otto Stangvik", 4 | "email": "einaros@gmail.com", 5 | "url": "http://2x.io" 6 | }, 7 | "name": "options", 8 | "description": "A very light-weight in-code option parsers for node.js.", 9 | "version": "0.0.3", 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/einaros/options.js.git" 13 | }, 14 | "main": "lib/options", 15 | "scripts": { 16 | "test": "make test" 17 | }, 18 | "engines": { 19 | "node": ">=0.4.0" 20 | }, 21 | "dependencies": {}, 22 | "devDependencies": { 23 | "mocha": "latest", 24 | "expect.js": "latest" 25 | }, 26 | "_id": "options@0.0.3", 27 | "optionalDependencies": {}, 28 | "_engineSupported": true, 29 | "_npmVersion": "1.1.24", 30 | "_nodeVersion": "v0.6.17", 31 | "_defaultsLoaded": true, 32 | "_from": "options@latest" 33 | } 34 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/dashboard/MainView.js: -------------------------------------------------------------------------------- 1 | define(['../../shared/BaseView', './subviews/TopButtonsView', './subviews/SitesListView'], 2 | function (BaseView, TopButtonsView, SitesListView) { 3 | 4 | var MainView = BaseView.extend({ 5 | className: 'row', 6 | 7 | initialize: function (options) { 8 | if ((!options && options.collection)) { 9 | throw 'MainView: collection is required'; 10 | } 11 | 12 | this.collection = options.collection; 13 | }, 14 | 15 | onRender: function () { 16 | 17 | var addSiteButtonView = new TopButtonsView({ collection: this.collection }); 18 | this.appendSubview(addSiteButtonView.render()); 19 | 20 | var sitesListView = new SitesListView({ collection: this.collection }); 21 | this.appendSubview(sitesListView.render()); 22 | } 23 | }); 24 | 25 | return MainView; 26 | }); -------------------------------------------------------------------------------- /src/Candidate.Core/Settings/ApplicationDirectories.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace Candidate.Core.Settings 5 | { 6 | public static class ApplicationDirectories 7 | { 8 | private static readonly string AppFolder = ".candidate"; 9 | 10 | private static readonly string RootDirectory = 11 | Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), AppFolder); 12 | 13 | public static string Root 14 | { 15 | get { return RootDirectory; } 16 | } 17 | 18 | public static string Database 19 | { 20 | get { return Path.Combine(RootDirectory, "db"); } 21 | } 22 | 23 | public static string Sites 24 | { 25 | get { return Path.Combine(RootDirectory, "sites"); } 26 | } 27 | 28 | public static string Tools 29 | { 30 | get { return Path.Combine(RootDirectory, "tools"); } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/fixtures/key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQC2tDv6v//aJX8HoX7hugfReoWftqVxX2WmO8CbBFc0qfEChrR/ 3 | 3sCNg8Y0squOmQ1deEElE4h1tFtmcI14Ll/NfVr4kKjspK3MFe4ZJmvbtO0WZxXg 4 | f72AhEhw0e1mYkufFsmwiGQZHzJVh2Yll7h5PmV2TXOgHVp2A8XWFmEIEwIDAQAB 5 | AoGAAlVY8sHi/aE+9xT77twWX3mGHV0SzdjfDnly40fx6S1Gc7bOtVdd9DC7pk6l 6 | 3ENeJVR02IlgU8iC5lMHq4JEHPE272jtPrLlrpWLTGmHEqoVFv9AITPqUDLhB9Kk 7 | Hjl7h8NYBKbr2JHKICr3DIPKOT+RnXVb1PD4EORbJ3ooYmkCQQDfknUnVxPgxUGs 8 | ouABw1WJIOVgcCY/IFt4Ihf6VWTsxBgzTJKxn3HtgvE0oqTH7V480XoH0QxHhjLq 9 | DrgobWU9AkEA0TRJ8/ouXGnFEPAXjWr9GdPQRZ1Use2MrFjneH2+Sxc0CmYtwwqL 10 | Kr5kS6mqJrxprJeluSjBd+3/ElxURrEXjwJAUvmlN1OPEhXDmRHd92mKnlkyKEeX 11 | OkiFCiIFKih1S5Y/sRJTQ0781nyJjtJqO7UyC3pnQu1oFEePL+UEniRztQJAMfav 12 | AtnpYKDSM+1jcp7uu9BemYGtzKDTTAYfoiNF42EzSJiGrWJDQn4eLgPjY0T0aAf/ 13 | yGz3Z9ErbhMm/Ysl+QJBAL4kBxRT8gM4ByJw4sdOvSeCCANFq8fhbgm8pGWlCPb5 14 | JGmX3/GHFM8x2tbWMGpyZP1DLtiNEFz7eCGktWK5rqE= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/MainView.js: -------------------------------------------------------------------------------- 1 | define(['../../shared/BaseView', './subviews/MainMenuView', './subviews/ContentView'], 2 | function (BaseView, MainMenuView, ContentView) { 3 | 4 | var ConfigureView = BaseView.extend({ 5 | className: 'row', 6 | 7 | initialize: function (options) { 8 | if (!(options && options.section && options.id)) { 9 | throw 'Configure.MainView: section name and id requred'; 10 | } 11 | 12 | this.id = options.id; 13 | this.section = options.section; 14 | }, 15 | 16 | onRender: function () { 17 | var leftSideMainMenu = new MainMenuView({ id: this.id, section: this.section }); 18 | this.appendSubview(leftSideMainMenu.render()); 19 | 20 | var sideContent = new ContentView({ section: this.section }); 21 | this.appendSubview(sideContent.render()); 22 | } 23 | }); 24 | 25 | return ConfigureView; 26 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/commander/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "commander", 3 | "version": "0.6.1", 4 | "description": "the complete solution for node.js command-line programs", 5 | "keywords": [ 6 | "command", 7 | "option", 8 | "parser", 9 | "prompt", 10 | "stdin" 11 | ], 12 | "author": { 13 | "name": "TJ Holowaychuk", 14 | "email": "tj@vision-media.ca" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "git://github.com/visionmedia/commander.js.git" 19 | }, 20 | "dependencies": {}, 21 | "devDependencies": { 22 | "should": ">= 0.0.1" 23 | }, 24 | "scripts": { 25 | "test": "make test" 26 | }, 27 | "main": "index", 28 | "engines": { 29 | "node": ">= 0.4.x" 30 | }, 31 | "_id": "commander@0.6.1", 32 | "optionalDependencies": {}, 33 | "_engineSupported": true, 34 | "_npmVersion": "1.1.24", 35 | "_nodeVersion": "v0.6.17", 36 | "_defaultsLoaded": true, 37 | "_from": "commander@~0.6.1" 38 | } 39 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/applicationRouter.js: -------------------------------------------------------------------------------- 1 | define(['ViewManager', './apps/DashboardApp', './apps/ConfigureApp'], 2 | function (ViewManager, DashboardApp, ConfigureApp) { 3 | 4 | // router 5 | var ApplicationRouter = Backbone.Router.extend({ 6 | 7 | initialize: function () { 8 | this.viewManager = new ViewManager(); 9 | }, 10 | 11 | routes: { 12 | '': 'dashboard', 13 | 'configure/sites/:id': 'configure', 14 | 'configure/sites/:id/:section': 'configureSection' 15 | }, 16 | 17 | dashboard: function () { 18 | DashboardApp.run(this.viewManager); 19 | }, 20 | 21 | configure: function (id) { 22 | ConfigureApp.run({ id: id }, this.viewManager); 23 | }, 24 | 25 | configureSection: function (id, section) { 26 | ConfigureApp.run({ id: id, section: section }, this.viewManager); 27 | } 28 | 29 | }); 30 | 31 | return ApplicationRouter; 32 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/content/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 90px; 3 | } 4 | 5 | #app { 6 | padding: 10px 0 10px 0; 7 | min-height: 320px; 8 | } 9 | 10 | .rcs { 11 | -webkit-border-radius: 5px; 12 | border-radius: 5px; 13 | } 14 | 15 | .candidate-sites-header { 16 | height: 26px; 17 | background-color: #2C2C2C; 18 | color: white; 19 | } 20 | 21 | .candidate-sites-cell { 22 | line-height: 26px; 23 | display: inline-block; 24 | vertical-align: top; 25 | } 26 | 27 | .candidate-sites-cell.sort { 28 | width: 3.333333%; 29 | } 30 | 31 | .candidate-sites-cell.name { 32 | width: 44.166666%; 33 | } 34 | 35 | .candidate-sites-cell.status { 36 | width: 31.666666%; 37 | } 38 | 39 | .candidate-sites-cell.configure, .candidate-sites-cell.deploy, .candidate-sites-cell.delete { 40 | text-align: right; 41 | min-width: 5%; 42 | } 43 | 44 | ul.configure-nav li { 45 | margin-top: 4px; 46 | } 47 | 48 | ul.configure-nav .back { 49 | margin-top: 52px; 50 | } -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "livereload", 3 | "description": "LiveReload server", 4 | "version": "0.3.0", 5 | "contributors": [ 6 | { 7 | "name": "Joshua Peek" 8 | }, 9 | { 10 | "name": "Brian P. Hogan", 11 | "email": "brianhogan@napcs.com" 12 | } 13 | ], 14 | "licenses": [ 15 | { 16 | "type": "MIT", 17 | "url": "https://github.com/napcs/node-livereload/blob/master/LICENSE" 18 | } 19 | ], 20 | "repository": { 21 | "type": "git", 22 | "url": "git://github.com/napcs/node-livereload.git" 23 | }, 24 | "main": "./livereload.js", 25 | "dependencies": { 26 | "websocket.io": ">= 0.1.0" 27 | }, 28 | "engines": { 29 | "node": ">=0.4.0" 30 | }, 31 | "_id": "livereload@0.3.0", 32 | "devDependencies": {}, 33 | "optionalDependencies": {}, 34 | "_engineSupported": true, 35 | "_npmVersion": "1.1.24", 36 | "_nodeVersion": "v0.6.17", 37 | "_defaultsLoaded": true, 38 | "dist": { 39 | "shasum": "bf80e8349241561ea1ccb23881d57cff23390d53" 40 | }, 41 | "_from": "livereload" 42 | } 43 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Modules/Api/SitesModule.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Candidate.Core.Model; 3 | using Nancy; 4 | using Raven.Client; 5 | using Candidate.Core.Logger; 6 | 7 | namespace Candidate.Nancy.Selfhosted.App.Modules.Api 8 | { 9 | public class SitesModule : NancyModule 10 | { 11 | private readonly ILogger _logger; 12 | private readonly IDocumentStore _documentStore; 13 | 14 | public SitesModule(ILogger logger, IDocumentStore documentStore) : base("/api/sites") 15 | { 16 | _logger = logger; 17 | _documentStore = documentStore; 18 | 19 | Get["/"] = parameters => 20 | { 21 | using (var session = _documentStore.OpenSession()) 22 | { 23 | var sites = session.Query().OrderBy(s => s.Created); 24 | return Response.AsJson(sites.ToArray()); 25 | } 26 | }; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/configure/subviews/ContentView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView', './OverviewView', './ConfigurationView', './DeploymentsView', './HistoryView' ], 2 | function (BaseView, OverviewView, ConfigurationView, DeploymentsView, HistoryView) { 3 | 4 | var Views = { 5 | 'overview': OverviewView, 6 | 'configuration': ConfigurationView, 7 | 'deployments': DeploymentsView, 8 | 'history': HistoryView 9 | }; 10 | 11 | var ContentView = BaseView.extend({ 12 | className: 'span9', 13 | 14 | initialize: function (options) { 15 | if (!(options && options.section)) { 16 | throw 'Configuration.ContentView: section is required'; 17 | } 18 | 19 | _.bindAll(this); 20 | 21 | this.section = options.section; 22 | }, 23 | 24 | onRender: function () { 25 | var view = new Views[this.section](); 26 | this.appendSubview(view.render()); 27 | } 28 | 29 | }); 30 | 31 | return ContentView; 32 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/serverstats/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 26 | 27 | 28 | Server Stats
29 | RSS:

30 | Heap total:

31 | Heap used:

32 | 33 | 34 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/serverstats-express_3/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 26 | 27 | 28 | Server Stats
29 | RSS:

30 | Heap total:

31 | Heap used:

32 | 33 | 34 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Joshua Peek 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/dashboard/subviews/TopButtonsView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView', './AddNewSiteModalView', '../../../models/Site', 'text!/scripts/templates/dashboard/topButtons.html'], 2 | function (BaseView, AddNewSiteModalView, Site, template) { 3 | 4 | var TopButtonsView = BaseView.extend({ 5 | initialize: function (options) { 6 | if (!(options && options.collection)) { 7 | throw 'TopButtonsView: collection is required'; 8 | } 9 | 10 | this.collection = options.collection; 11 | }, 12 | 13 | template: function () { 14 | return template; 15 | }, 16 | 17 | events: { 18 | 'click a.addSite': 'onAddSiteClick' 19 | }, 20 | 21 | onAddSiteClick: function (e) { 22 | e.preventDefault(); 23 | 24 | var model = new Site(); 25 | var addNewSiteModalView = new AddNewSiteModalView( { model: model, collection: this.collection }); 26 | addNewSiteModalView.render(); 27 | } 28 | }); 29 | 30 | return TopButtonsView; 31 | 32 | }); -------------------------------------------------------------------------------- /src/Candidate.Core/Logger/Logger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Candidate.Core.Logger 4 | { 5 | public interface ILogger 6 | { 7 | void Info(string message); 8 | void Debug(string message); 9 | void Success(string message); 10 | void Warning(string message); 11 | } 12 | 13 | public class ConsoleLogger : ILogger 14 | { 15 | public void Info(string message) 16 | { 17 | Console.WriteLine(message); 18 | } 19 | 20 | public void Debug(string message) 21 | { 22 | Console.ForegroundColor = ConsoleColor.DarkRed; 23 | Console.WriteLine(message); 24 | Console.ResetColor(); 25 | } 26 | 27 | public void Success(string message) 28 | { 29 | Console.ForegroundColor = ConsoleColor.DarkGreen; 30 | Console.WriteLine(message); 31 | Console.ResetColor(); 32 | } 33 | 34 | public void Warning(string message) 35 | { 36 | Console.ForegroundColor = ConsoleColor.DarkYellow; 37 | Console.WriteLine(message); 38 | Console.ResetColor(); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Modules/AccountModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Nancy; 3 | 4 | namespace Candidate.Nancy.Selfhosted.App.Modules 5 | { 6 | public class AccountModule : NancyModule 7 | { 8 | private readonly IUserManagement _userManagement; 9 | 10 | public AccountModule(IUserManagement userManagement) : base("/account") 11 | { 12 | _userManagement = userManagement; 13 | 14 | Get["/login"] = p => View["Login"]; 15 | } 16 | } 17 | 18 | public interface IUserManagement 19 | { 20 | User CurrentUser { get; } 21 | void CreateUser(string login, string password); 22 | } 23 | 24 | public class UserManagement : IUserManagement 25 | { 26 | public User CurrentUser 27 | { 28 | get { throw new NotImplementedException(); } 29 | } 30 | 31 | public void CreateUser(string login, string password) 32 | { 33 | throw new NotImplementedException(); 34 | } 35 | } 36 | 37 | public class User 38 | { 39 | public string Login { get; set; } 40 | public string PasswordHash { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/examples/echo/server.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var http = require('http') 7 | // use require('websocket.io') if you installed with NPM 8 | , wsio = require('../../lib/websocket.io') 9 | 10 | /** 11 | * Create HTTP server. 12 | */ 13 | 14 | var server = http.createServer(function (req, res) { 15 | res.writeHead(200, { 'Content-Type': 'text/html' }); 16 | res.end([ 17 | '' 21 | ].join('')); 22 | }); 23 | 24 | /** 25 | * Attach websocket.io 26 | */ 27 | 28 | var ws = wsio.attach(server) 29 | , i = 0 30 | 31 | ws.on('connection', function (client) { 32 | var id = ++i, last 33 | 34 | console.log('Client %d connected', id); 35 | 36 | function ping () { 37 | client.send('ping!'); 38 | if (last) console.log('Latency for client %d: %d ', id, Date.now() - last); 39 | last = Date.now(); 40 | }; 41 | 42 | ping(); 43 | client.on('message', ping); 44 | }); 45 | 46 | /** 47 | * Listen. 48 | */ 49 | 50 | server.listen(3000, function () { 51 | console.error('\033[96m ∞ listening on http://127.0.0.1:3000 \033[39m'); 52 | }); 53 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Infrastructure/Serializers/JsonNetSerializer.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Nancy; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Serialization; 5 | 6 | namespace Candidate.Nancy.Selfhosted.App.Infrastructure.Serializers 7 | { 8 | public class JsonNetSerializer : ISerializer 9 | { 10 | private readonly JsonSerializer _serializer; 11 | 12 | public JsonNetSerializer() 13 | { 14 | var settings = new JsonSerializerSettings 15 | { 16 | ContractResolver = new CamelCasePropertyNamesContractResolver() 17 | }; 18 | 19 | _serializer = JsonSerializer.Create(settings); 20 | } 21 | 22 | public bool CanSerialize(string contentType) 23 | { 24 | return contentType == "application/json"; 25 | } 26 | 27 | public void Serialize(string contentType, TModel model, Stream outputStream) 28 | { 29 | using (var writer = new JsonTextWriter(new StreamWriter(outputStream))) 30 | { 31 | _serializer.Serialize(writer, model); 32 | writer.Flush(); 33 | } 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/templates/dashboard/addNewSiteModalView.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websocket.io", 3 | "description": "Socket.IO websocket server", 4 | "version": "0.2.1", 5 | "contributors": [ 6 | { 7 | "name": "Guillermo Rauch", 8 | "email": "rauchg@gmail.com" 9 | }, 10 | { 11 | "name": "Einar Otto Stangvik", 12 | "email": "einaros@gmail.com" 13 | }, 14 | { 15 | "name": "Arnout Kazemier", 16 | "email": "info@3rd-eden.com" 17 | }, 18 | { 19 | "name": "Nico Kaiser", 20 | "email": "nico@kaiser.me" 21 | }, 22 | { 23 | "name": "Andor Goetzendorff", 24 | "email": "andor.g@mytum.de" 25 | } 26 | ], 27 | "dependencies": { 28 | "debug": "*", 29 | "ws": "0.4.20" 30 | }, 31 | "devDependencies": { 32 | "mocha": "*", 33 | "should": "*", 34 | "colors": "*", 35 | "benchmark": "0.2.2" 36 | }, 37 | "main": "lib/websocket.io", 38 | "engines": { 39 | "node": ">=0.4.0" 40 | }, 41 | "scripts": { 42 | "test": "make test" 43 | }, 44 | "_id": "websocket.io@0.2.1", 45 | "optionalDependencies": {}, 46 | "_engineSupported": true, 47 | "_npmVersion": "1.1.24", 48 | "_nodeVersion": "v0.6.17", 49 | "_defaultsLoaded": true, 50 | "_from": "websocket.io@>= 0.1.0" 51 | } 52 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/History.md: -------------------------------------------------------------------------------- 1 | 2 | 0.7.0 / 2012-05-04 3 | ================== 4 | 5 | * Added .component to package.json 6 | * Added debug.component.js build 7 | 8 | 0.6.0 / 2012-03-16 9 | ================== 10 | 11 | * Added support for "-" prefix in DEBUG [Vinay Pulim] 12 | * Added `.enabled` flag to the node version [TooTallNate] 13 | 14 | 0.5.0 / 2012-02-02 15 | ================== 16 | 17 | * Added: humanize diffs. Closes #8 18 | * Added `debug.disable()` to the CS variant 19 | * Removed padding. Closes #10 20 | * Fixed: persist client-side variant again. Closes #9 21 | 22 | 0.4.0 / 2012-02-01 23 | ================== 24 | 25 | * Added browser variant support for older browsers [TooTallNate] 26 | * Added `debug.enable('project:*')` to browser variant [TooTallNate] 27 | * Added padding to diff (moved it to the right) 28 | 29 | 0.3.0 / 2012-01-26 30 | ================== 31 | 32 | * Added millisecond diff when isatty, otherwise UTC string 33 | 34 | 0.2.0 / 2012-01-22 35 | ================== 36 | 37 | * Added wildcard support 38 | 39 | 0.1.0 / 2011-12-02 40 | ================== 41 | 42 | * Added: remove colors unless stderr isatty [TooTallNate] 43 | 44 | 0.0.1 / 2010-01-03 45 | ================== 46 | 47 | * Initial release 48 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/WebSocket.integration.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert') 2 | , WebSocket = require('../') 3 | , server = require('./testserver'); 4 | 5 | var port = 20000; 6 | 7 | function getArrayBuffer(buf) { 8 | var l = buf.length; 9 | var arrayBuf = new ArrayBuffer(l); 10 | for (var i = 0; i < l; ++i) { 11 | arrayBuf[i] = buf[i]; 12 | } 13 | return arrayBuf; 14 | } 15 | 16 | function areArraysEqual(x, y) { 17 | if (x.length != y.length) return false; 18 | for (var i = 0, l = x.length; i < l; ++i) { 19 | if (x[i] !== y[i]) return false; 20 | } 21 | return true; 22 | } 23 | 24 | describe('WebSocket', function() { 25 | it('communicates successfully with echo service', function(done) { 26 | var ws = new WebSocket('ws://echo.websocket.org', {protocolVersion: 8, origin: 'http://websocket.org'}); 27 | var str = Date.now().toString(); 28 | var dataReceived = false; 29 | ws.on('open', function() { 30 | ws.send(str, {mask: true}); 31 | }); 32 | ws.on('close', function() { 33 | assert.equal(true, dataReceived); 34 | done(); 35 | }); 36 | ws.on('message', function(data, flags) { 37 | assert.equal(str, data); 38 | ws.terminate(); 39 | dataReceived = true; 40 | }); 41 | }); 42 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/tinycolor/tinycolor.js: -------------------------------------------------------------------------------- 1 | var styles = { 2 | 'bold': ['\033[1m', '\033[22m'], 3 | 'italic': ['\033[3m', '\033[23m'], 4 | 'underline': ['\033[4m', '\033[24m'], 5 | 'inverse': ['\033[7m', '\033[27m'], 6 | 'black': ['\033[30m', '\033[39m'], 7 | 'red': ['\033[31m', '\033[39m'], 8 | 'green': ['\033[32m', '\033[39m'], 9 | 'yellow': ['\033[33m', '\033[39m'], 10 | 'blue': ['\033[34m', '\033[39m'], 11 | 'magenta': ['\033[35m', '\033[39m'], 12 | 'cyan': ['\033[36m', '\033[39m'], 13 | 'white': ['\033[37m', '\033[39m'], 14 | 'default': ['\033[39m', '\033[39m'], 15 | 'grey': ['\033[90m', '\033[39m'], 16 | 'bgBlack': ['\033[40m', '\033[49m'], 17 | 'bgRed': ['\033[41m', '\033[49m'], 18 | 'bgGreen': ['\033[42m', '\033[49m'], 19 | 'bgYellow': ['\033[43m', '\033[49m'], 20 | 'bgBlue': ['\033[44m', '\033[49m'], 21 | 'bgMagenta': ['\033[45m', '\033[49m'], 22 | 'bgCyan': ['\033[46m', '\033[49m'], 23 | 'bgWhite': ['\033[47m', '\033[49m'], 24 | 'bgDefault': ['\033[49m', '\033[49m'] 25 | } 26 | Object.keys(styles).forEach(function(style) { 27 | Object.defineProperty(String.prototype, style, { 28 | get: function() { return styles[style][0] + this + styles[style][1]; }, 29 | enumerable: false 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Einar Otto Stangvik", 4 | "email": "einaros@gmail.com", 5 | "url": "http://2x.io" 6 | }, 7 | "name": "ws", 8 | "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", 9 | "version": "0.4.20", 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/einaros/ws.git" 13 | }, 14 | "bin": { 15 | "wscat": "./bin/wscat" 16 | }, 17 | "scripts": { 18 | "test": "make test", 19 | "install": "node install.js" 20 | }, 21 | "engines": { 22 | "node": ">=0.4.0" 23 | }, 24 | "config": { 25 | "verbose": false 26 | }, 27 | "dependencies": { 28 | "commander": "~0.6.1", 29 | "tinycolor": "0.x", 30 | "options": "latest" 31 | }, 32 | "devDependencies": { 33 | "mocha": "~1.2.1", 34 | "should": "0.6.x", 35 | "expect.js": "0.1.x", 36 | "benchmark": "0.3.x", 37 | "ansi": "latest" 38 | }, 39 | "_id": "ws@0.4.20", 40 | "optionalDependencies": {}, 41 | "_engineSupported": true, 42 | "_npmVersion": "1.1.24", 43 | "_nodeVersion": "v0.6.17", 44 | "_defaultsLoaded": true, 45 | "dist": { 46 | "shasum": "2ef5eee457ea2772c897afec72972ed102640f81" 47 | }, 48 | "_from": "ws@0.4.20" 49 | } 50 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/fileapi/public/app.js: -------------------------------------------------------------------------------- 1 | function onFilesSelected(e) { 2 | var button = e.srcElement; 3 | button.disabled = true; 4 | var progress = document.querySelector('div#progress'); 5 | progress.innerHTML = '0%'; 6 | var files = e.target.files; 7 | var totalFiles = files.length; 8 | var filesSent = 0; 9 | if (totalFiles) { 10 | var uploader = new Uploader('ws://localhost:8080', function () { 11 | Array.prototype.slice.call(files, 0).forEach(function(file) { 12 | if (file.name == '.') { 13 | --totalFiles; 14 | return; 15 | } 16 | uploader.sendFile(file, function(error) { 17 | if (error) { 18 | console.log(error); 19 | return; 20 | } 21 | ++filesSent; 22 | progress.innerHTML = ~~(filesSent / totalFiles * 100) + '%'; 23 | console.log('Sent: ' + file.name); 24 | }); 25 | }); 26 | }); 27 | } 28 | uploader.ondone = function() { 29 | uploader.close(); 30 | progress.innerHTML = '100% done, ' + totalFiles + ' files sent.'; 31 | } 32 | } 33 | 34 | window.onload = function() { 35 | var importButtons = document.querySelectorAll('[type="file"]'); 36 | Array.prototype.slice.call(importButtons, 0).forEach(function(importButton) { 37 | importButton.addEventListener('change', onFilesSelected, false); 38 | }); 39 | } 40 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/build/binding.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual Studio 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bufferutil", "bufferutil.vcxproj", "{058EB227-7687-BF3A-3F79-9C37E8CC72E6}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "validation", "validation.vcxproj", "{3776EC15-9F9C-474C-BDEA-C26BDD355F0D}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Win32 = Debug|Win32 10 | Release|Win32 = Release|Win32 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {058EB227-7687-BF3A-3F79-9C37E8CC72E6}.Debug|Win32.ActiveCfg = Debug|Win32 14 | {058EB227-7687-BF3A-3F79-9C37E8CC72E6}.Debug|Win32.Build.0 = Debug|Win32 15 | {058EB227-7687-BF3A-3F79-9C37E8CC72E6}.Release|Win32.ActiveCfg = Release|Win32 16 | {058EB227-7687-BF3A-3F79-9C37E8CC72E6}.Release|Win32.Build.0 = Release|Win32 17 | {3776EC15-9F9C-474C-BDEA-C26BDD355F0D}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {3776EC15-9F9C-474C-BDEA-C26BDD355F0D}.Debug|Win32.Build.0 = Debug|Win32 19 | {3776EC15-9F9C-474C-BDEA-C26BDD355F0D}.Release|Win32.ActiveCfg = Release|Win32 20 | {3776EC15-9F9C-474C-BDEA-C26BDD355F0D}.Release|Win32.Build.0 = Release|Win32 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | GlobalSection(NestedProjects) = preSolution 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /src/Candidate.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Candidate.Core")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Candidate.Core")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("73c39015-54fc-48f0-9cff-e661033f7a0e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Candidate.Core/Setup/ApplicationDirectories.cs: -------------------------------------------------------------------------------- 1 | using Candidate.Core.Logger; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | namespace Candidate.Core.Setup 9 | { 10 | public class ApplicationDirectories 11 | { 12 | private readonly ILogger _logger; 13 | 14 | public ApplicationDirectories(ILogger logger) 15 | { 16 | _logger = logger; 17 | } 18 | 19 | public void Setup(ILogger logger) 20 | { 21 | _logger.Info(string.Format("Application root folder at {0}", Settings.ApplicationDirectories.Root)); 22 | 23 | var directories = new List 24 | { 25 | Settings.ApplicationDirectories.Root, 26 | Settings.ApplicationDirectories.Database, 27 | Settings.ApplicationDirectories.Sites, 28 | Settings.ApplicationDirectories.Tools 29 | }; 30 | 31 | directories.ForEach(CreateDirectoryIfNotExist); 32 | } 33 | 34 | private void CreateDirectoryIfNotExist(string directoryName) 35 | { 36 | if (!Directory.Exists(directoryName)) 37 | { 38 | _logger.Info(string.Format(" Creating directory {0}", directoryName)); 39 | 40 | Directory.CreateDirectory(directoryName); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Candidate.Nancy.Selfhosted.App; 3 | using Nancy.Hosting.Self; 4 | using Candidate.Core.Logger; 5 | 6 | namespace Candidate.Nancy.Selfhosted 7 | { 8 | class Program 9 | { 10 | private static NancyHost _host; 11 | 12 | static void Main(string[] args) 13 | { 14 | StartHost(); 15 | } 16 | 17 | private static void StartHost() 18 | { 19 | var logger = new ConsoleLogger(); 20 | 21 | logger.Info("Candidate - Deployment Automation Server v.0.2.0\n"); 22 | logger.Info("Initializing, please wait unit server ready (up to 5 seconds)..."); 23 | 24 | var bootstarapper = new Bootstrapper(logger); 25 | var uri = new Uri("http://localhost:12543"); 26 | 27 | _host = new NancyHost(uri, bootstarapper); 28 | _host.Start(); 29 | 30 | logger.Success(string.Format("Candidate has been started up on: {0}", uri.AbsoluteUri)); 31 | logger.Success("Press CTRL+C to stop the server."); 32 | 33 | Console.CancelKeyPress += (s, e) => StopHost(s, e, logger); 34 | while(true) 35 | { 36 | Console.ReadKey(); 37 | } 38 | } 39 | 40 | private static void StopHost(object sender, ConsoleCancelEventArgs consoleCancelEventArgs, ConsoleLogger logger) 41 | { 42 | logger.Success("Candidate has been stopped by user request.\n"); 43 | _host.Stop(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Candidate.Nancy.Selfhosted")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Candidate.Nancy.Selfhosted")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d482fc32-2f2f-4d73-984d-4b145a11ff2f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/install.js: -------------------------------------------------------------------------------- 1 | var spawn = require('child_process').spawn 2 | , exec = require('child_process').exec 3 | , tinycolor = require('tinycolor') 4 | , fs = require('fs') 5 | , version = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf8')).version 6 | , verbose = process.env['npm_package_config_verbose'] != null ? process.env['npm_package_config_verbose'] === 'true' : false; 7 | 8 | console.log('[ws v%s]'.blue + ' Attempting to compile blazing fast native extensions.'.green, version); 9 | 10 | var gyp = exec('node-gyp rebuild', {cwd: __dirname}); 11 | gyp.stdout.on('data', function(data) { 12 | if (verbose) process.stdout.write(data); 13 | }); 14 | gyp.stderr.on('data', function(data) { 15 | if (verbose) process.stdout.write(data); 16 | }); 17 | gyp.on('exit', function(code) { 18 | if (code !== 0) { 19 | console.log('[ws v%s]'.blue + ' Native code compile failed (but the module will still work):'.yellow, version); 20 | console.log('[ws v%s]'.blue + ' The native extensions are faster, but not required.'.yellow, version); 21 | console.log('[ws v%s]'.blue + ' On Windows, native extensions require Visual Studio and Python.'.yellow, version); 22 | console.log('[ws v%s]'.blue + ' On Unix, native extensions require Python, make and a C++ compiler.'.yellow, version); 23 | console.log('[ws v%s]'.blue + ' Start npm with --ws:verbose to show compilation output (if any).'.yellow, version); 24 | } 25 | else { 26 | console.log('[ws v%s]'.blue + ' Native extension compilation successful!'.green, version); 27 | } 28 | process.exit(); 29 | }); 30 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/BufferUtil.fallback.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | module.exports.BufferUtil = { 8 | merge: function(mergedBuffer, buffers) { 9 | var offset = 0; 10 | for (var i = 0, l = buffers.length; i < l; ++i) { 11 | var buf = buffers[i]; 12 | buf.copy(mergedBuffer, offset); 13 | offset += buf.length; 14 | } 15 | }, 16 | mask: function(source, mask, output, offset, length) { 17 | var maskNum = mask.readUInt32LE(0, true); 18 | var i = 0; 19 | for (; i < length - 3; i += 4) { 20 | var num = maskNum ^ source.readUInt32LE(i, true); 21 | if (num < 0) num = 4294967296 + num; 22 | output.writeUInt32LE(num, offset + i, true); 23 | } 24 | switch (length % 4) { 25 | case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; 26 | case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; 27 | case 1: output[offset + i] = source[i] ^ mask[0]; 28 | case 0:; 29 | } 30 | }, 31 | unmask: function(data, mask) { 32 | var maskNum = mask.readUInt32LE(0, true); 33 | var length = data.length; 34 | var i = 0; 35 | for (; i < length - 3; i += 4) { 36 | var num = maskNum ^ data.readUInt32LE(i, true); 37 | if (num < 0) num = 4294967296 + num; 38 | data.writeUInt32LE(num, i, true); 39 | } 40 | switch (length % 4) { 41 | case 3: data[i + 2] = data[i + 2] ^ mask[2]; 42 | case 2: data[i + 1] = data[i + 1] ^ mask[1]; 43 | case 1: data[i] = data[i] ^ mask[0]; 44 | case 0:; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/autobahn.js: -------------------------------------------------------------------------------- 1 | var WebSocket = require('../'); 2 | var currentTest = 1; 3 | var lastTest = -1; 4 | var testCount = null; 5 | 6 | process.on('uncaughtException', function(err) { 7 | console.log('Caught exception: ', err, err.stack); 8 | }); 9 | 10 | process.on('SIGINT', function () { 11 | try { 12 | console.log('Updating reports and shutting down'); 13 | var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); 14 | ws.on('close', function() { 15 | process.exit(); 16 | }); 17 | } 18 | catch(e) { 19 | process.exit(); 20 | } 21 | }); 22 | 23 | function nextTest() { 24 | if (currentTest > testCount || (lastTest != -1 && currentTest > lastTest)) { 25 | console.log('Updating reports and shutting down'); 26 | var ws = new WebSocket('ws://localhost:9001/updateReports?agent=ws'); 27 | ws.on('close', function() { 28 | process.exit(); 29 | }); 30 | return; 31 | }; 32 | console.log('Running test case ' + currentTest + '/' + testCount); 33 | var ws = new WebSocket('ws://localhost:9001/runCase?case=' + currentTest + '&agent=ws'); 34 | ws.on('message', function(data, flags) { 35 | ws.send(flags.buffer, {binary: flags.binary === true, mask: true}); 36 | }); 37 | ws.on('close', function(data) { 38 | currentTest += 1; 39 | process.nextTick(nextTest); 40 | }); 41 | ws.on('error', function(e) {}); 42 | } 43 | 44 | var ws = new WebSocket('ws://localhost:9001/getCaseCount'); 45 | ws.on('message', function(data, flags) { 46 | testCount = parseInt(data); 47 | }); 48 | ws.on('close', function() { 49 | if (testCount > 0) { 50 | nextTest(); 51 | } 52 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/bench/sender.benchmark.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Benchmark dependencies. 9 | */ 10 | 11 | var benchmark = require('benchmark') 12 | , Sender = require('../').Sender 13 | , suite = new benchmark.Suite('Sender'); 14 | require('tinycolor'); 15 | require('./util'); 16 | 17 | /** 18 | * Setup sender. 19 | */ 20 | 21 | suite.on('start', function () { 22 | sender = new Sender(); 23 | sender._socket = { write: function() {} }; 24 | }); 25 | 26 | suite.on('cycle', function () { 27 | sender = new Sender(); 28 | sender._socket = { write: function() {} }; 29 | }); 30 | 31 | /** 32 | * Benchmarks 33 | */ 34 | 35 | framePacket = new Buffer(200*1024); 36 | framePacket.fill(99); 37 | suite.add('frameAndSend, unmasked (200 kB)', function () { 38 | sender.frameAndSend(0x2, framePacket, true, false); 39 | }); 40 | suite.add('frameAndSend, masked (200 kB)', function () { 41 | sender.frameAndSend(0x2, framePacket, true, true); 42 | }); 43 | 44 | /** 45 | * Output progress. 46 | */ 47 | 48 | suite.on('cycle', function (bench, details) { 49 | console.log('\n ' + suite.name.grey, details.name.white.bold); 50 | console.log(' ' + [ 51 | details.hz.toFixed(2).cyan + ' ops/sec'.grey 52 | , details.count.toString().white + ' times executed'.grey 53 | , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey 54 | , 55 | ].join(', '.grey)); 56 | }); 57 | 58 | /** 59 | * Run/export benchmarks. 60 | */ 61 | 62 | if (!module.parent) { 63 | suite.run(); 64 | } else { 65 | module.exports = suite; 66 | } 67 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/lib/util.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * websocket.io 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module dependencies. 10 | */ 11 | 12 | /** 13 | * Converts an enumerable to an array. 14 | * 15 | * @api public 16 | */ 17 | 18 | exports.toArray = function (enu) { 19 | var arr = []; 20 | 21 | for (var i = 0, l = enu.length; i < l; i++) 22 | arr.push(enu[i]); 23 | 24 | return arr; 25 | }; 26 | 27 | /** 28 | * Unpacks a buffer to a number. 29 | * 30 | * @api public 31 | */ 32 | 33 | exports.unpack = function (buffer) { 34 | var n = 0; 35 | for (var i = 0; i < buffer.length; ++i) { 36 | n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; 37 | } 38 | return n; 39 | } 40 | 41 | /** 42 | * Left pads a string. 43 | * 44 | * @api public 45 | */ 46 | 47 | exports.padl = function (s,n,c) { 48 | return new Array(1 + n - s.length).join(c) + s; 49 | } 50 | 51 | /** 52 | * Writes value to the buffer at the specified offset with specified endian format. 53 | * Note, value must be a valid unsigned 16 bit integer. 54 | * 55 | * @api public 56 | */ 57 | 58 | exports.writeUInt16BE = function (value, offset) { 59 | this[offset] = (value & 0xff00)>>8; 60 | this[offset+1] = value & 0xff; 61 | } 62 | 63 | /** 64 | * Writes value to the buffer at the specified offset with specified endian format. 65 | * Note, value must be a valid unsigned 32 bit integer. 66 | * 67 | * @api public 68 | */ 69 | 70 | exports.writeUInt32BE = function (value, offset) { 71 | this[offset] = (value & 0xff000000)>>24; 72 | this[offset+1] = (value & 0xff0000)>>16; 73 | this[offset+2] = (value & 0xff00)>>8; 74 | this[offset+3] = value & 0xff; 75 | } 76 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/dashboard/subviews/SitesListView.js: -------------------------------------------------------------------------------- 1 | define(['Hogan', '../../../shared/BaseView', './SiteRowView', 'text!/scripts/templates/dashboard/sitesList.html'], 2 | function (Hogan, BaseView, SiteRowView, template) { 3 | 4 | var SitesListView = BaseView.extend({ 5 | initialize: function (options) { 6 | _.bindAll(this); 7 | 8 | if (!(options && options.collection)) { 9 | throw 'SitesListView: collection is required'; 10 | } 11 | 12 | this.collection = options.collection; 13 | 14 | this.bindTo(this.collection, 'add', this.onSiteAdded); 15 | this.bindTo(this.collection, 'remove', this.onSiteRemoved); 16 | }, 17 | 18 | template: function (context) { 19 | return Hogan.compile(template).render(context); 20 | }, 21 | 22 | onRender: function () { 23 | this.collection.each (function (site) { 24 | var siteRowView = new SiteRowView ({ model: site }); 25 | this.appendSubview(siteRowView.render(), this.$('.candidate-sites')); 26 | }, this); 27 | }, 28 | 29 | onSiteAdded: function (site) { 30 | var siteRowView = new SiteRowView ({ model: site }); 31 | this.appendSubview(siteRowView.render(), this.$('.candidate-sites')); 32 | }, 33 | 34 | onSiteRemoved: function (site, collection, options) { 35 | var siteRowView = _.find(this.subviews, function (view) { 36 | return view.model.cid === site.cid; 37 | }); 38 | siteRowView.close(); 39 | this.detachSubview(siteRowView); 40 | } 41 | }); 42 | 43 | return SitesListView; 44 | }); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Candidate.NET 2 | Simple and nice continuous delivery for .NET web applications. 3 | 4 | ## What does application do? 5 | 6 | Simple, you create new site. You point the application to github repostitory (like, git@github.com:alexanderbeletsky/candidate.test.net.git), configure MsBuild options (like target, configuration) and IIS properties. Once it done, the application will clone your repository, build it, run all unit tests and create new IIS site for that. All you need to do is access it by URL. 7 | 8 | When you do changes to sources of application, those changes are picked up, tested and deployed immediately. 9 | 10 | ## What environment for application? 11 | 12 | It is typically installed on the production and staging servers where the target application is working. Alternately you can host it on dedicated server and provide options for remote deployment. 13 | 14 | ## Which project types supported? 15 | 16 | ASP.NET MVC, WebForms but in general every configuration that supports batch build and xcopy deployment. 17 | 18 | ## Can I support different branches? 19 | 20 | Yes. Say, 'master' is current production code, 'develop' is current staging code. You can setup 'Production' and 'Staging' sites for different branches. 21 | 22 | ## Any additional software I need? 23 | 24 | Candidate is very lightweight.. So, just nothing except Git. 25 | 26 | ## How to contribute? 27 | 28 | Just fork the repository and send me a pull request. Please referer to [How to build](https://github.com/alexanderbeletsky/candidate.net/wiki/How-to-build) with build instructions. 29 | 30 | ## Credits 31 | 32 | It's using wonderful [Bounce](https://github.com/alexanderbeletsky/bounce) framework for building and big [suite](https://github.com/alexanderbeletsky/candidate.net/tree/master/packages) of cool open source tools available by NuGet. 33 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/views/dashboard/subviews/AddNewSiteModalView.js: -------------------------------------------------------------------------------- 1 | define(['../../../shared/BaseView', 'text!/scripts/templates/dashboard/addNewSiteModalView.html'], 2 | function (BaseView, template) { 3 | 4 | var AddNewSiteModalView = BaseView.extend({ 5 | 6 | initialize: function (options) { 7 | if (!(options && options.collection)) { 8 | throw 'AddNewSiteModalView: collection is required'; 9 | } 10 | 11 | _.bindAll(this); 12 | 13 | this.bindTo(this.model, 'error', this.onModelError); 14 | }, 15 | 16 | events: { 17 | 'click .save': 'onSave' 18 | }, 19 | 20 | template: function () { 21 | return template; 22 | }, 23 | 24 | onRender: function () { 25 | this.$el.modal({ backdrop: 'static' }); 26 | }, 27 | 28 | onSave: function (e) { 29 | var me = this; 30 | 31 | var name = this.$('#name').val(); 32 | var description = this.$('#description').val(); 33 | 34 | this.model.save({ name: name, description: description}, { 35 | success: function (saved) { 36 | me.collection.add(saved); 37 | me.onClose(); 38 | } 39 | }); 40 | 41 | e.preventDefault(); 42 | }, 43 | 44 | onClose: function () { 45 | this.$el.modal('hide'); 46 | }, 47 | 48 | onModelError: function(model, error) { 49 | this.$('#' + error.field).closest('.control-group').addClass('error'); 50 | this.$('#' + error.field).closest('.help-block').text(error.message); 51 | } 52 | 53 | }); 54 | 55 | return AddNewSiteModalView; 56 | 57 | }); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/lib/websocket.io.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var net = require('net') 7 | , http = require('http') 8 | 9 | /** 10 | * Version number. 11 | * 12 | * @api public 13 | */ 14 | 15 | exports.version = '0.2.1'; 16 | 17 | /** 18 | * WebSocket protocols impls. 19 | * 20 | * @api public 21 | */ 22 | 23 | exports.protocols = require('./protocols'); 24 | 25 | /** 26 | * Server constructor. 27 | * 28 | * @api public 29 | */ 30 | 31 | exports.Server = require('./server'); 32 | 33 | /** 34 | * Socket constructor. 35 | * 36 | * @api public 37 | */ 38 | 39 | exports.Socket = require('./socket'); 40 | 41 | /** 42 | * Crates an http.Server exclusively used for WS upgrades. 43 | * 44 | * @param {Number} port 45 | * @param {Function} callback 46 | * @param {Object} options 47 | * @return {Server} websocket.io server 48 | * @api public 49 | */ 50 | 51 | exports.listen = function (port, fn, options) { 52 | if ('object' == typeof fn) { 53 | options = fn; 54 | fn = null; 55 | } 56 | 57 | var server = http.createServer(function (req, res) { 58 | res.writeHead(501); 59 | res.end('Not Implemented'); 60 | }); 61 | 62 | server.listen(port, fn); 63 | 64 | // create ws server 65 | var ws = exports.attach(server, options); 66 | ws.httpServer = server; 67 | 68 | return ws; 69 | }; 70 | 71 | /** 72 | * Captures upgrade requests for a http.Server. 73 | * 74 | * @param {http.Server} server 75 | * @param {Object} options 76 | * @return {Server} websocket.io server 77 | * @api public 78 | */ 79 | 80 | exports.attach = function (server, options) { 81 | var ws = new exports.Server(options); 82 | 83 | server.on('upgrade', function (req, socket, head) { 84 | ws.handleUpgrade(req, socket, head); 85 | }); 86 | 87 | return ws; 88 | }; 89 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/History.md: -------------------------------------------------------------------------------- 1 | 2 | 0.2.1 / 2012-07-03 3 | ================== 4 | 5 | * Bumped ws 6 | * Emit headers event for drafts protocol 7 | * Added `data` event to `Socket` 8 | * Improves `clientTracking` memory efficiency [ruxkor] 9 | 10 | 0.2.0 / 2012-06-19 11 | ================== 12 | 13 | * Check if socket is writable before finishing handshake 14 | * Implement readyState and async connection opening 15 | * Check for readyState before writing 16 | * Fix wrong interface for hybi protocol 17 | * Remove logger, use debug for logging 18 | * Disable client tracking in `ws` (hybi) 19 | * client tracking -> clientTracking 20 | * Use `ws` server and parsers for hybi protocols 21 | * Handle socket "timeout" event 22 | * Add missing Sec-WebSocket-Protocol header to hybi protocols 23 | 24 | 0.1.6 / 2012-02-27 25 | ================== 26 | 27 | * Fix hybi-16 on node 0.4 28 | 29 | 0.1.5 / 2012-02-10 30 | ================== 31 | 32 | * Bumped ws 33 | 34 | 0.1.4 / 2012-01-04 35 | ================== 36 | 37 | * `close` event fires in a different tick after calling Socket#close 38 | 39 | 0.1.3 / 2012-01-02 40 | ================== 41 | 42 | * Bumped ws 43 | * Cleaned up tests 44 | * Cleaned up docs 45 | 46 | 0.1.2 / 2011-12-12 47 | ================== 48 | 49 | * Updated ws 50 | * Added 0.4 compatibility. 51 | 52 | 0.1.1 / 2011-11-27 53 | ================== 54 | 55 | * Added echo example. 56 | * Fixed/improved parser benchmark. 57 | * Updated to easy-websocket 0.2, and pulled in hybi parser from there. 58 | * Documentation for client-side usage (fixes GH-7). 59 | * Fix typo in 'detroy' -> 'destroy' 60 | * Added travis CI 61 | * Fixed example. 62 | 63 | 0.1.0 / 2011-11-14 64 | ================== 65 | 66 | * Speed improvemements. 67 | * Faster socket initialization. 68 | * Faster parser in the order of 17%-40% 69 | * Added comprehensive tests. 70 | * Added benchmarks. 71 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/BufferPool.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var util = require('util'); 8 | 9 | function BufferPool(initialSize, growStrategy, shrinkStrategy) { 10 | if (typeof initialSize === 'function') { 11 | shrinkStrategy = growStrategy; 12 | growStrategy = initialSize; 13 | initialSize = 0; 14 | } 15 | else if (typeof initialSize === 'undefined') { 16 | initialSize = 0; 17 | } 18 | this._growStrategy = (growStrategy || function(db, size) { 19 | return db.used + size; 20 | }).bind(null, this); 21 | this._shrinkStrategy = (shrinkStrategy || function(db) { 22 | return initialSize; 23 | }).bind(null, this); 24 | this._buffer = initialSize ? new Buffer(initialSize) : null; 25 | this._offset = 0; 26 | this._used = 0; 27 | this._changeFactor = 0; 28 | this.__defineGetter__('size', function(){ 29 | return this._buffer == null ? 0 : this._buffer.length; 30 | }); 31 | this.__defineGetter__('used', function(){ 32 | return this._used; 33 | }); 34 | } 35 | 36 | BufferPool.prototype.get = function(length) { 37 | if (this._buffer == null || this._offset + length > this._buffer.length) { 38 | var newBuf = new Buffer(this._growStrategy(length)); 39 | this._buffer = newBuf; 40 | this._offset = 0; 41 | } 42 | this._used += length; 43 | var buf = this._buffer.slice(this._offset, this._offset + length); 44 | this._offset += length; 45 | return buf; 46 | } 47 | 48 | BufferPool.prototype.reset = function(forceNewBuffer) { 49 | var len = this._shrinkStrategy(); 50 | if (len < this.size) this._changeFactor -= 1; 51 | if (forceNewBuffer || this._changeFactor < -2) { 52 | this._changeFactor = 0; 53 | this._buffer = len ? new Buffer(len) : null; 54 | } 55 | this._offset = 0; 56 | this._used = 0; 57 | } 58 | 59 | module.exports = BufferPool; 60 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/fileapi/public/uploader.js: -------------------------------------------------------------------------------- 1 | function Uploader(url, cb) { 2 | this.ws = new WebSocket(url); 3 | if (cb) this.ws.onopen = cb; 4 | this.sendQueue = []; 5 | this.sending = null; 6 | this.sendCallback = null; 7 | this.ondone = null; 8 | var self = this; 9 | this.ws.onmessage = function(event) { 10 | var data = JSON.parse(event.data); 11 | if (data.event == 'complete') { 12 | if (data.path != self.sending.path) { 13 | self.sendQueue = []; 14 | self.sending = null; 15 | self.sendCallback = null; 16 | throw new Error('Got message for wrong file!'); 17 | } 18 | self.sending = null; 19 | var callback = self.sendCallback; 20 | self.sendCallback = null; 21 | if (callback) callback(); 22 | if (self.sendQueue.length === 0 && self.ondone) self.ondone(null); 23 | if (self.sendQueue.length > 0) { 24 | var args = self.sendQueue.pop(); 25 | setTimeout(function() { self.sendFile.apply(self, args); }, 0); 26 | } 27 | } 28 | else if (data.event == 'error') { 29 | self.sendQueue = []; 30 | self.sending = null; 31 | var callback = self.sendCallback; 32 | self.sendCallback = null; 33 | var error = new Error('Server reported send error for file ' + data.path); 34 | if (callback) callback(error); 35 | if (self.ondone) self.ondone(error); 36 | } 37 | } 38 | } 39 | 40 | Uploader.prototype.sendFile = function(file, cb) { 41 | if (this.ws.readyState != WebSocket.OPEN) throw new Error('Not connected'); 42 | if (this.sending) { 43 | this.sendQueue.push(arguments); 44 | return; 45 | } 46 | var fileData = { name: file.name, path: file.webkitRelativePath }; 47 | this.sending = fileData; 48 | this.sendCallback = cb; 49 | this.ws.send(JSON.stringify(fileData)); 50 | this.ws.send(file); 51 | } 52 | 53 | Uploader.prototype.close = function() { 54 | this.ws.close(); 55 | } 56 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/Validation.test.js: -------------------------------------------------------------------------------- 1 | var Validation = require('../lib/Validation').Validation; 2 | require('should'); 3 | 4 | describe('Validation', function() { 5 | describe('isValidUTF8', function() { 6 | it('should return true for a valid utf8 string', function() { 7 | var validBuffer = new Buffer('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque gravida mattis rhoncus. Donec iaculis, metus quis varius accumsan, erat mauris condimentum diam, et egestas erat enim ut ligula. Praesent sollicitudin tellus eget dolor euismod euismod. Nullam ac augue nec neque varius luctus. Curabitur elit mi, consequat ultricies adipiscing mollis, scelerisque in erat. Phasellus facilisis fermentum ullamcorper. Nulla et sem eu arcu pharetra pellentesque. Praesent consectetur tempor justo, vel iaculis dui ullamcorper sit amet. Integer tristique viverra ullamcorper. Vivamus laoreet, nulla eget suscipit eleifend, lacus lectus feugiat libero, non fermentum erat nisi at risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pulvinar dignissim tellus, eu dignissim lorem vulputate quis. Morbi ut pulvinar augue.'); 8 | Validation.isValidUTF8(validBuffer).should.be.ok; 9 | }); 10 | it('should return false for an erroneous string', function() { 11 | var invalidBuffer = new Buffer([0xce, 0xba, 0xe1, 0xbd, 0xb9, 0xcf, 0x83, 0xce, 0xbc, 0xce, 0xb5, 0xed, 0xa0, 0x80, 0x65, 0x64, 0x69, 0x74, 0x65, 0x64]); 12 | Validation.isValidUTF8(invalidBuffer).should.not.be.ok; 13 | }); 14 | it('should return true for valid cases from the autobahn test suite', function() { 15 | Validation.isValidUTF8(new Buffer('\xf0\x90\x80\x80')).should.be.ok; 16 | Validation.isValidUTF8(new Buffer([0xf0, 0x90, 0x80, 0x80])).should.be.ok; 17 | }); 18 | it('should return false for erroneous autobahn strings', function() { 19 | Validation.isValidUTF8(new Buffer([0xce, 0xba, 0xe1, 0xbd])).should.not.be.ok; 20 | }); 21 | }); 22 | }); 23 | 24 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/BufferPool.test.js: -------------------------------------------------------------------------------- 1 | var BufferPool = require('../lib/BufferPool'); 2 | require('should'); 3 | 4 | describe('BufferPool', function() { 5 | describe('#ctor', function() { 6 | it('allocates pool', function() { 7 | var db = new BufferPool(1000); 8 | db.size.should.eql(1000); 9 | }); 10 | }); 11 | describe('#get', function() { 12 | it('grows the pool if necessary', function() { 13 | var db = new BufferPool(1000); 14 | var buf = db.get(2000); 15 | db.size.should.be.above(1000); 16 | db.used.should.eql(2000); 17 | buf.length.should.eql(2000); 18 | }); 19 | it('grows the pool after the first call, if necessary', function() { 20 | var db = new BufferPool(1000); 21 | var buf = db.get(1000); 22 | db.used.should.eql(1000); 23 | db.size.should.eql(1000); 24 | buf.length.should.eql(1000); 25 | var buf2 = db.get(1000); 26 | db.used.should.eql(2000); 27 | db.size.should.be.above(1000); 28 | buf2.length.should.eql(1000); 29 | }); 30 | it('grows the pool according to the growStrategy if necessary', function() { 31 | var db = new BufferPool(1000, function(db, length) { 32 | return db.size + 2345; 33 | }); 34 | var buf = db.get(2000); 35 | db.size.should.eql(3345); 36 | buf.length.should.eql(2000); 37 | }); 38 | it('doesnt grow the pool if theres enough room available', function() { 39 | var db = new BufferPool(1000); 40 | var buf = db.get(1000); 41 | db.size.should.eql(1000); 42 | buf.length.should.eql(1000); 43 | }); 44 | }); 45 | describe('#reset', function() { 46 | it('shinks the pool', function() { 47 | var db = new BufferPool(1000); 48 | var buf = db.get(2000); 49 | db.reset(true); 50 | db.size.should.eql(1000); 51 | }); 52 | it('shrinks the pool according to the shrinkStrategy', function() { 53 | var db = new BufferPool(1000, function(db, length) { 54 | return db.used + length; 55 | }, function(db) { 56 | return 0; 57 | }); 58 | var buf = db.get(2000); 59 | db.reset(true); 60 | db.size.should.eql(0); 61 | }); 62 | }); 63 | }); 64 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | shim: { 3 | 'Underscore': { 4 | exports: '_' 5 | }, 6 | 7 | 'Backbone': { 8 | deps: ['Underscore', 'jQuery'], 9 | exports: 'Backbone' 10 | }, 11 | 12 | 'BootstrapModal': { 13 | deps: ['jQuery'] 14 | }, 15 | 16 | 'ApplicationRouter': { 17 | deps: ['jQuery', 'Underscore', 'Backbone', 'BootstrapModal'] 18 | } 19 | }, 20 | 21 | paths: { 22 | text: 'libs/text', 23 | Backbone: 'libs/backbone', 24 | jQuery: 'libs/jquery-1.7.2', 25 | Underscore: 'libs/underscore', 26 | Mustache: 'libs/mustache', 27 | Hogan: 'libs/hogan-1.0.5.amd', 28 | BootstrapModal: 'libs/bootsrap-modal' 29 | } 30 | }); 31 | 32 | require(['ApplicationRouter'], function (ApplicationRouter) { 33 | var app = { 34 | root: '/' 35 | }; 36 | 37 | Router = new ApplicationRouter(); 38 | Backbone.history.start({ pushState: true }); 39 | 40 | // All navigation that is relative should be passed through the navigate 41 | // method, to be processed by the router. If the link has a `data-bypass` 42 | // attribute, bypass the delegation completely. 43 | $(document).on("click", "a[href]:not([data-bypass])", function(evt) { 44 | // Get the absolute anchor href. 45 | var href = { prop: $(this).prop("href"), attr: $(this).attr("href") }; 46 | // Get the absolute root. 47 | var root = location.protocol + "//" + location.host + app.root; 48 | 49 | // Ensure the root is part of the anchor href, meaning it's relative. 50 | if (href.prop.slice(0, root.length) === root) { 51 | // Stop the default event to ensure the link will not cause a page 52 | // refresh. 53 | evt.preventDefault(); 54 | 55 | // `Backbone.history.navigate` is sufficient for all Routers and will 56 | // trigger the correct events. The Router's internal `navigate` method 57 | // calls this anyways. The fragment is sliced from the root. 58 | Backbone.history.navigate(href.attr, true); 59 | } 60 | }); 61 | }); 62 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/README.md: -------------------------------------------------------------------------------- 1 | node-livereload 2 | =============== 3 | 4 | An implementation of the LiveReload server in Node.js. It's an alternative to the graphical [http://livereload.com/](http://livereload.com/) application, which monitors files for changes and reloads your web browser. 5 | 6 | # Example Usage 7 | 8 | First, install the LiveReload browser plugins by visiting [http://help.livereload.com/kb/general-use/browser-extensions](http://help.livereload.com/kb/general-use/browser-extensions). 9 | 10 | Then install the livereload module with `npm`: 11 | 12 | $ npm install livereload 13 | 14 | Then, simply create a server and fire it up. 15 | 16 | livereload = require('livereload'); 17 | server = livereload.createServer(); 18 | server.watch(__dirname + "/public"); 19 | 20 | You can also use this with a Connect server: 21 | 22 | connect = require('connect'); 23 | connect.createServer( 24 | connect.compiler({ src: __dirname + "/public", enable: ['less'] }), 25 | connect.staticProvider(__dirname + "/public") 26 | ).listen(3000); 27 | 28 | livereload = require('livereload'); 29 | server = livereload.createServer({exts: ['less']}); 30 | server.watch(__dirname + "/public"); 31 | 32 | # Options 33 | 34 | The `createServer()` method supports a few basic options, passed as a JavaScript object: 35 | 36 | * `port` is the listening port. It defaults to `35729` which is what the LiveReload extensions use currently. 37 | * `exts` is an array of extensions you want to observe. The default extensions are `html`, `css`, `js`, `png`, `gif`, `jpg`, 38 | `php`, `php5`, `py`, `rb`, and `erb` 39 | * `applyJSLive` tells LiveReload to reload JavaScript files in the background instead of reloading the page. The default for this is `false`. 40 | * `applyCSSLive` tells LiveReload to reload CSS files in the background instead of refreshing the page. The default for this is `true`. 41 | * `exclusions` lets you specify files to ignore. By default, this includes `.git/`, `.svn/`, and `.hg/` 42 | 43 | # Limitations 44 | 45 | Right now this is extremely simple. It relies on polling so there's a delay in refreshing the browser. It could be faster. 46 | 47 | # License 48 | 49 | Copyright (c) 2010-2012 Joshua Peek and Brian P. Hogan. 50 | 51 | Released under the MIT license. See `LICENSE` for details. 52 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/content/spacing.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Spacing classes 3 | * Should be used to modify the default spacing between objects (not between nodes of the same object) 4 | * Please use judiciously. You want to be using defaults most of the time, these are exceptions! 5 | * 6 | */ 7 | /* ====== Default spacing ====== */ 8 | h1, h2, h3, h4, h5, h6, ul, ol,dl, p,blockquote, .media {margin:10px 0;} 9 | h1, h2, h3, h4, h5, h6,img{padding-bottom:0px;} 10 | pre{margin: 10px 0;} 11 | table h1,table h2,table h3, table h4, table h5, table h6, table p, table ul, table ol, table dl{padding:0;} 12 | 13 | /* spacing helpers 14 | p,m = padding,margin 15 | a,t,r,b,l,h,v = all,top,right,bottom,left,horizontal,vertical 16 | s,m,l,n = small(5px),medium(10px),large(20px),none(0px) 17 | */ 18 | 19 | .ptn,.pvn,.pan{padding-top:0px !important} 20 | .pts,.pvs,.pas{padding-top:5px !important} 21 | .ptm,.pvm,.pam{padding-top:10px !important} 22 | .ptl,.pvl,.pal{padding-top:20px !important} 23 | .prn,.phn,.pan{padding-right:0px !important} 24 | .prs,.phs,.pas{padding-right:5px !important} 25 | .prm,.phm,.pam{padding-right:10px !important} 26 | .prl,.phl,.pal{padding-right:20px !important} 27 | .pbn,.pvn,.pan{padding-bottom:0px !important} 28 | .pbs,.pvs,.pas{padding-bottom:5px !important} 29 | .pbm,.pvm,.pam{padding-bottom:10px !important} 30 | .pbl,.pvl,.pal{padding-bottom:20px !important} 31 | .pln,.phn,.pan{padding-left:0px !important} 32 | .pls,.phs,.pas{padding-left:5px !important} 33 | .plm,.phm,.pam{padding-left:10px !important} 34 | .pll,.phl,.pal{padding-left:20px !important} 35 | .mtn,.mvn,.man{margin-top:0px !important} 36 | .mts,.mvs,.mas{margin-top:5px !important} 37 | .mtm,.mvm,.mam{margin-top:10px !important} 38 | .mtl,.mvl,.mal{margin-top:20px !important} 39 | .mrn,.mhn,.man{margin-right:0px !important} 40 | .mrs,.mhs,.mas{margin-right:5px !important} 41 | .mrm,.mhm,.mam{margin-right:10px !important} 42 | .mrl,.mhl,.mal{margin-right:20px !important} 43 | .mbn,.mvn,.man{margin-bottom:0px !important} 44 | .mbs,.mvs,.mas{margin-bottom:5px !important} 45 | .mbm,.mvm,.mam{margin-bottom:10px !important} 46 | .mbl,.mvl,.mal{margin-bottom:20px !important} 47 | .mln,.mhn,.man{margin-left:0px !important} 48 | .mls,.mhs,.mas{margin-left:5px !important} 49 | .mlm,.mhm,.mam{margin-left:10px !important} 50 | .mll,.mhl,.mal{margin-left:20px !important} -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/options/lib/options.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | function Options(defaults) { 4 | var internalValues = {}; 5 | var values = this.value = {}; 6 | Object.keys(defaults).forEach(function(key) { 7 | internalValues[key] = defaults[key]; 8 | Object.defineProperty(values, key, { 9 | get: function() { return internalValues[key]; }, 10 | configurable: false, 11 | enumerable: true 12 | }); 13 | }); 14 | this.reset = function() { 15 | Object.keys(defaults).forEach(function(key) { 16 | internalValues[key] = defaults[key]; 17 | }); 18 | return this; 19 | } 20 | this.merge = function(options, required) { 21 | options = options || {}; 22 | if (Object.prototype.toString.call(required) === '[object Array]') { 23 | var missing = []; 24 | for (var i = 0, l = required.length; i < l; ++i) { 25 | var key = required[i]; 26 | if (typeof options[key] === 'undefined') { 27 | missing.push(key); 28 | } 29 | } 30 | if (missing.length > 0) { 31 | if (missing.length > 1) { 32 | throw new Error('options ' + 33 | missing.slice(0, missing.length - 1).join(', ') + ' and ' + 34 | missing[missing.length - 1] + ' must be defined'); 35 | } 36 | else throw new Error('option ' + missing[0] + ' must be defined'); 37 | } 38 | } 39 | Object.keys(options).forEach(function(key) { 40 | if (typeof internalValues[key] !== 'undefined') { 41 | internalValues[key] = options[key]; 42 | } 43 | }); 44 | return this; 45 | } 46 | this.copy = function(keys) { 47 | var obj = {}; 48 | Object.keys(defaults).forEach(function(key) { 49 | if (keys.indexOf(key) !== -1) { 50 | obj[key] = values[key]; 51 | } 52 | }); 53 | return obj; 54 | } 55 | this.read = function(filename, cb) { 56 | if (typeof cb == 'function') { 57 | var self = this; 58 | fs.readFile(filename, function(error, data) { 59 | if (error) return cb(error); 60 | var conf = JSON.parse(data); 61 | self.merge(conf); 62 | cb(); 63 | }); 64 | } 65 | else { 66 | var conf = JSON.parse(fs.readFileSync(filename)); 67 | this.merge(conf); 68 | } 69 | return this; 70 | } 71 | Object.freeze(values); 72 | Object.freeze(this); 73 | } 74 | 75 | module.exports = Options; 76 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/test/websocket.io.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Test dependencies. 4 | */ 5 | 6 | var ws = require('../lib/websocket.io') 7 | , http = require('http') 8 | 9 | /** 10 | * Tests. 11 | */ 12 | 13 | describe('websocket.io', function () { 14 | 15 | it('must expose version number', function () { 16 | ws.version.should.match(/[0-9]+\.[0-9]+\.[0-9]+/); 17 | }); 18 | 19 | it('must expose public constructors', function () { 20 | ws.Socket.should.be.a('function'); 21 | ws.Server.should.be.a('function'); 22 | ws.protocols.drafts.should.be.a('function'); 23 | ws.protocols['7'].should.be.a('function'); 24 | ws.protocols['8'].should.be.a('function'); 25 | ws.protocols['13'].should.be.a('function'); 26 | }); 27 | 28 | it('must connect', function (done) { 29 | listen(function (addr, server) { 30 | var cl = client(addr); 31 | cl.on('open', function () { 32 | cl.close(); 33 | server.close(); 34 | done(); 35 | }); 36 | }); 37 | }); 38 | 39 | it('must handle upgrade requests of a normal http server', function (done) { 40 | var httpServer = http.createServer(function (req, res) { 41 | res.writeHead(200); 42 | res.end('Hello World'); 43 | }) 44 | 45 | var server = ws.attach(httpServer); 46 | 47 | httpServer.listen(function (err) { 48 | if (err) throw err; 49 | 50 | var addr = httpServer.address(); 51 | 52 | http.get({ host: addr.address, port: addr.port }, function (res) { 53 | res.on('data', function (data) { 54 | data.toString().should.equal('Hello World'); 55 | 56 | var cl = client(addr); 57 | cl.on('open', function () { 58 | cl.close(); 59 | httpServer.close(); 60 | done(); 61 | }); 62 | }); 63 | }); 64 | }); 65 | }); 66 | 67 | it('must listen on a port', function (done) { 68 | var server = ws.listen(null, function () { 69 | var addr = server.httpServer.address(); 70 | 71 | http.get({ host: addr.address, port: addr.port }, function (res) { 72 | res.statusCode.should.equal(501); 73 | res.on('data', function (data) { 74 | data.toString().should.equal('Not Implemented'); 75 | 76 | var cl = client(addr); 77 | cl.on('open', function () { 78 | cl.close(); 79 | server.httpServer.close(); 80 | done(); 81 | }); 82 | }); 83 | }); 84 | }); 85 | }); 86 | 87 | }); 88 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/views/master.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 38 | 39 |
40 |
41 |
42 |
43 |

44 | Sources of this application is available on github. Please report any problem here. 45 |

46 |

47 | Copyright © 2011-2012 All rights reserved 48 |

49 |

50 |
51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/shared/BaseView.js: -------------------------------------------------------------------------------- 1 | define(function () { 2 | 3 | // https://gist.github.com/2637323 4 | var BaseView = Backbone.View.extend({ 5 | 6 | close: function () { 7 | this.closeSubviews(); 8 | this.unbindFromAll(); 9 | this.off(); 10 | this.remove(); 11 | 12 | if (this.onClose) this.onClose(); 13 | }, 14 | 15 | // Events 16 | 17 | bindTo: function (object, e, callback, context) { 18 | context || (context = this); 19 | 20 | object.on(e, callback, context); 21 | 22 | this.bindings || (this.bindings = []); 23 | this.bindings.push({ object: object, event: e, callback: callback }); 24 | }, 25 | 26 | unbindFromAll: function () { 27 | var self = this; 28 | 29 | _.each(this.bindings, function (binding) { 30 | binding.object.off(binding.event, binding.callback, self); 31 | }); 32 | }, 33 | 34 | // Subviews 35 | 36 | eachSubview: function (iterator) { 37 | _.each(this.subviews, iterator); 38 | }, 39 | 40 | appendSubview: function (view, el) { 41 | el || (el = this.$el); 42 | this.subviews || (this.subviews = {}); 43 | this.subviews[view.cid] = view; 44 | el.append(view.el); 45 | }, 46 | 47 | closeSubviews: function () { 48 | this.eachSubview(function (subview) { 49 | subview.close(); 50 | }); 51 | 52 | this.subviews = {}; 53 | }, 54 | 55 | detachSubview: function (view) { 56 | if (this.subviews) { 57 | delete this.subviews[view.cid]; 58 | } 59 | 60 | view.$el.detach(); 61 | }, 62 | 63 | // Templates 64 | 65 | templateContext: function () { 66 | return {}; 67 | }, 68 | 69 | layout: function (context, template) { 70 | this.closeSubviews(); 71 | this.$el.empty(); 72 | 73 | template || (template = this.template); 74 | 75 | if (template) { 76 | context || (context = this.templateContext()); 77 | this.$el.append(template(context)); 78 | } 79 | }, 80 | 81 | render: function () { 82 | this.layout(); 83 | if (this.onRender) this.onRender(); 84 | return this; 85 | } 86 | 87 | }); 88 | 89 | return BaseView; 90 | }); -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Properties/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 47 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/lib/protocols/hybi.js: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * websocket.io 4 | * Copyright(c) 2011 LearnBoost 5 | * MIT Licensed 6 | */ 7 | 8 | /** 9 | * Module requirements. 10 | */ 11 | 12 | var Socket = require('../socket') 13 | , WebSocketServer = require('ws').Server 14 | , debug = require('debug')('wsio:hybi'); 15 | 16 | /** 17 | * Export the constructor. 18 | */ 19 | 20 | exports = module.exports = WebSocket; 21 | 22 | /** 23 | * HTTP interface constructor. Interface compatible with all transports that 24 | * depend on request-response cycles. 25 | * 26 | * @api public 27 | */ 28 | 29 | function WebSocket (req) { 30 | var self = this; 31 | this.wss = new WebSocketServer({ 32 | noServer: true 33 | , clientTracking: false 34 | }); 35 | Socket.call(this, req); 36 | }; 37 | 38 | /** 39 | * Inherits from Socket. 40 | */ 41 | 42 | WebSocket.prototype.__proto__ = Socket.prototype; 43 | 44 | /** 45 | * Transport name 46 | * 47 | * @api public 48 | */ 49 | 50 | WebSocket.prototype.name = 'websocket'; 51 | 52 | /** 53 | * Websocket draft version 54 | * 55 | * @api public 56 | */ 57 | 58 | WebSocket.prototype.protocolVersion = 'hybi'; 59 | 60 | /** 61 | * Called when the socket connects. 62 | * 63 | * @api private 64 | */ 65 | 66 | WebSocket.prototype.onOpen = function () { 67 | var self = this; 68 | 69 | this.wss.handleUpgrade(this.req, this.socket, this.req.head, function(ws) { 70 | self.ws = ws; 71 | self.protocolVersion = 'hybi-' + ws.protocolVersion; 72 | 73 | ws.on('message', function(message) { 74 | self.onMessage(message); 75 | }); 76 | ws.on('close', function () { 77 | self.end(); 78 | }); 79 | ws.on('error', function (reason) { 80 | debug(self.name + ' parser error: ' + reason); 81 | self.end(); 82 | }); 83 | 84 | process.nextTick(function() { 85 | if ('opening' == self.readyState) { 86 | self.readyState = 'open'; 87 | self.emit('open'); 88 | } 89 | }); 90 | }); 91 | }; 92 | 93 | /** 94 | * Writes to the socket. 95 | * 96 | * @api private 97 | */ 98 | 99 | WebSocket.prototype.write = function (data) { 100 | if ('open' == this.readyState && this.ws) { 101 | this.ws.send(data); 102 | debug(this.name + ' writing', data); 103 | } 104 | }; 105 | 106 | /** 107 | * Writes a payload. 108 | * 109 | * @api private 110 | */ 111 | 112 | WebSocket.prototype.payload = function (msgs) { 113 | for (var i = 0, l = msgs.length; i < l; i++) { 114 | this.write(msgs[i]); 115 | } 116 | return this; 117 | }; 118 | -------------------------------------------------------------------------------- /src/Candidate.Core/Candidate.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {C72F8BE6-9149-488B-B284-784469665B66} 9 | Library 10 | Properties 11 | Candidate.Core 12 | Candidate.Core 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 59 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/node_modules/commander/History.md: -------------------------------------------------------------------------------- 1 | 2 | 0.6.1 / 2012-06-01 3 | ================== 4 | 5 | * Added: append (yes or no) on confirmation 6 | * Added: allow node.js v0.7.x 7 | 8 | 0.6.0 / 2012-04-10 9 | ================== 10 | 11 | * Added `.prompt(obj, callback)` support. Closes #49 12 | * Added default support to .choose(). Closes #41 13 | * Fixed the choice example 14 | 15 | 0.5.1 / 2011-12-20 16 | ================== 17 | 18 | * Fixed `password()` for recent nodes. Closes #36 19 | 20 | 0.5.0 / 2011-12-04 21 | ================== 22 | 23 | * Added sub-command option support [itay] 24 | 25 | 0.4.3 / 2011-12-04 26 | ================== 27 | 28 | * Fixed custom help ordering. Closes #32 29 | 30 | 0.4.2 / 2011-11-24 31 | ================== 32 | 33 | * Added travis support 34 | * Fixed: line-buffered input automatically trimmed. Closes #31 35 | 36 | 0.4.1 / 2011-11-18 37 | ================== 38 | 39 | * Removed listening for "close" on --help 40 | 41 | 0.4.0 / 2011-11-15 42 | ================== 43 | 44 | * Added support for `--`. Closes #24 45 | 46 | 0.3.3 / 2011-11-14 47 | ================== 48 | 49 | * Fixed: wait for close event when writing help info [Jerry Hamlet] 50 | 51 | 0.3.2 / 2011-11-01 52 | ================== 53 | 54 | * Fixed long flag definitions with values [felixge] 55 | 56 | 0.3.1 / 2011-10-31 57 | ================== 58 | 59 | * Changed `--version` short flag to `-V` from `-v` 60 | * Changed `.version()` so it's configurable [felixge] 61 | 62 | 0.3.0 / 2011-10-31 63 | ================== 64 | 65 | * Added support for long flags only. Closes #18 66 | 67 | 0.2.1 / 2011-10-24 68 | ================== 69 | 70 | * "node": ">= 0.4.x < 0.7.0". Closes #20 71 | 72 | 0.2.0 / 2011-09-26 73 | ================== 74 | 75 | * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] 76 | 77 | 0.1.0 / 2011-08-24 78 | ================== 79 | 80 | * Added support for custom `--help` output 81 | 82 | 0.0.5 / 2011-08-18 83 | ================== 84 | 85 | * Changed: when the user enters nothing prompt for password again 86 | * Fixed issue with passwords beginning with numbers [NuckChorris] 87 | 88 | 0.0.4 / 2011-08-15 89 | ================== 90 | 91 | * Fixed `Commander#args` 92 | 93 | 0.0.3 / 2011-08-15 94 | ================== 95 | 96 | * Added default option value support 97 | 98 | 0.0.2 / 2011-08-15 99 | ================== 100 | 101 | * Added mask support to `Command#password(str[, mask], fn)` 102 | * Added `Command#password(str, fn)` 103 | 104 | 0.0.1 / 2010-01-03 105 | ================== 106 | 107 | * Initial release 108 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/hybi-common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns a Buffer from a "ff 00 ff"-type hex string. 3 | */ 4 | 5 | getBufferFromHexString = function(byteStr) { 6 | var bytes = byteStr.split(' '); 7 | var buf = new Buffer(bytes.length); 8 | for (var i = 0; i < bytes.length; ++i) { 9 | buf[i] = parseInt(bytes[i], 16); 10 | } 11 | return buf; 12 | } 13 | 14 | /** 15 | * Returns a hex string from a Buffer. 16 | */ 17 | 18 | getHexStringFromBuffer = function(data) { 19 | var s = ''; 20 | for (var i = 0; i < data.length; ++i) { 21 | s += padl(data[i].toString(16), 2, '0') + ' '; 22 | } 23 | return s.trim(); 24 | } 25 | 26 | /** 27 | * Splits a buffer in two parts. 28 | */ 29 | 30 | splitBuffer = function(buffer) { 31 | var b1 = new Buffer(Math.ceil(buffer.length / 2)); 32 | buffer.copy(b1, 0, 0, b1.length); 33 | var b2 = new Buffer(Math.floor(buffer.length / 2)); 34 | buffer.copy(b2, 0, b1.length, b1.length + b2.length); 35 | return [b1, b2]; 36 | } 37 | 38 | /** 39 | * Performs hybi07+ type masking on a hex string or buffer. 40 | */ 41 | 42 | mask = function(buf, maskString) { 43 | if (typeof buf == 'string') buf = new Buffer(buf); 44 | var mask = getBufferFromHexString(maskString || '34 83 a8 68'); 45 | for (var i = 0; i < buf.length; ++i) { 46 | buf[i] ^= mask[i % 4]; 47 | } 48 | return buf; 49 | } 50 | 51 | /** 52 | * Returns a hex string representing the length of a message 53 | */ 54 | 55 | getHybiLengthAsHexString = function(len, masked) { 56 | if (len < 126) { 57 | var buf = new Buffer(1); 58 | buf[0] = (masked ? 0x80 : 0) | len; 59 | } 60 | else if (len < 65536) { 61 | var buf = new Buffer(3); 62 | buf[0] = (masked ? 0x80 : 0) | 126; 63 | getBufferFromHexString(pack(4, len)).copy(buf, 1); 64 | } 65 | else { 66 | var buf = new Buffer(9); 67 | buf[0] = (masked ? 0x80 : 0) | 127; 68 | getBufferFromHexString(pack(16, len)).copy(buf, 1); 69 | } 70 | return getHexStringFromBuffer(buf); 71 | } 72 | 73 | /** 74 | * Unpacks a Buffer into a number. 75 | */ 76 | 77 | unpack = function(buffer) { 78 | var n = 0; 79 | for (var i = 0; i < buffer.length; ++i) { 80 | n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; 81 | } 82 | return n; 83 | } 84 | 85 | /** 86 | * Returns a hex string, representing a specific byte count 'length', from a number. 87 | */ 88 | 89 | pack = function(length, number) { 90 | return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim(); 91 | } 92 | 93 | /** 94 | * Left pads the string 's' to a total length of 'n' with char 'c'. 95 | */ 96 | 97 | padl = function(s, n, c) { 98 | return new Array(1 + n - s.length).join(c) + s; 99 | } 100 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/debug.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Create a debugger with the given `name`. 4 | * 5 | * @param {String} name 6 | * @return {Type} 7 | * @api public 8 | */ 9 | 10 | function debug(name) { 11 | if (!debug.enabled(name)) return function(){}; 12 | 13 | return function(fmt){ 14 | var curr = new Date; 15 | var ms = curr - (debug[name] || curr); 16 | debug[name] = curr; 17 | 18 | fmt = name 19 | + ' ' 20 | + fmt 21 | + ' +' + debug.humanize(ms); 22 | 23 | // This hackery is required for IE8 24 | // where `console.log` doesn't have 'apply' 25 | window.console 26 | && console.log 27 | && Function.prototype.apply.call(console.log, console, arguments); 28 | } 29 | } 30 | 31 | /** 32 | * The currently active debug mode names. 33 | */ 34 | 35 | debug.names = []; 36 | debug.skips = []; 37 | 38 | /** 39 | * Enables a debug mode by name. This can include modes 40 | * separated by a colon and wildcards. 41 | * 42 | * @param {String} name 43 | * @api public 44 | */ 45 | 46 | debug.enable = function(name) { 47 | localStorage.debug = name; 48 | 49 | var split = (name || '').split(/[\s,]+/) 50 | , len = split.length; 51 | 52 | for (var i = 0; i < len; i++) { 53 | name = split[i].replace('*', '.*?'); 54 | if (name[0] === '-') { 55 | debug.skips.push(new RegExp('^' + name.substr(1) + '$')); 56 | } 57 | else { 58 | debug.names.push(new RegExp('^' + name + '$')); 59 | } 60 | } 61 | }; 62 | 63 | /** 64 | * Disable debug output. 65 | * 66 | * @api public 67 | */ 68 | 69 | debug.disable = function(){ 70 | debug.enable(''); 71 | }; 72 | 73 | /** 74 | * Humanize the given `ms`. 75 | * 76 | * @param {Number} m 77 | * @return {String} 78 | * @api private 79 | */ 80 | 81 | debug.humanize = function(ms) { 82 | var sec = 1000 83 | , min = 60 * 1000 84 | , hour = 60 * min; 85 | 86 | if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; 87 | if (ms >= min) return (ms / min).toFixed(1) + 'm'; 88 | if (ms >= sec) return (ms / sec | 0) + 's'; 89 | return ms + 'ms'; 90 | }; 91 | 92 | /** 93 | * Returns true if the given mode name is enabled, false otherwise. 94 | * 95 | * @param {String} name 96 | * @return {Boolean} 97 | * @api public 98 | */ 99 | 100 | debug.enabled = function(name) { 101 | for (var i = 0, len = debug.skips.length; i < len; i++) { 102 | if (debug.skips[i].test(name)) { 103 | return false; 104 | } 105 | } 106 | for (var i = 0, len = debug.names.length; i < len; i++) { 107 | if (debug.names[i].test(name)) { 108 | return true; 109 | } 110 | } 111 | return false; 112 | }; 113 | 114 | // persist 115 | 116 | if (window.localStorage) debug.enable(localStorage.debug); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/debug.component.js: -------------------------------------------------------------------------------- 1 | ;(function(){ 2 | 3 | /** 4 | * Create a debugger with the given `name`. 5 | * 6 | * @param {String} name 7 | * @return {Type} 8 | * @api public 9 | */ 10 | 11 | function debug(name) { 12 | if (!debug.enabled(name)) return function(){}; 13 | 14 | return function(fmt){ 15 | var curr = new Date; 16 | var ms = curr - (debug[name] || curr); 17 | debug[name] = curr; 18 | 19 | fmt = name 20 | + ' ' 21 | + fmt 22 | + ' +' + debug.humanize(ms); 23 | 24 | // This hackery is required for IE8 25 | // where `console.log` doesn't have 'apply' 26 | window.console 27 | && console.log 28 | && Function.prototype.apply.call(console.log, console, arguments); 29 | } 30 | } 31 | 32 | /** 33 | * The currently active debug mode names. 34 | */ 35 | 36 | debug.names = []; 37 | debug.skips = []; 38 | 39 | /** 40 | * Enables a debug mode by name. This can include modes 41 | * separated by a colon and wildcards. 42 | * 43 | * @param {String} name 44 | * @api public 45 | */ 46 | 47 | debug.enable = function(name) { 48 | localStorage.debug = name; 49 | 50 | var split = (name || '').split(/[\s,]+/) 51 | , len = split.length; 52 | 53 | for (var i = 0; i < len; i++) { 54 | name = split[i].replace('*', '.*?'); 55 | if (name[0] === '-') { 56 | debug.skips.push(new RegExp('^' + name.substr(1) + '$')); 57 | } 58 | else { 59 | debug.names.push(new RegExp('^' + name + '$')); 60 | } 61 | } 62 | }; 63 | 64 | /** 65 | * Disable debug output. 66 | * 67 | * @api public 68 | */ 69 | 70 | debug.disable = function(){ 71 | debug.enable(''); 72 | }; 73 | 74 | /** 75 | * Humanize the given `ms`. 76 | * 77 | * @param {Number} m 78 | * @return {String} 79 | * @api private 80 | */ 81 | 82 | debug.humanize = function(ms) { 83 | var sec = 1000 84 | , min = 60 * 1000 85 | , hour = 60 * min; 86 | 87 | if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; 88 | if (ms >= min) return (ms / min).toFixed(1) + 'm'; 89 | if (ms >= sec) return (ms / sec | 0) + 's'; 90 | return ms + 'ms'; 91 | }; 92 | 93 | /** 94 | * Returns true if the given mode name is enabled, false otherwise. 95 | * 96 | * @param {String} name 97 | * @return {Boolean} 98 | * @api public 99 | */ 100 | 101 | debug.enabled = function(name) { 102 | for (var i = 0, len = debug.skips.length; i < len; i++) { 103 | if (debug.skips[i].test(name)) { 104 | return false; 105 | } 106 | } 107 | for (var i = 0, len = debug.names.length; i < len; i++) { 108 | if (debug.names[i].test(name)) { 109 | return true; 110 | } 111 | } 112 | return false; 113 | }; 114 | 115 | // persist 116 | 117 | if (window.localStorage) debug.enable(localStorage.debug); 118 | module.exports = debug; 119 | 120 | })(); -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/livereload.coffee: -------------------------------------------------------------------------------- 1 | fs = require 'fs' 2 | path = require 'path' 3 | ws = require 'websocket.io' 4 | 5 | version = '1.6' 6 | defaultPort = 35729 7 | 8 | defaultExts = [ 9 | 'html', 'css', 'js', 'png', 'gif', 'jpg', 10 | 'php', 'php5', 'py', 'rb', 'erb' 11 | ] 12 | 13 | defaultExclusions = ['.git/', '.svn/', '.hg/'] 14 | 15 | class Server 16 | constructor: (@config) -> 17 | @config ?= {} 18 | 19 | @config.version ?= version 20 | @config.port ?= defaultPort 21 | 22 | @config.exts ?= [] 23 | @config.exclusions ?= [] 24 | 25 | @config.exts = @config.exts.concat defaultExts 26 | @config.exclusions = @config.exclusions.concat defaultExclusions 27 | 28 | @config.applyJSLive ?= false 29 | @config.applyCSSLive ?= true 30 | 31 | @sockets = [] 32 | 33 | listen: -> 34 | @debug "LiveReload is waiting for browser to connect." 35 | 36 | @server = ws.listen(@config.port) 37 | 38 | @server.on 'connection', @onConnection.bind @ 39 | @server.on 'close', @onClose.bind @ 40 | 41 | 42 | onConnection: (socket) -> 43 | @debug "Browser connected." 44 | socket.send "!!ver:#{@config.version}" 45 | 46 | socket.on 'message', (message) => 47 | @debug "Browser URL: #{message}" 48 | 49 | @sockets.push socket 50 | 51 | onClose: (socket) -> 52 | @debug "Browser disconnected." 53 | 54 | walkTree: (dirname, callback) -> 55 | exts = @config.exts 56 | exclusions = @config.exclusions 57 | 58 | walk = (dirname) -> 59 | fs.readdir dirname, (err, files) -> 60 | if err then return callback err 61 | 62 | files.forEach (file) -> 63 | filename = path.join dirname, file 64 | 65 | for exclusion in exclusions 66 | return if filename.match exclusion 67 | 68 | fs.stat filename, (err, stats) -> 69 | if !err and stats.isDirectory() 70 | walk filename 71 | else 72 | for ext in exts when filename.match "\.#{ext}$" 73 | callback err, filename 74 | break 75 | 76 | walk dirname, callback 77 | 78 | watch: (dirname) -> 79 | @walkTree dirname, (err, filename) => 80 | throw err if err 81 | fs.watchFile filename, (curr, prev) => 82 | if curr.mtime > prev.mtime 83 | @refresh filename 84 | 85 | refresh: (path) -> 86 | @debug "Refresh: #{path}" 87 | data = JSON.stringify ['refresh', 88 | path: path, 89 | apply_js_live: @config.applyJSLive, 90 | apply_css_live: @config.applyCSSLive 91 | ] 92 | 93 | for socket in @sockets 94 | socket.send data 95 | 96 | debug: (str) -> 97 | if @config.debug 98 | console.log "#{str}\n" 99 | 100 | exports.createServer = (args...) -> 101 | server = new Server args... 102 | server.listen() 103 | server 104 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/debug/lib/debug.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var tty = require('tty'); 7 | 8 | /** 9 | * Expose `debug()` as the module. 10 | */ 11 | 12 | module.exports = debug; 13 | 14 | /** 15 | * Enabled debuggers. 16 | */ 17 | 18 | var names = [] 19 | , skips = []; 20 | 21 | (process.env.DEBUG || '') 22 | .split(/[\s,]+/) 23 | .forEach(function(name){ 24 | name = name.replace('*', '.*?'); 25 | if (name[0] === '-') { 26 | skips.push(new RegExp('^' + name.substr(1) + '$')); 27 | } else { 28 | names.push(new RegExp('^' + name + '$')); 29 | } 30 | }); 31 | 32 | /** 33 | * Colors. 34 | */ 35 | 36 | var colors = [6, 2, 3, 4, 5, 1]; 37 | 38 | /** 39 | * Previous debug() call. 40 | */ 41 | 42 | var prev = {}; 43 | 44 | /** 45 | * Previously assigned color. 46 | */ 47 | 48 | var prevColor = 0; 49 | 50 | /** 51 | * Is stdout a TTY? Colored output is disabled when `true`. 52 | */ 53 | 54 | var isatty = tty.isatty(2); 55 | 56 | /** 57 | * Select a color. 58 | * 59 | * @return {Number} 60 | * @api private 61 | */ 62 | 63 | function color() { 64 | return colors[prevColor++ % colors.length]; 65 | } 66 | 67 | /** 68 | * Humanize the given `ms`. 69 | * 70 | * @param {Number} m 71 | * @return {String} 72 | * @api private 73 | */ 74 | 75 | function humanize(ms) { 76 | var sec = 1000 77 | , min = 60 * 1000 78 | , hour = 60 * min; 79 | 80 | if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; 81 | if (ms >= min) return (ms / min).toFixed(1) + 'm'; 82 | if (ms >= sec) return (ms / sec | 0) + 's'; 83 | return ms + 'ms'; 84 | } 85 | 86 | /** 87 | * Create a debugger with the given `name`. 88 | * 89 | * @param {String} name 90 | * @return {Type} 91 | * @api public 92 | */ 93 | 94 | function debug(name) { 95 | function disabled(){} 96 | disabled.enabled = false; 97 | 98 | var match = skips.some(function(re){ 99 | return re.test(name); 100 | }); 101 | 102 | if (match) return disabled; 103 | 104 | match = names.some(function(re){ 105 | return re.test(name); 106 | }); 107 | 108 | if (!match) return disabled; 109 | var c = color(); 110 | 111 | function colored(fmt) { 112 | var curr = new Date; 113 | var ms = curr - (prev[name] || curr); 114 | prev[name] = curr; 115 | 116 | fmt = ' \033[9' + c + 'm' + name + ' ' 117 | + '\033[3' + c + 'm\033[90m' 118 | + fmt + '\033[3' + c + 'm' 119 | + ' +' + humanize(ms) + '\033[0m'; 120 | 121 | console.error.apply(this, arguments); 122 | } 123 | 124 | function plain(fmt) { 125 | fmt = new Date().toUTCString() 126 | + ' ' + name + ' ' + fmt; 127 | console.error.apply(this, arguments); 128 | } 129 | 130 | colored.enabled = plain.enabled = true; 131 | 132 | return isatty 133 | ? colored 134 | : plain; 135 | } 136 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/lib/socket.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var EventEmitter = process.EventEmitter 7 | 8 | /** 9 | * Module exports. 10 | */ 11 | 12 | module.exports = Socket; 13 | 14 | /** 15 | * Abtract Socket class. 16 | * 17 | * @param {http.Request} the node.js http Request 18 | * @api private 19 | */ 20 | 21 | function Socket (req) { 22 | this.req = req; 23 | this.socket = req.socket; 24 | this.readyState = 'opening'; 25 | 26 | var self = this; 27 | this.socket 28 | .on('error', function (e) { 29 | self.emit('error', e); 30 | self.destroy(); 31 | }) 32 | .on('end', function () { 33 | self.close(); 34 | }) 35 | .on('close', function () { 36 | self.onClose(); 37 | }) 38 | .on('timeout', function() { 39 | self.destroy(); 40 | }) 41 | 42 | this.onOpen(); 43 | } 44 | 45 | /** 46 | * Inherits from EventEmitter. 47 | */ 48 | 49 | Socket.prototype.__proto__ = EventEmitter.prototype; 50 | 51 | /** 52 | * Request that originated the connection. 53 | * 54 | * @api public 55 | */ 56 | 57 | Socket.prototype.req; 58 | 59 | /** 60 | * Stream that originated the connection. 61 | * 62 | * @api public 63 | */ 64 | 65 | Socket.prototype.socket; 66 | 67 | /** 68 | * Called upon socket close. 69 | * 70 | * @return {Socket} for chaining. 71 | * @api private 72 | */ 73 | 74 | Socket.prototype.onClose = function () { 75 | if ('closed' != this.readyState) { 76 | this.socket.destroy(); 77 | this.readyState = 'closed'; 78 | this.emit('close'); 79 | } 80 | 81 | return this; 82 | }; 83 | 84 | /** 85 | * Handles a message. 86 | * 87 | * @param {String} message 88 | * @return {Socket} for chaining 89 | * @api public 90 | */ 91 | 92 | Socket.prototype.onMessage = function (msg) { 93 | this.emit('message', msg); 94 | this.emit('data', msg); 95 | return this; 96 | }; 97 | 98 | /** 99 | * Writes to the socket. 100 | * 101 | * @return {Socket} for chaining 102 | * @api public 103 | */ 104 | 105 | Socket.prototype.send = function (data) { 106 | this.write(data); 107 | return this; 108 | }; 109 | 110 | /** 111 | * Closes the connection. 112 | * 113 | * @api public 114 | */ 115 | 116 | Socket.prototype.close = Socket.prototype.end = function () { 117 | if ('open' == this.readyState) { 118 | this.socket.end(); 119 | var self = this; 120 | process.nextTick(function () { 121 | // wait for 'end' packet from client 122 | self.onClose(); 123 | }); 124 | } else { 125 | this.onClose(); 126 | } 127 | return this; 128 | }; 129 | 130 | /** 131 | * Destroys the connection. 132 | * 133 | * @api public 134 | */ 135 | 136 | Socket.prototype.destroy = function () { 137 | if ('closed' != this.readyState) { 138 | this.socket.destroy(); 139 | this.onClose(); 140 | } 141 | return this; 142 | }; 143 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/bench/util.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Returns a Buffer from a "ff 00 ff"-type hex string. 9 | */ 10 | 11 | getBufferFromHexString = function(byteStr) { 12 | var bytes = byteStr.split(' '); 13 | var buf = new Buffer(bytes.length); 14 | for (var i = 0; i < bytes.length; ++i) { 15 | buf[i] = parseInt(bytes[i], 16); 16 | } 17 | return buf; 18 | } 19 | 20 | /** 21 | * Returns a hex string from a Buffer. 22 | */ 23 | 24 | getHexStringFromBuffer = function(data) { 25 | var s = ''; 26 | for (var i = 0; i < data.length; ++i) { 27 | s += padl(data[i].toString(16), 2, '0') + ' '; 28 | } 29 | return s.trim(); 30 | } 31 | 32 | /** 33 | * Splits a buffer in two parts. 34 | */ 35 | 36 | splitBuffer = function(buffer) { 37 | var b1 = new Buffer(Math.ceil(buffer.length / 2)); 38 | buffer.copy(b1, 0, 0, b1.length); 39 | var b2 = new Buffer(Math.floor(buffer.length / 2)); 40 | buffer.copy(b2, 0, b1.length, b1.length + b2.length); 41 | return [b1, b2]; 42 | } 43 | 44 | /** 45 | * Performs hybi07+ type masking on a hex string or buffer. 46 | */ 47 | 48 | mask = function(buf, maskString) { 49 | if (typeof buf == 'string') buf = new Buffer(buf); 50 | var mask = getBufferFromHexString(maskString || '34 83 a8 68'); 51 | for (var i = 0; i < buf.length; ++i) { 52 | buf[i] ^= mask[i % 4]; 53 | } 54 | return buf; 55 | } 56 | 57 | /** 58 | * Returns a hex string representing the length of a message 59 | */ 60 | 61 | getHybiLengthAsHexString = function(len, masked) { 62 | if (len < 126) { 63 | var buf = new Buffer(1); 64 | buf[0] = (masked ? 0x80 : 0) | len; 65 | } 66 | else if (len < 65536) { 67 | var buf = new Buffer(3); 68 | buf[0] = (masked ? 0x80 : 0) | 126; 69 | getBufferFromHexString(pack(4, len)).copy(buf, 1); 70 | } 71 | else { 72 | var buf = new Buffer(9); 73 | buf[0] = (masked ? 0x80 : 0) | 127; 74 | getBufferFromHexString(pack(16, len)).copy(buf, 1); 75 | } 76 | return getHexStringFromBuffer(buf); 77 | } 78 | 79 | /** 80 | * Unpacks a Buffer into a number. 81 | */ 82 | 83 | unpack = function(buffer) { 84 | var n = 0; 85 | for (var i = 0; i < buffer.length; ++i) { 86 | n = (i == 0) ? buffer[i] : (n * 256) + buffer[i]; 87 | } 88 | return n; 89 | } 90 | 91 | /** 92 | * Returns a hex string, representing a specific byte count 'length', from a number. 93 | */ 94 | 95 | pack = function(length, number) { 96 | return padl(number.toString(16), length, '0').replace(/([0-9a-f][0-9a-f])/gi, '$1 ').trim(); 97 | } 98 | 99 | /** 100 | * Left pads the string 's' to a total length of 'n' with char 'c'. 101 | */ 102 | 103 | padl = function(s, n, c) { 104 | return new Array(1 + n - s.length).join(c) + s; 105 | } 106 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/Sender.hixie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var events = require('events') 8 | , util = require('util') 9 | , EventEmitter = events.EventEmitter; 10 | 11 | /** 12 | * Hixie Sender implementation 13 | */ 14 | 15 | function Sender(socket) { 16 | this.socket = socket; 17 | this.continuationFrame = false; 18 | this.isClosed = false; 19 | } 20 | 21 | module.exports = Sender; 22 | 23 | /** 24 | * Inherits from EventEmitter. 25 | */ 26 | 27 | util.inherits(Sender, events.EventEmitter); 28 | 29 | /** 30 | * Frames and writes data. 31 | * 32 | * @api public 33 | */ 34 | 35 | Sender.prototype.send = function(data, options, cb) { 36 | if (this.isClosed) return; 37 | if (options && options.binary) { 38 | this.error('hixie websockets do not support binary'); 39 | return; 40 | } 41 | 42 | var isString = typeof data == 'string' 43 | , length = isString ? Buffer.byteLength(data) : data.length 44 | , writeStartMarker = this.continuationFrame == false 45 | , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) 46 | , buffer = new Buffer((writeStartMarker ? 1 : 0) + length + (writeEndMarker ? 1 : 0)) 47 | , offset = writeStartMarker ? 1 : 0; 48 | 49 | if (writeStartMarker) buffer.write('\x00', 'binary'); 50 | 51 | if (isString) buffer.write(data, offset, 'utf8'); 52 | else data.copy(buffer, offset, 0); 53 | 54 | if (writeEndMarker) { 55 | buffer.write('\xff', offset + length, 'binary'); 56 | this.continuationFrame = false; 57 | } 58 | else this.continuationFrame = true; 59 | 60 | try { 61 | this.socket.write(buffer, 'binary', cb); 62 | } catch (e) { 63 | this.error(e.toString()); 64 | } 65 | } 66 | 67 | /** 68 | * Sends a close instruction to the remote party. 69 | * 70 | * @api public 71 | */ 72 | 73 | Sender.prototype.close = function(code, data, mask, cb) { 74 | if (this.isClosed) return; 75 | this.isClosed = true; 76 | try { 77 | if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); 78 | this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); 79 | } catch (e) { 80 | this.error(e.toString()); 81 | } 82 | } 83 | 84 | /** 85 | * Sends a ping message to the remote party. Not available for hixie. 86 | * 87 | * @api public 88 | */ 89 | 90 | Sender.prototype.ping = function(data, options) {} 91 | 92 | /** 93 | * Sends a pong message to the remote party. Not available for hixie. 94 | * 95 | * @api public 96 | */ 97 | 98 | Sender.prototype.pong = function(data, options) {} 99 | 100 | /** 101 | * Handles an error 102 | * 103 | * @api private 104 | */ 105 | 106 | Sender.prototype.error = function (reason) { 107 | this.emit('error', reason); 108 | return this; 109 | } 110 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Require.JS - LICENSE.txt: -------------------------------------------------------------------------------- 1 | RequireJS is released under two licenses: new BSD, and MIT. You may pick the 2 | license that best suits your development needs. The text of both licenses are 3 | provided below. 4 | 5 | 6 | The "New" BSD License: 7 | ---------------------- 8 | 9 | Copyright (c) 2010-2011, The Dojo Foundation 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, this 16 | list of conditions and the following disclaimer. 17 | * Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | * Neither the name of the Dojo Foundation nor the names of its contributors 21 | may be used to endorse or promote products derived from this software 22 | without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 25 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 28 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | 35 | 36 | 37 | MIT License 38 | ----------- 39 | 40 | Copyright (c) 2010-2011, The Dojo Foundation 41 | 42 | Permission is hereby granted, free of charge, to any person obtaining a copy 43 | of this software and associated documentation files (the "Software"), to deal 44 | in the Software without restriction, including without limitation the rights 45 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 46 | copies of the Software, and to permit persons to whom the Software is 47 | furnished to do so, subject to the following conditions: 48 | 49 | The above copyright notice and this permission notice shall be included in 50 | all copies or substantial portions of the Software. 51 | 52 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 53 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 54 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 55 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 56 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 57 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 58 | THE SOFTWARE. 59 | -------------------------------------------------------------------------------- /src/Candidate.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Candidate.Nancy.Selfhosted", "Candidate.Nancy.Selfhosted\Candidate.Nancy.Selfhosted.csproj", "{53D8D784-BEB4-499B-B6BD-1D7407F547F6}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{68C5AF6D-0F5D-4639-A062-20E0248BA929}" 7 | ProjectSection(SolutionItems) = preProject 8 | .nuget\NuGet.Config = .nuget\NuGet.Config 9 | .nuget\nuget.exe = .nuget\nuget.exe 10 | .nuget\NuGet.targets = .nuget\NuGet.targets 11 | EndProjectSection 12 | EndProject 13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Candidate.Core", "Candidate.Core\Candidate.Core.csproj", "{C72F8BE6-9149-488B-B284-784469665B66}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|Mixed Platforms = Debug|Mixed Platforms 19 | Debug|x86 = Debug|x86 20 | Release|Any CPU = Release|Any CPU 21 | Release|Mixed Platforms = Release|Mixed Platforms 22 | Release|x86 = Release|x86 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Debug|Any CPU.ActiveCfg = Debug|x86 26 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 27 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Debug|Mixed Platforms.Build.0 = Debug|x86 28 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Debug|x86.ActiveCfg = Debug|x86 29 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Debug|x86.Build.0 = Debug|x86 30 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Release|Any CPU.ActiveCfg = Release|x86 31 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Release|Mixed Platforms.ActiveCfg = Release|x86 32 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Release|Mixed Platforms.Build.0 = Release|x86 33 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Release|x86.ActiveCfg = Release|x86 34 | {53D8D784-BEB4-499B-B6BD-1D7407F547F6}.Release|x86.Build.0 = Release|x86 35 | {C72F8BE6-9149-488B-B284-784469665B66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {C72F8BE6-9149-488B-B284-784469665B66}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {C72F8BE6-9149-488B-B284-784469665B66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 38 | {C72F8BE6-9149-488B-B284-784469665B66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 39 | {C72F8BE6-9149-488B-B284-784469665B66}.Debug|x86.ActiveCfg = Debug|Any CPU 40 | {C72F8BE6-9149-488B-B284-784469665B66}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {C72F8BE6-9149-488B-B284-784469665B66}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {C72F8BE6-9149-488B-B284-784469665B66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 43 | {C72F8BE6-9149-488B-B284-784469665B66}.Release|Mixed Platforms.Build.0 = Release|Any CPU 44 | {C72F8BE6-9149-488B-B284-784469665B66}.Release|x86.ActiveCfg = Release|Any CPU 45 | EndGlobalSection 46 | GlobalSection(SolutionProperties) = preSolution 47 | HideSolutionNode = FALSE 48 | EndGlobalSection 49 | EndGlobal 50 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/lib/server.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Module dependencies. 4 | */ 5 | 6 | var protocols = require('./protocols') 7 | , EventEmitter = process.EventEmitter 8 | , url = require('url'); 9 | 10 | /** 11 | * Module exports. 12 | */ 13 | 14 | module.exports = Server; 15 | 16 | /** 17 | * Constructor. HTTP Server agnostic. 18 | * 19 | * @param {Object} options 20 | * @api public 21 | */ 22 | 23 | function Server (options) { 24 | this.options = { 25 | path: null 26 | , clientTracking: true 27 | }; 28 | 29 | for (var i in options) { 30 | this.options[i] = options[i]; 31 | } 32 | 33 | this.clients = []; 34 | this.clientsCount = 0; 35 | this.clientsNull = []; 36 | } 37 | 38 | /** 39 | * Inherits from EventEmitter. 40 | */ 41 | 42 | Server.prototype.__proto__ = EventEmitter.prototype; 43 | 44 | /** 45 | * Handles a Request after `upgrade` event. 46 | * 47 | * @param {http.Request} request object 48 | * @param {http.Stream} socket 49 | * @param {Buffer} data stream head 50 | * @return {Server} for chaining. 51 | * @api public 52 | */ 53 | 54 | Server.prototype.handleUpgrade = function (req, socket, head) { 55 | var self = this; 56 | 57 | if (! this.checkRequest(req)) { 58 | return this; 59 | } 60 | 61 | // attach the legacy `head` property to request 62 | req.head = head; 63 | 64 | var client = this.createClient(req); 65 | 66 | client.on('open', function() { 67 | if (self.options.clientTracking) { 68 | var i = null; 69 | if (self.clientsNull.length) { 70 | i = self.clientsNull.shift(); 71 | self.clients[i] = client; 72 | } 73 | else { 74 | i = self.clients.length; 75 | self.clients.push(client); 76 | } 77 | self.clientsCount++; 78 | client.on('close', function () { 79 | self.clients[i] = null; 80 | self.clientsNull.push(i); 81 | self.clientsCount--; 82 | }); 83 | } 84 | self.emit('connection', client); 85 | }); 86 | 87 | return this; 88 | }; 89 | 90 | /** 91 | * Checks whether the request path matches. 92 | * 93 | * @return {Bool} 94 | * @api private 95 | */ 96 | 97 | Server.prototype.checkRequest = function (req) { 98 | if (!(req.method == 'GET' && 99 | req.headers['upgrade'] && 100 | req.headers.upgrade.toLowerCase() == 'websocket')) { 101 | // not a valid WebSocket upgrade 102 | return false; 103 | } 104 | 105 | if (this.options.path) { 106 | var u = url.parse(req.url); 107 | if (u && u.pathname !== this.options.path) return false; 108 | } 109 | 110 | // no options.path => match all paths 111 | return true; 112 | }; 113 | 114 | /** 115 | * Initializes a client for the request with appropriate protocol. 116 | * 117 | * @param {http.Request} request object 118 | * @api private 119 | */ 120 | 121 | Server.prototype.createClient = function (req) { 122 | var version = req.headers['sec-websocket-version'] 123 | , name = protocols[version] ? version : 'drafts' 124 | 125 | return new protocols[name](req); 126 | }; 127 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/bench/speed.js: -------------------------------------------------------------------------------- 1 | var cluster = require('cluster') 2 | , WebSocket = require('../') 3 | , WebSocketServer = WebSocket.Server 4 | , crypto = require('crypto') 5 | , util = require('util') 6 | , ansi = require('ansi'); 7 | require('tinycolor'); 8 | 9 | function roundPrec(num, prec) { 10 | var mul = Math.pow(10, prec); 11 | return Math.round(num * mul) / mul; 12 | } 13 | 14 | function humanSize(bytes) { 15 | if (bytes >= 1048576) return roundPrec(bytes / 1048576, 2) + ' MB'; 16 | if (bytes >= 1024) return roundPrec(bytes / 1024, 2) + ' kB'; 17 | return roundPrec(bytes, 2) + ' B'; 18 | } 19 | 20 | function generateRandomData(size) { 21 | var buffer = new Buffer(size); 22 | for (var i = 0; i < size; ++i) { 23 | buffer[i] = ~~(Math.random() * 127); 24 | } 25 | return buffer; 26 | } 27 | 28 | if (cluster.isMaster) { 29 | var wss = new WebSocketServer({port: 8181}, function() { 30 | cluster.fork(); 31 | }); 32 | wss.on('connection', function(ws) { 33 | ws.on('message', function(data, flags) { 34 | ws.send(data, {binary: flags&&flags.binary}); 35 | }); 36 | ws.on('close', function() {}); 37 | }); 38 | cluster.on('death', function(worker) { 39 | wss.close(); 40 | }); 41 | } 42 | else { 43 | var cursor = ansi(process.stdout); 44 | 45 | var configs = [ 46 | [true, 10000, 64], 47 | [true, 5000, 16*1024], 48 | [true, 1000, 128*1024], 49 | [true, 100, 1024*1024], 50 | [true, 1, 500*1024*1024], 51 | [false, 10000, 64], 52 | [false, 5000, 16*1024], 53 | [false, 1000, 128*1024], 54 | [false, 100, 1024*1024], 55 | ]; 56 | 57 | var largest = configs[0][1]; 58 | for (var i = 0, l = configs.length; i < l; ++i) { 59 | if (configs[i][2] > largest) largest = configs[i][2]; 60 | } 61 | 62 | console.log('Generating %s of test data ...', humanSize(largest)); 63 | var randomBytes = generateRandomData(largest); 64 | 65 | function roundtrip(useBinary, roundtrips, size, cb) { 66 | var data = randomBytes.slice(0, size); 67 | var prefix = util.format('Running %d roundtrips of %s %s data', roundtrips, humanSize(size), useBinary ? 'binary' : 'text'); 68 | console.log(prefix); 69 | var client = new WebSocket('ws://localhost:' + '8181'); 70 | var dt; 71 | var roundtrip = 0; 72 | function send() { 73 | client.send(data, {binary: useBinary}); 74 | } 75 | client.on('error', function(e) { 76 | console.error(e); 77 | process.exit(); 78 | }); 79 | client.on('open', function() { 80 | dt = Date.now(); 81 | send(); 82 | }); 83 | client.on('message', function(data, flags) { 84 | if (++roundtrip == roundtrips) { 85 | var elapsed = Date.now() - dt; 86 | cursor.up(); 87 | console.log('%s:\t%ss\t%s' 88 | , useBinary ? prefix.green : prefix.cyan 89 | , roundPrec(elapsed / 1000, 1).toString().green.bold 90 | , (humanSize((size * roundtrips) / elapsed * 1000) + '/s').blue.bold); 91 | client.close(); 92 | cb(); 93 | return; 94 | } 95 | process.nextTick(send); 96 | }); 97 | } 98 | 99 | (function run() { 100 | if (configs.length == 0) process.exit(); 101 | var config = configs.shift(); 102 | config.push(run); 103 | roundtrip.apply(null, config); 104 | })(); 105 | } -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/lib/Receiver.hixie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | var util = require('util'); 8 | 9 | /** 10 | * State constants 11 | */ 12 | 13 | var EMPTY = 0 14 | , BODY = 1; 15 | 16 | /** 17 | * Hixie Receiver implementation 18 | */ 19 | 20 | function Receiver () { 21 | this.state = EMPTY; 22 | this.buffers = []; 23 | this.messageEnd = -1; 24 | this.spanLength = 0; 25 | this.dead = false; 26 | 27 | this.onerror = function() {}; 28 | this.ontext = function() {}; 29 | this.onbinary = function() {}; 30 | this.onclose = function() {}; 31 | this.onping = function() {}; 32 | this.onpong = function() {}; 33 | } 34 | 35 | module.exports = Receiver; 36 | 37 | /** 38 | * Add new data to the parser. 39 | * 40 | * @api public 41 | */ 42 | 43 | Receiver.prototype.add = function(data) { 44 | var self = this; 45 | function doAdd() { 46 | if (self.state === EMPTY) { 47 | if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { 48 | self.reset(); 49 | self.onclose(); 50 | return; 51 | } 52 | if (data[0] !== 0x00) { 53 | self.error('payload must start with 0x00 byte', true); 54 | return; 55 | } 56 | data = data.slice(1); 57 | self.state = BODY; 58 | } 59 | self.buffers.push(data); 60 | if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { 61 | self.spanLength += self.messageEnd; 62 | return self.parse(); 63 | } 64 | else self.spanLength += data.length; 65 | } 66 | while(data) data = doAdd(); 67 | } 68 | 69 | /** 70 | * Releases all resources used by the receiver. 71 | * 72 | * @api public 73 | */ 74 | 75 | Receiver.prototype.cleanup = function() { 76 | this.dead = true; 77 | this.state = EMPTY; 78 | this.buffers = []; 79 | } 80 | 81 | /** 82 | * Process buffered data. 83 | * 84 | * @api public 85 | */ 86 | 87 | Receiver.prototype.parse = function() { 88 | var output = new Buffer(this.spanLength); 89 | var outputIndex = 0; 90 | for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { 91 | var buffer = this.buffers[bi]; 92 | buffer.copy(output, outputIndex); 93 | outputIndex += buffer.length; 94 | } 95 | var lastBuffer = this.buffers[this.buffers.length - 1]; 96 | if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); 97 | var tail = null; 98 | if (this.messageEnd < lastBuffer.length - 1) { 99 | tail = lastBuffer.slice(this.messageEnd + 1); 100 | } 101 | this.reset(); 102 | this.ontext(output.toString('utf8')); 103 | return tail; 104 | } 105 | 106 | /** 107 | * Handles an error 108 | * 109 | * @api private 110 | */ 111 | 112 | Receiver.prototype.error = function (reason, terminate) { 113 | this.reset(); 114 | this.onerror(reason, terminate); 115 | return this; 116 | } 117 | 118 | /** 119 | * Reset parser state 120 | * 121 | * @api private 122 | */ 123 | 124 | Receiver.prototype.reset = function (reason) { 125 | if (this.dead) return; 126 | this.state = EMPTY; 127 | this.buffers = []; 128 | this.messageEnd = -1; 129 | this.spanLength = 0; 130 | } 131 | 132 | /** 133 | * Internal api 134 | */ 135 | 136 | function bufferIndex(buffer, byte) { 137 | for (var i = 0, l = buffer.length; i < l; ++i) { 138 | if (buffer[i] === byte) return i; 139 | } 140 | return -1; 141 | } 142 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/fixtures/textfile: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam egestas, massa at aliquam luctus, sapien erat viverra elit, nec pulvinar turpis eros sagittis urna. Pellentesque imperdiet tempor varius. Pellentesque blandit, ipsum in imperdiet venenatis, mi elit faucibus odio, id condimentum ante enim sed lectus. Aliquam et odio non odio pellentesque pulvinar. Vestibulum a erat dolor. Integer pretium risus sit amet nisl volutpat nec venenatis magna egestas. Ut bibendum felis eu tellus laoreet eleifend. Nam pulvinar auctor tortor, eu iaculis leo vestibulum quis. In euismod risus ac purus vehicula et fermentum ligula consectetur. Vivamus condimentum tempus lacinia. 2 | 3 | Curabitur sodales condimentum urna id dictum. Sed quis justo sit amet quam ultrices tincidunt vel laoreet nulla. Nullam quis ipsum sed nisi mollis bibendum at sit amet nisi. Donec laoreet consequat velit sit amet mollis. Nam sed sapien a massa iaculis dapibus. Sed dui nunc, ultricies et pellentesque ullamcorper, aliquet vitae ligula. Integer eu velit in neque iaculis venenatis. Ut rhoncus cursus est, ac dignissim leo vehicula a. Nulla ullamcorper vulputate mauris id blandit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque eleifend, nisi a tempor sollicitudin, odio massa pretium urna, quis congue sapien elit at tortor. Curabitur ipsum orci, vehicula non commodo molestie, laoreet id enim. Pellentesque convallis ultrices congue. Pellentesque nec iaculis lorem. In sagittis pharetra ipsum eget sodales. 4 | 5 | Fusce id nulla odio. Nunc nibh justo, placerat vel tincidunt sed, ornare et enim. Nulla vel urna vel ante commodo bibendum in vitae metus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis erat nunc, semper eget sagittis sit amet, ullamcorper eget lacus. Donec hendrerit ipsum vitae eros vestibulum eu gravida neque tincidunt. Ut molestie lacinia nulla. Donec mattis odio at magna egestas at pellentesque eros accumsan. Praesent interdum sem sit amet nibh commodo dignissim. Duis laoreet, enim ultricies fringilla suscipit, enim libero cursus nulla, sollicitudin adipiscing erat velit ut dui. Nulla eleifend mauris at velit fringilla a molestie lorem venenatis. 6 | 7 | Donec sit amet scelerisque metus. Cras ac felis a nulla venenatis vulputate. Duis porttitor eros ac neque rhoncus eget aliquet neque egestas. Quisque sed nunc est, vitae dapibus quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In vehicula, est vitae posuere ultricies, diam purus pretium sapien, nec rhoncus dolor nisl eget arcu. Aliquam et nisi vitae risus tincidunt auctor. In vehicula, erat a cursus adipiscing, lorem orci congue est, nec ultricies elit dui in nunc. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 8 | 9 | Duis congue tempus elit sit amet auctor. Duis dignissim, risus ut sollicitudin ultricies, dolor ligula gravida odio, nec congue orci purus ut ligula. Fusce pretium dictum lectus at volutpat. Sed non auctor mauris. Etiam placerat vestibulum massa id blandit. Quisque consequat lacus ut nulla euismod facilisis. Sed aliquet ipsum nec mi imperdiet viverra. Pellentesque ullamcorper, lectus nec varius gravida, odio justo cursus risus, eu sagittis metus arcu quis felis. Phasellus consectetur vehicula libero, at condimentum orci euismod vel. Nunc purus tortor, suscipit nec fringilla nec, vulputate et nibh. Nam porta vehicula neque. Praesent porttitor, sapien eu auctor euismod, arcu quam elementum urna, sed hendrerit magna augue sed quam. -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/bench/parser.benchmark.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | /** 8 | * Benchmark dependencies. 9 | */ 10 | 11 | var benchmark = require('benchmark') 12 | , Receiver = require('../').Receiver 13 | , suite = new benchmark.Suite('Receiver'); 14 | require('tinycolor'); 15 | require('./util'); 16 | 17 | /** 18 | * Setup receiver. 19 | */ 20 | 21 | suite.on('start', function () { 22 | receiver = new Receiver(); 23 | }); 24 | 25 | suite.on('cycle', function () { 26 | receiver = new Receiver(); 27 | }); 28 | 29 | /** 30 | * Benchmarks. 31 | */ 32 | 33 | var pingMessage = 'Hello' 34 | , pingPacket1 = getBufferFromHexString('89 ' + (pack(2, 0x80 | pingMessage.length)) + 35 | ' 34 83 a8 68 '+ getHexStringFromBuffer(mask(pingMessage, '34 83 a8 68'))); 36 | suite.add('ping message', function () { 37 | receiver.add(pingPacket1); 38 | }); 39 | 40 | var pingPacket2 = getBufferFromHexString('89 00') 41 | suite.add('ping with no data', function () { 42 | receiver.add(pingPacket2); 43 | }); 44 | 45 | var closePacket = getBufferFromHexString('88 00'); 46 | suite.add('close message', function () { 47 | receiver.add(closePacket); 48 | receiver.endPacket(); 49 | }); 50 | 51 | var maskedTextPacket = getBufferFromHexString('81 93 34 83 a8 68 01 b9 92 52 4f a1 c6 09 59 e6 8a 52 16 e6 cb 00 5b a1 d5'); 52 | suite.add('masked text message', function () { 53 | receiver.add(maskedTextPacket); 54 | }); 55 | 56 | binaryDataPacket = (function() { 57 | var length = 125 58 | , message = new Buffer(length) 59 | for (var i = 0; i < length; ++i) message[i] = i % 10; 60 | return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' 61 | + getHexStringFromBuffer(mask(message), '34 83 a8 68')); 62 | })(); 63 | suite.add('binary data (125 bytes)', function () { 64 | try { 65 | receiver.add(binaryDataPacket); 66 | 67 | } 68 | catch(e) {console.log(e)} 69 | }); 70 | 71 | binaryDataPacket2 = (function() { 72 | var length = 65535 73 | , message = new Buffer(length) 74 | for (var i = 0; i < length; ++i) message[i] = i % 10; 75 | return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' 76 | + getHexStringFromBuffer(mask(message), '34 83 a8 68')); 77 | })(); 78 | suite.add('binary data (65535 bytes)', function () { 79 | receiver.add(binaryDataPacket2); 80 | }); 81 | 82 | binaryDataPacket3 = (function() { 83 | var length = 200*1024 84 | , message = new Buffer(length) 85 | for (var i = 0; i < length; ++i) message[i] = i % 10; 86 | return getBufferFromHexString('82 ' + getHybiLengthAsHexString(length, true) + ' 34 83 a8 68 ' 87 | + getHexStringFromBuffer(mask(message), '34 83 a8 68')); 88 | })(); 89 | suite.add('binary data (200 kB)', function () { 90 | receiver.add(binaryDataPacket3); 91 | }); 92 | 93 | /** 94 | * Output progress. 95 | */ 96 | 97 | suite.on('cycle', function (bench, details) { 98 | console.log('\n ' + suite.name.grey, details.name.white.bold); 99 | console.log(' ' + [ 100 | details.hz.toFixed(2).cyan + ' ops/sec'.grey 101 | , details.count.toString().white + ' times executed'.grey 102 | , 'benchmark took '.grey + details.times.elapsed.toString().white + ' sec.'.grey 103 | , 104 | ].join(', '.grey)); 105 | }); 106 | 107 | /** 108 | * Run/export benchmarks. 109 | */ 110 | 111 | if (!module.parent) { 112 | suite.run(); 113 | } else { 114 | module.exports = suite; 115 | } 116 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/Receiver.hixie.test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert') 2 | , expect = require('expect.js') 3 | , Receiver = require('../lib/Receiver.hixie'); 4 | require('./hybi-common'); 5 | 6 | describe('Receiver', function() { 7 | it('can parse text message', function() { 8 | var p = new Receiver(); 9 | var packet = '00 48 65 6c 6c 6f ff'; 10 | 11 | var gotData = false; 12 | p.ontext = function(data) { 13 | gotData = true; 14 | assert.equal('Hello', data); 15 | }; 16 | 17 | p.add(getBufferFromHexString(packet)); 18 | expect(gotData).to.equal(true); 19 | }); 20 | 21 | it('can parse multiple text messages', function() { 22 | var p = new Receiver(); 23 | var packet = '00 48 65 6c 6c 6f ff 00 48 65 6c 6c 6f ff'; 24 | 25 | var gotData = false; 26 | var messages = []; 27 | p.ontext = function(data) { 28 | gotData = true; 29 | messages.push(data); 30 | }; 31 | 32 | p.add(getBufferFromHexString(packet)); 33 | expect(gotData).to.equal(true); 34 | for (var i = 0; i < 2; ++i) { 35 | expect(messages[i]).to.equal('Hello'); 36 | } 37 | }); 38 | 39 | it('can parse empty message', function() { 40 | var p = new Receiver(); 41 | var packet = '00 ff'; 42 | 43 | var gotData = false; 44 | p.ontext = function(data) { 45 | gotData = true; 46 | assert.equal('', data); 47 | }; 48 | 49 | p.add(getBufferFromHexString(packet)); 50 | expect(gotData).to.equal(true); 51 | }); 52 | 53 | it('can parse text messages delivered over multiple frames', function() { 54 | var p = new Receiver(); 55 | var packets = [ 56 | '00 48', 57 | '65 6c 6c', 58 | '6f ff 00 48', 59 | '65', 60 | '6c 6c 6f', 61 | 'ff' 62 | ]; 63 | 64 | var gotData = false; 65 | var messages = []; 66 | p.ontext = function(data) { 67 | gotData = true; 68 | messages.push(data); 69 | }; 70 | 71 | for (var i = 0; i < packets.length; ++i) { 72 | p.add(getBufferFromHexString(packets[i])); 73 | } 74 | expect(gotData).to.equal(true); 75 | for (var i = 0; i < 2; ++i) { 76 | expect(messages[i]).to.equal('Hello'); 77 | } 78 | }); 79 | 80 | it('emits an error if a payload doesnt start with 0x00', function() { 81 | var p = new Receiver(); 82 | var packets = [ 83 | '00 6c ff', 84 | '00 6c ff ff', 85 | 'ff 00 6c ff 00 6c ff', 86 | '00', 87 | '6c 6c 6f', 88 | 'ff' 89 | ]; 90 | 91 | var gotData = false; 92 | var gotError = false; 93 | var messages = []; 94 | p.ontext = function(data) { 95 | gotData = true; 96 | messages.push(data); 97 | }; 98 | p.onerror = function(reason, code) { 99 | gotError = code == true; 100 | }; 101 | 102 | for (var i = 0; i < packets.length && !gotError; ++i) { 103 | p.add(getBufferFromHexString(packets[i])); 104 | } 105 | expect(gotError).to.equal(true); 106 | expect(messages[0]).to.equal('l'); 107 | expect(messages[1]).to.equal('l'); 108 | expect(messages.length).to.equal(2); 109 | }); 110 | 111 | it('can parse close messages', function() { 112 | var p = new Receiver(); 113 | var packets = [ 114 | 'ff 00' 115 | ]; 116 | 117 | var gotClose = false; 118 | var gotError = false; 119 | p.onclose = function() { 120 | gotClose = true; 121 | }; 122 | p.onerror = function(reason, code) { 123 | gotError = code == true; 124 | }; 125 | 126 | for (var i = 0; i < packets.length && !gotError; ++i) { 127 | p.add(getBufferFromHexString(packets[i])); 128 | } 129 | expect(gotClose).to.equal(true); 130 | expect(gotError).to.equal(false); 131 | }); 132 | }); 133 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/examples/fileapi/server.js: -------------------------------------------------------------------------------- 1 | var WebSocketServer = require('../../').Server 2 | , express = require('express') 3 | , fs = require('fs') 4 | , http = require('http') 5 | , util = require('util') 6 | , path = require('path') 7 | , app = express.createServer() 8 | , events = require('events') 9 | , ansi = require('ansi') 10 | , cursor = ansi(process.stdout); 11 | 12 | function BandwidthSampler(ws, interval) { 13 | interval = interval || 2000; 14 | var previousByteCount = 0; 15 | var self = this; 16 | var intervalId = setInterval(function() { 17 | var byteCount = ws.bytesReceived; 18 | var bytesPerSec = (byteCount - previousByteCount) / (interval / 1000); 19 | previousByteCount = byteCount; 20 | self.emit('sample', bytesPerSec); 21 | }, interval); 22 | ws.on('close', function() { 23 | clearInterval(intervalId); 24 | }); 25 | } 26 | util.inherits(BandwidthSampler, events.EventEmitter); 27 | 28 | function makePathForFile(filePath, prefix, cb) { 29 | if (typeof cb !== 'function') throw new Error('callback is required'); 30 | filePath = path.dirname(path.normalize(filePath)).replace(/^(\/|\\)+/, ''); 31 | var pieces = filePath.split(/(\\|\/)/); 32 | var incrementalPath = prefix; 33 | function step(error) { 34 | if (error) return cb(error); 35 | if (pieces.length == 0) return cb(null, incrementalPath); 36 | incrementalPath += '/' + pieces.shift(); 37 | path.exists(incrementalPath, function(exists) { 38 | if (!exists) fs.mkdir(incrementalPath, step); 39 | else process.nextTick(step); 40 | }); 41 | } 42 | step(); 43 | } 44 | 45 | cursor.eraseData(2).goto(1, 1); 46 | app.use(express.static(__dirname + '/public')); 47 | 48 | var clientId = 0; 49 | var wss = new WebSocketServer({server: app}); 50 | wss.on('connection', function(ws) { 51 | var thisId = ++clientId; 52 | cursor.goto(1, 4 + thisId).eraseLine(); 53 | console.log('Client #%d connected', thisId); 54 | 55 | var sampler = new BandwidthSampler(ws); 56 | sampler.on('sample', function(bps) { 57 | cursor.goto(1, 4 + thisId).eraseLine(); 58 | console.log('WebSocket #%d incoming bandwidth: %d MB/s', thisId, Math.round(bps / (1024*1024))); 59 | }); 60 | 61 | var filesReceived = 0; 62 | var currentFile = null; 63 | ws.on('message', function(data, flags) { 64 | if (!flags.binary) { 65 | currentFile = JSON.parse(data); 66 | // note: a real-world app would want to sanity check the data 67 | } 68 | else { 69 | if (currentFile == null) return; 70 | makePathForFile(currentFile.path, __dirname + '/uploaded', function(error, path) { 71 | if (error) { 72 | console.log(error); 73 | ws.send(JSON.stringify({event: 'error', path: currentFile.path, message: error.message})); 74 | return; 75 | } 76 | fs.writeFile(path + '/' + currentFile.name, data, function(error) { 77 | ++filesReceived; 78 | // console.log('received %d bytes long file, %s', data.length, currentFile.path); 79 | ws.send(JSON.stringify({event: 'complete', path: currentFile.path})); 80 | currentFile = null; 81 | }); 82 | }); 83 | } 84 | }); 85 | 86 | ws.on('close', function() { 87 | cursor.goto(1, 4 + thisId).eraseLine(); 88 | console.log('Client #%d disconnected. %d files received.', thisId, filesReceived); 89 | }); 90 | 91 | ws.on('error', function(e) { 92 | cursor.goto(1, 4 + thisId).eraseLine(); 93 | console.log('Client #%d error: %s', thisId, e.message); 94 | }); 95 | }); 96 | 97 | fs.mkdir(__dirname + '/uploaded', function(error) { 98 | // ignore errors, most likely means directory exists 99 | console.log('Uploaded files will be saved to %s/uploaded.', __dirname); 100 | console.log('Remember to wipe this directory if you upload lots and lots.'); 101 | app.listen(8080); 102 | console.log('Listening on http://localhost:8080'); 103 | }); 104 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/test/Sender.hixie.test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert') 2 | , Sender = require('../lib/Sender.hixie'); 3 | require('should'); 4 | require('./hybi-common'); 5 | 6 | describe('Sender', function() { 7 | describe('#send', function() { 8 | it('frames and sends a text message', function(done) { 9 | var message = 'Hello world'; 10 | var received; 11 | var socket = { 12 | write: function(data, encoding, cb) { 13 | received = data; 14 | process.nextTick(cb); 15 | } 16 | }; 17 | var sender = new Sender(socket, {}); 18 | sender.send(message, {}, function() { 19 | received.toString('utf8').should.eql('\u0000' + message + '\ufffd'); 20 | done(); 21 | }); 22 | }); 23 | 24 | it('frames and sends an empty message', function(done) { 25 | var socket = { 26 | write: function(data, encoding, cb) { 27 | done(); 28 | } 29 | }; 30 | var sender = new Sender(socket, {}); 31 | sender.send('', {}, function() {}); 32 | }); 33 | 34 | it('frames and sends a buffer', function(done) { 35 | var received; 36 | var socket = { 37 | write: function(data, encoding, cb) { 38 | received = data; 39 | process.nextTick(cb); 40 | } 41 | }; 42 | var sender = new Sender(socket, {}); 43 | sender.send(new Buffer('foobar'), {}, function() { 44 | received.toString('utf8').should.eql('\u0000foobar\ufffd'); 45 | done(); 46 | }); 47 | }); 48 | 49 | it('throws an exception for binary data', function(done) { 50 | var socket = { 51 | write: function(data, encoding, cb) { 52 | process.nextTick(cb); 53 | } 54 | }; 55 | var sender = new Sender(socket, {}); 56 | sender.on('error', function() { 57 | done(); 58 | }); 59 | sender.send(new Buffer(100), {binary: true}, function() {}); 60 | }); 61 | 62 | it('can fauxe stream data', function(done) { 63 | var received = []; 64 | var socket = { 65 | write: function(data, encoding, cb) { 66 | received.push(data); 67 | process.nextTick(cb); 68 | } 69 | }; 70 | var sender = new Sender(socket, {}); 71 | sender.send(new Buffer('foobar'), { fin: false }, function() {}); 72 | sender.send('bazbar', { fin: false }, function() {}); 73 | sender.send(new Buffer('end'), { fin: true }, function() { 74 | received[0].toString('utf8').should.eql('\u0000foobar'); 75 | received[1].toString('utf8').should.eql('bazbar'); 76 | received[2].toString('utf8').should.eql('end\ufffd'); 77 | done(); 78 | }); 79 | }); 80 | }); 81 | 82 | describe('#close', function() { 83 | it('sends a hixie close frame', function(done) { 84 | var received; 85 | var socket = { 86 | write: function(data, encoding, cb) { 87 | received = data; 88 | process.nextTick(cb); 89 | } 90 | }; 91 | var sender = new Sender(socket, {}); 92 | sender.close(null, null, null, function() { 93 | received.toString('utf8').should.eql('\ufffd\u0000'); 94 | done(); 95 | }); 96 | }); 97 | 98 | it('sends a message end marker if fauxe streaming has started, before hixie close frame', function(done) { 99 | var received = []; 100 | var socket = { 101 | write: function(data, encoding, cb) { 102 | received.push(data); 103 | if (cb) process.nextTick(cb); 104 | } 105 | }; 106 | var sender = new Sender(socket, {}); 107 | sender.send(new Buffer('foobar'), { fin: false }, function() {}); 108 | sender.close(null, null, null, function() { 109 | received[0].toString('utf8').should.eql('\u0000foobar'); 110 | received[1].toString('utf8').should.eql('\ufffd'); 111 | received[2].toString('utf8').should.eql('\ufffd\u0000'); 112 | done(); 113 | }); 114 | }); 115 | }); 116 | }); 117 | -------------------------------------------------------------------------------- /tools/livereload/node_modules/livereload/node_modules/websocket.io/node_modules/ws/src/bufferutil.cc: -------------------------------------------------------------------------------- 1 | /*! 2 | * ws: a node.js websocket client 3 | * Copyright(c) 2011 Einar Otto Stangvik 4 | * MIT Licensed 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | using namespace v8; 17 | using namespace node; 18 | 19 | class BufferUtil : public ObjectWrap 20 | { 21 | public: 22 | 23 | static void Initialize(v8::Handle target) 24 | { 25 | HandleScope scope; 26 | Local t = FunctionTemplate::New(New); 27 | t->InstanceTemplate()->SetInternalFieldCount(1); 28 | NODE_SET_METHOD(t->GetFunction(), "unmask", BufferUtil::Unmask); 29 | NODE_SET_METHOD(t->GetFunction(), "mask", BufferUtil::Mask); 30 | NODE_SET_METHOD(t->GetFunction(), "merge", BufferUtil::Merge); 31 | target->Set(String::NewSymbol("BufferUtil"), t->GetFunction()); 32 | } 33 | 34 | protected: 35 | 36 | static Handle New(const Arguments& args) 37 | { 38 | HandleScope scope; 39 | BufferUtil* bufferUtil = new BufferUtil(); 40 | bufferUtil->Wrap(args.This()); 41 | return args.This(); 42 | } 43 | 44 | static Handle Merge(const Arguments& args) 45 | { 46 | HandleScope scope; 47 | Local bufferObj = args[0]->ToObject(); 48 | char* buffer = Buffer::Data(bufferObj); 49 | Local array = Local::Cast(args[1]); 50 | unsigned int arrayLength = array->Length(); 51 | unsigned int offset = 0; 52 | unsigned int i; 53 | for (i = 0; i < arrayLength; ++i) { 54 | Local src = array->Get(i)->ToObject(); 55 | unsigned int length = Buffer::Length(src); 56 | memcpy(buffer + offset, Buffer::Data(src), length); 57 | offset += length; 58 | } 59 | return scope.Close(True()); 60 | } 61 | 62 | static Handle Unmask(const Arguments& args) 63 | { 64 | HandleScope scope; 65 | Local buffer_obj = args[0]->ToObject(); 66 | unsigned int length = Buffer::Length(buffer_obj); 67 | Local mask_obj = args[1]->ToObject(); 68 | unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); 69 | unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); 70 | unsigned int len32 = length / 4; 71 | unsigned int i; 72 | for (i = 0; i < len32; ++i) *(from + i) ^= *mask; 73 | from += i; 74 | switch (length % 4) { 75 | case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; 76 | case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; 77 | case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; 78 | case 0:; 79 | } 80 | return True(); 81 | } 82 | 83 | static Handle Mask(const Arguments& args) 84 | { 85 | HandleScope scope; 86 | Local buffer_obj = args[0]->ToObject(); 87 | Local mask_obj = args[1]->ToObject(); 88 | unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); 89 | Local output_obj = args[2]->ToObject(); 90 | unsigned int dataOffset = args[3]->Int32Value(); 91 | unsigned int length = args[4]->Int32Value(); 92 | unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); 93 | unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); 94 | unsigned int len32 = length / 4; 95 | unsigned int i; 96 | for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; 97 | to += i; 98 | from += i; 99 | switch (length % 4) { 100 | case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); 101 | case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); 102 | case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); 103 | case 0:; 104 | } 105 | return True(); 106 | } 107 | }; 108 | 109 | extern "C" void init (Handle target) 110 | { 111 | HandleScope scope; 112 | BufferUtil::Initialize(target); 113 | } 114 | 115 | NODE_MODULE(bufferutil, init) 116 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/App/Modules/Api/SiteModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Candidate.Core.Model; 4 | using Nancy; 5 | using Nancy.ModelBinding; 6 | using Nancy.Validation; 7 | using Raven.Client; 8 | using Candidate.Core.Logger; 9 | 10 | namespace Candidate.Nancy.Selfhosted.App.Modules.Api 11 | { 12 | public class SiteModule : NancyModule 13 | { 14 | private readonly ILogger _logger; 15 | private readonly IDocumentStore _documentStore; 16 | 17 | public SiteModule(ILogger logger, IDocumentStore documentStore) 18 | : base("/api/site") 19 | { 20 | _logger = logger; 21 | _documentStore = documentStore; 22 | 23 | Get["/{id}"] = parameters => 24 | { 25 | var id = parameters.id; 26 | 27 | if (string.IsNullOrEmpty(id)) 28 | { 29 | _logger.Debug(string.Format("Invalid Id passed to /api/site DELETE method")); 30 | return HttpStatusCode.PreconditionFailed; 31 | } 32 | 33 | using (var session = _documentStore.OpenSession()) 34 | { 35 | string entityId = string.Format("sites/{0}", id); 36 | var site = session.Query().Single(s => s.Id == entityId); 37 | if (site == null) 38 | { 39 | return HttpStatusCode.NotFound; 40 | } 41 | 42 | return Response.AsJson(site); 43 | } 44 | }; 45 | 46 | Post["/"] = parameters => 47 | { 48 | var site = this.Bind("name", "description"); 49 | 50 | var result = this.Validate(site); 51 | if (!result.IsValid) 52 | { 53 | _logger.Debug(string.Format("Validation for Site model failed, {0}", result.Errors.ToString())); 54 | return HttpStatusCode.PreconditionFailed; 55 | } 56 | 57 | site.Created = DateTime.UtcNow; 58 | site.Status = "Created"; 59 | 60 | using (var session = _documentStore.OpenSession()) 61 | { 62 | session.Store(site); 63 | session.SaveChanges(); 64 | } 65 | 66 | _logger.Debug(string.Format("New site configuration created successfully, Id: {0}", site.Id)); 67 | return Response.AsJson(site); 68 | }; 69 | 70 | Delete["/{id}"] = parameters => 71 | { 72 | var id = parameters.id; 73 | 74 | if (string.IsNullOrEmpty(id)) 75 | { 76 | _logger.Debug(string.Format("Invalid Id passed to /api/site DELETE method")); 77 | return HttpStatusCode.PreconditionFailed; 78 | } 79 | 80 | using (var session = _documentStore.OpenSession()) 81 | { 82 | session.Advanced.DatabaseCommands.Delete(id, null); 83 | } 84 | 85 | _logger.Debug(string.Format("Site configuration with Id:{0} deleted successfully", id)); 86 | return HttpStatusCode.NoContent; 87 | }; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/Candidate.Nancy.Selfhosted/Client/scripts/libs/domReady.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license RequireJS domReady 2.0.0 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. 3 | * Available via the MIT or new BSD license. 4 | * see: http://github.com/requirejs/domReady for details 5 | */ 6 | /*jslint */ 7 | /*global require: false, define: false, requirejs: false, 8 | window: false, clearInterval: false, document: false, 9 | self: false, setInterval: false */ 10 | 11 | 12 | define(function () { 13 | 'use strict'; 14 | 15 | var isBrowser = typeof window !== "undefined" && window.document, 16 | isPageLoaded = !isBrowser, 17 | doc = isBrowser ? document : null, 18 | readyCalls = [], 19 | isTop, testDiv, scrollIntervalId; 20 | 21 | function runCallbacks(callbacks) { 22 | var i; 23 | for (i = 0; i < callbacks.length; i++) { 24 | callbacks[i](doc); 25 | } 26 | } 27 | 28 | function callReady() { 29 | var callbacks = readyCalls; 30 | 31 | if (isPageLoaded) { 32 | //Call the DOM ready callbacks 33 | if (callbacks.length) { 34 | readyCalls = []; 35 | runCallbacks(callbacks); 36 | } 37 | } 38 | } 39 | 40 | /** 41 | * Sets the page as loaded. 42 | */ 43 | function pageLoaded() { 44 | if (!isPageLoaded) { 45 | isPageLoaded = true; 46 | if (scrollIntervalId) { 47 | clearInterval(scrollIntervalId); 48 | } 49 | 50 | callReady(); 51 | } 52 | } 53 | 54 | if (isBrowser) { 55 | if (document.addEventListener) { 56 | //Standards. Hooray! Assumption here that if standards based, 57 | //it knows about DOMContentLoaded. 58 | document.addEventListener("DOMContentLoaded", pageLoaded, false); 59 | window.addEventListener("load", pageLoaded, false); 60 | } else if (window.attachEvent) { 61 | window.attachEvent("onload", pageLoaded); 62 | 63 | testDiv = document.createElement('div'); 64 | try { 65 | isTop = window.frameElement === null; 66 | } catch(e) {} 67 | 68 | //DOMContentLoaded approximation that uses a doScroll, as found by 69 | //Diego Perini: http://javascript.nwbox.com/IEContentLoaded/, 70 | //but modified by other contributors, including jdalton 71 | if (testDiv.doScroll && isTop && window.external) { 72 | scrollIntervalId = setInterval(function () { 73 | try { 74 | testDiv.doScroll(); 75 | pageLoaded(); 76 | } catch (e) {} 77 | }, 30); 78 | } 79 | } 80 | 81 | //Check if document already complete, and if so, just trigger page load 82 | //listeners. Latest webkit browsers also use "interactive", and 83 | //will fire the onDOMContentLoaded before "interactive" but not after 84 | //entering "interactive" or "complete". More details: 85 | //http://dev.w3.org/html5/spec/the-end.html#the-end 86 | //http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded 87 | if (document.readyState === "complete" || 88 | document.readyState === "interactive") { 89 | pageLoaded(); 90 | } 91 | } 92 | 93 | /** START OF PUBLIC API **/ 94 | 95 | /** 96 | * Registers a callback for DOM ready. If DOM is already ready, the 97 | * callback is called immediately. 98 | * @param {Function} callback 99 | */ 100 | function domReady(callback) { 101 | if (isPageLoaded) { 102 | callback(doc); 103 | } else { 104 | readyCalls.push(callback); 105 | } 106 | return domReady; 107 | } 108 | 109 | domReady.version = '2.0.0'; 110 | 111 | /** 112 | * Loader Plugin API method 113 | */ 114 | domReady.load = function (name, req, onLoad, config) { 115 | if (config.isBuild) { 116 | onLoad(null); 117 | } else { 118 | domReady(onLoad); 119 | } 120 | }; 121 | 122 | /** END OF PUBLIC API **/ 123 | 124 | return domReady; 125 | }); 126 | --------------------------------------------------------------------------------