lib/bear.js
function( payload ) {
    var bear = this;
    var dfd = _.Deferred();
    var action = dfd.promise();

    // ok to launch live?
    if ( payload.branch === bear.settings.liveBranch  ) {
      // can we just upload master without worrying about tags?
      if ( !bear.settings.deployOnTag ) {
        action = action.then( function() {
          return bear.live( bear.settings.liveBranch);
        });
      } else if ( payload.tag ) {
        // since we tagged and that's required, only launch at that sha
        action = action.then( function() {
          return bear.live( bear.settings.liveBranch, payload.sha );
        });
      }
    }

    // either way, setup the staging version
    action = action.then( function() {
      return bear.stage( payload.branch );
    });

    // if we assigned a callback, fire it when these are done
    if ( bear.settings.githCallback ) {
      action.done( function() {
        bear.settings.githCallback.call( bear, payload );
      });
    }

    // start us off
    dfd.resolve();
  }
function( payload ) {
    var bear = this;
    var dfd = _.Deferred();
    var action = dfd.promise();

    // ok to launch live?
    if ( payload.branch === bear.settings.liveBranch  ) {
      // can we just upload master without worrying about tags?
      if ( !bear.settings.deployOnTag ) {
        action = action.then( function() {
          return bear.live( bear.settings.liveBranch);
        });
      } else if ( payload.tag ) {
        // since we tagged and that's required, only launch at that sha
        action = action.then( function() {
          return bear.live( bear.settings.liveBranch, payload.sha );
        });
      }
    }

    // either way, setup the staging version
    action = action.then( function() {
      return bear.stage( payload.branch );
    });

    // if we assigned a callback, fire it when these are done
    if ( bear.settings.githCallback ) {
      action.done( function() {
        bear.settings.githCallback.call( bear, payload );
      });
    }

    // start us off
    dfd.resolve();
  }
function ( payload ) { var bear = this ; var dfd = _ . Deferred ( ) ; var action = dfd . promise ( ) ; // ok to launch live? if ( payload . branch === bear . settings . liveBranch ) { // can we just upload master without worrying about tags? if ( ! bear . settings . deployOnTag ) { action = action . then ( function ( ) { return bear . live ( bear . settings . liveBranch ) ; } ) ; } else if ( payload . tag ) { // since we tagged and that's required, only launch at that sha action = action . then ( function ( ) { return bear . live ( bear . settings . liveBranch , payload . sha ) ; } ) ; } } // either way, setup the staging version action = action . then ( function ( ) { return bear . stage ( payload . branch ) ; } ) ; // if we assigned a callback, fire it when these are done if ( bear . settings . githCallback ) { action . done ( function ( ) { bear . settings . githCallback . call ( bear , payload ) ; } ) ; } // start us off dfd . resolve ( ) ; }
process the payload gith emitted
process the payload gith emitted