#!/usr/bin/env node
/*jshint shelljs:true */

"use strict";

require('shelljs/make');

if (env["$CI"]) {
	echo("Skipping prepublish on CI builds");
	exit(0);
}

// Look for a local clone of
var NODE_SASS_BINARIES_DIR = "../node-sass-binaries";

if (!test("-e", NODE_SASS_BINARIES_DIR)) {

	if (!which("git")) {
		echo("Sorry, this script requires git");
		exit(1);
	}

	// Clone the binary repo to the expected location
	var NODE_SASS_DIR = pwd();
	cd("..");
	exec("git clone https://github.com/sass/node-sass-binaries.git")

	cd(NODE_SASS_DIR);
}

echo("Copying binaries to bin");
cp("-Rf", NODE_SASS_BINARIES_DIR + "/*", "bin");
rm(["bin/LICENSE", "bin/README.md"]);
