githOOKS - simple node server that responds to github post-receive events
Install the module with: npm install gith
// create a gith server on port 9001
var gith = require('gith').create( 9001 );| // Mojax | |
| // Copyright (c) 2011 Dan Heberden | |
| // Dual licensed under the MIT and GPL A | |
| var randomStrings = [ "Joe", "Bill", "Steve", "Mark", "Joanne", "Megan", "Kristy", "Suzie" ]; | |
| $.ajaxPrefilter( function( options, originalOptions, jqXHR ) { | |
| if ( /^\/?mock-ajax/.test( originalOptions.url ) ) { | |
| // make new deferred and save any success/error handlers | |
| var dfd = new $.Deferred(), | |
| success = options.success, |
| // New Object Template | |
| (function(){ | |
| var thing = window.Thing = function( a ) { | |
| return new window.Thing.fn.init( a ); | |
| }; | |
| thing.fn = thing.prototype = { | |
| constructor: thing, | |
| init: function( a ){ | |
| // init the 'thing' |
| function s:setupWrapping() | |
| set wrap | |
| set wrapmargin=2 | |
| set textwidth=72 | |
| endfunction | |
| " md, markdown, and mk are markdown and define buffer-local preview | |
| au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup() |
| /* This is an fn that can: | |
| a) make new objects by itself or with the new keyword using some kind of identifier | |
| b) return a cached object if an object with the same identifier is requested | |
| c) is, itself, one of these objects | |
| d) no id is a global ID | |
| e.g. | |
| var foo = new maker('baz'); | |
| var foo1 = maker('baz'); | |
| maker('baz') === foo; // true | |
| maker('baz') === foo1; // true |
| var gith = require( 'gith' ).create( 9001 ); | |
| gith({ | |
| repo: 'danheberden/gith' | |
| }).on( 'file:add', function( payload ) { | |
| console.log( 'these files were added', payload.files.added ); | |
| }); |
| var gith = require( 'gith' ).create( 1337 ); | |
| gith({ | |
| repo: 'danheberden/gith', | |
| file: /^test\/payloads/ | |
| }).on( 'file:add', function( payload ) { | |
| /* files were added to /test/payloads in danheberden/gith */ | |
| }); |
| var gith = require( 'gith' ).create( 9001 ); | |
| gith().on( 'all', function( payload ) { | |
| /* update the website! */ | |
| }); |