<commit_before>var os = require('os');
var path = require('path');

var fs = require('fs-extra');
var request = require('request');
var unzip = require('unzip');
var GitHubApi = require('github');
var github = new GitHubApi({
    version: "3.0.0",
    protocol: "https",
    headers: {
        "user-agent": "cartridge-cli-app"
    }
});

var releaseServiceApi = {};
var _log;

var OS_TMP_DIR = os.tmpdir();
var DATE;
var ZIP_FILENAME;
var ZIP_FILEPATH;

releaseServiceApi.downloadLatestRelease = function(logInstance) {

	return preSetup()
		.then(getReleaseZipFromGitHub)
		.then(decompressZipFile)
		.then(deleteZipFile);
}

function preSetup() {
	date = new Date();
	ZIP_FILENAME = [date.getMilliseconds(), date.getDate(), date.getMonth()+1, date.getFullYear(), '-cartridge-tmp.zip'].join('');
	ZIP_FILEPATH = path.join(OS_TMP_DIR, ZIP_FILENAME);

	return Promise.resolve();
}

function getReleaseZipFromGitHub() {
	return new Promise(function(resolve, reject) {
		request('https://github.com/code-computerlove/cartridge/archive/v0.2.0-alpha.zip')
			.pipe(fs.createWriteStream(ZIP_FILEPATH))
			.on('close', function() {
				resolve();
			});
	})
}

function decompressZipFile() {
	return new Promise(function(resolve, reject) {
		fs.createReadStream(ZIP_FILEPATH)
			.pipe(unzip.Extract({ path: OS_TMP_DIR}))
			.on('close', function() {
				resolve()
			});
	})
}

function deleteZipFile() {
	return new Promise(function(resolve, reject) {
		fs.unlink(ZIP_FILEPATH, function() {<commit_msg>refactor: Add zip download url into a variable<commit_after>var os = require('os');
var path = require('path');

var fs = require('fs-extra');
var request = require('request');
var unzip = require('unzip');
var GitHubApi = require('github');
var github = new GitHubApi({
    version: "3.0.0",
    protocol: "https",
    headers: {
        "user-agent": "cartridge-cli-app"
    }
});

var releaseServiceApi = {};
var _log;

var OS_TMP_DIR = os.tmpdir();
var DATE;
//temp - need to get this from the API
var ZIP_DOWNLOAD_URL = 'https://github.com/code-computerlove/cartridge/archive/v0.2.0-alpha.zip';
var ZIP_FILENAME;
var ZIP_FILEPATH;

releaseServiceApi.downloadLatestRelease = function(logInstance) {
	return preSetup()
		.then(getReleaseZipFromGitHub)
		.then(decompressZipFile)
		.then(deleteZipFile);
}

function preSetup() {
	date = new Date();
	ZIP_FILENAME = [date.getMilliseconds(), date.getDate(), date.getMonth()+1, date.getFullYear(), '-cartridge-tmp.zip'].join('');
	ZIP_FILEPATH = path.join(OS_TMP_DIR, ZIP_FILENAME);

	return Promise.resolve();
}

function getReleaseZipFromGitHub() {
	return new Promise(function(resolve, reject) {
		request(ZIP_DOWNLOAD_URL)
			.pipe(fs.createWriteStream(ZIP_FILEPATH))
			.on('close', function() {
				resolve();
			});
	})
}

function decompressZipFile() {
	return new Promise(function(resolve, reject) {
		fs.createReadStream(ZIP_FILEPATH)
			.pipe(unzip.Extract({ path: OS_TMP_DIR}))
			.on('close', function() {
				resolve()
			});
	})
}

function deleteZipFile() {
	return new Promise(function(resolve, reject) {
		fs.unlink(ZIP_FILEPATH, function() {
{'fraction_non_alphanumeric': 0.1596909207984546, 'fraction_numerical': 0.004507405022537025, 'mean_word_length': 4.829268292682927, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6398156', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1075, 'n_words': 212}