{"size": 580, "ext": "js", "max_stars_repo_path": "src/server/destroy-server.js", "max_stars_repo_name": "richielokay/richielokay.com", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/server/destroy-server.js", "max_issues_repo_name": "richielokay/richielokay.com", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/server/destroy-server.js", "max_forks_repo_name": "richielokay/richielokay.com", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.3333333333, "max_line_length": 50, "alphanum_fraction": 0.4413793103}
'use strict';

/******************
 *  Dependencies  *
 ******************/

var Promise = require('promise');
var log = require('../logger');

/*************
 *  Exports  *
 *************/

module.exports = function(context) {
    var server = context.server;

    return new Promise(function(resolve, reject) {
        if (!server) { resolve(context); }

        try {
            server.close(function() {
                resolve(context);
                log('Server', 'Closed');
            });
        } catch(err) {
            reject(new Error(err));
        }
    });
};
