this.on('end', function () {
      //////////////////////////////
      // Move Yo Storage
      //////////////////////////////
      fs.renameSync('../.yo-rc.json', '.yo-rc.json');

      //////////////////////////////
      // If the --skip-install flag is NOT passed, install our bundler
      // dependencies.
      // NOTE: This happens in a local folder because there is less of a chance
      //       of it breaking there.
      //////////////////////////////
      if (!this.options['skip-install']) {
        sh.run('bundle install --path .vendor/bundle');

        //////////////////////////////
        // If the --skip-compass flag is NOT passed, run compass compile
        //////////////////////////////
        if (!this.options['skip-compass']) {
          sh.run('bundle exec compass compile');
        }
      }

      //////////////////////////////
      // If the --git flag is passed, initialize git and add for initial commit
      //////////////////////////////
      if (this.options['git']) {
        sh.run('git init');
        sh.run('git add . && git commit -m "Aurora Generation"');
      }
    });
示例#2
0
module.exports.unseen_word_curves = function(dataset) {

	dir = "./unseen_words_curve/"

	try { content = fs.readdirSync(dir) }

	catch (e)
		{	fs.mkdirSync(dir);
			content = fs.readdirSync(dir)				
		}

		if (content.length !=0)
		{
			console.log("The existing report is found. If you want to draw a learning curves, remove the existing report")
			command = "gnuplot -p -e \"plot \'"+dir+"unseen_curves\' using 1:2 with lines\""
			result = execSync.run(command)
	    	return 0
		}

	var result = execSync.run("gnuplot -V");
	if (result !=0 ) {
		console.log("gnuplot is not found")
		return 0
	}
		seen_vocabulary = []
		
		total_vocabulary = tokenizedataset(dataset)

	_.each(dataset,  function(sentence, key, list){ 
		seen_vocabulary = _.uniq(seen_vocabulary.concat(tokenizedataset([sentence])))
		unseen_word = _.difference(total_vocabulary, seen_vocabulary)
		unseen_word_ratio = unseen_word.length/total_vocabulary.length
		fs.appendFileSync(dir+"unseen_curves", seen_vocabulary.length+"\t"+unseen_word_ratio+"\n",'utf8', function (err) {console.log("error "+err); return 0 })
	})
}
exports.shp2csv = function shp2csv(dir, shp, s_srs, callback) {
    var sh = require('execSync'),
        fs = require('fs');

    if (!shp) {
        console.log('  Detecting Shapefile');
        var tmp = fs.readdirSync(dir);
        var shp;

        for(var i = 0; i < tmp.length; i++){
            if (tmp[i].indexOf(".shp") != -1){
                shp = tmp[i];
                console.log('  Found: ' + shp);
                break;
            }
        }
    }

    console.log('  Converting ' + shp);
    if (s_srs)
        sh.run('ogr2ogr -s_srs ' + s_srs + ' -t_srs EPSG:4326 -f CSV ' + dir + 'out.csv ' + dir + shp + ' -lco GEOMETRY=AS_XYZ');
    else
        sh.run('ogr2ogr -t_srs EPSG:4326 -f CSV ' + dir + 'out.csv ' + dir + shp + ' -lco GEOMETRY=AS_XYZ');

    callback();
}
示例#4
0
 this.on('end', function () {
   //////////////////////////////
   // If the --git flag is passed, initialize git and add for initial commit
   //////////////////////////////
   if (this.options['git']) {
     sh.run('git init');
     sh.run('git add . && git commit -m "Mr. Poole\'s Generation"');
   }
 });
 reportRunnerResults: function(runner) {
     var suites = runner.suites();
     for (var i = 0; i < suites.length; i++) {
         var suite = suites[i];
         var output = '';
         // if we are consolidating, only write out top-level suites
         if (this.consolidate && suite.parentSuite) {
             continue;
         } else if (this.consolidate) {
             // output += "\n<testsuites>";
             output += this.getNestedOutput(suite);
             // output += "\n</testsuites>";
             this.writeFile(this.savePath, output);
         } else {
             output += suite.output;
             this.writeFile(this.savePath, output);
         }
     };
     // When all done, make it known on singleFileJUnitXmlReporter
     singleFileJUnitXmlReporter.finished_at = (new Date()).getTime();
     // End xml file
     this.writeFile(this.savePath, "\n</testsuites>");
     // Generate html
     if (this.xsltApplyPath) {
         var sh = require('execSync');
         var execStr = "xsltproc " + this.xsltApplyPath + " " + this.savePath + " > " + this.baseSavePath + ".html";
         var code = sh.run(execStr);
         process.stdout.write("\ncommand: \"" + execStr +'"\n  returned code: ' + code);
     };
 },
示例#6
0
 .then(function() {
   // Build it.
   sh.run('sh ./chrome-extension/crxmake.sh ./chrome-extension ./chrome-extension/key.pem');
   gulp.src('chrome-extension.crx')
     .pipe(clean())
     .pipe(gulp.dest('build'));
 });
示例#7
0
 .then(function() {
   // Build it.
   sh.run('./build/addon-sdk-1.17/bin/cfx xpi --pkgdir=./firefox-addon/');
   gulp.src('tbpl-hou.xpi')
     .pipe(clean())
     .pipe(gulp.dest('build'));
 });
示例#8
0
	getRegion(function(err, box) {
		console.log(box);

		var f = 1.0 / terrainSize;
		var fx = function(v) { return box.left + (box.right - box.left) * v; };
		var fy = function(v) { return box.top + (box.bottom - box.top) * v; };

		var tscale = terrainSize / box.size;
		var normx = box.left, normy = box.top;

		for (var y = 0 ; y < terrainSize ; y += leafSize) {
			for (var x = 0 ; x < terrainSize ; x += leafSize) {
				var lf = x * f, rf = (x+leafSize) * f,
					tf = y * f, bf = (y+leafSize) * f;

				var l = fx(lf), r = fx(rf), t = fy(tf), b = fy(bf);
				var command = "./query-raw " + l + " " + r + " " + t + " " + b + " " + normx + " " + normy;
				console.log(command);
				var code =
					execSync(command);

				if (code !== 0)
					throw new Error("ZEROS DETECTED");
			}
		}
	});
示例#9
0
  /*
  TODO: provide some validation that this is the project to destroy
  */
  destroy() {

    let cwd = process.cwd()

    sh.run(`rm -rf ${cwd}/*`)

  }
示例#10
0
var buildAppScripts = function (target) {
    sh.run("mkdir -p builds/" + target + "/assets/js/");
    return new BPromise(function (resolve, reject) {
        var deps = JSON.parse(fs.readFileSync("deps.json"));
        webpack({
            entry: {
                app: "./app/main.jsx",
                vendor: deps.js
            },
            output: {
                filename: "builds/" + target + "/assets/js/app.js"
            },
            module: {
                loaders: [{
                    test: /\.jsx$/,
                    loader: "jsx-loader"
                }]
            },
            plugins: [
                new webpack.optimize.CommonsChunkPlugin(
                    "vendor",
                    "builds/" + target + "/assets/js/vendor.js"
                )
            ]
        }, function (err, stats) {
            if (err) {
                reject(err);
            } else {
                resolve(stats);
            }
        });
    });
};
示例#11
0
exec('git diff --cached --quiet', function (err, stdout, stderr) {

  // only run if there are staged changes
  // i.e. what you would be committing if you ran "git commit" without "-a" option.
  if (err) {

    // stash unstaged changes - only test what's being committed
    sh('git stash --keep-index --quiet');

    exec('grunt {{task}}', function (err, stdout, stderr) {

      console.log(stdout);

      // restore stashed changes
      sh('git stash pop --quiet');

      var exitCode = 0;
      if (err) {
        console.log(stderr);
        exitCode = -1;
      }
      process.exit(exitCode);
    });
  }

});
示例#12
0
function createDirGitInit(info){
	var repo_name = info.repository.name;
	fs.mkdirSync('./repositories/' + repo_name);

	var create_statement = sh_commands.createGitRepoAndRemotes(repo_name, info.repository.url, config.archive);
  sh.run(create_statement);
}
示例#13
0
	grunt.registerMultiTask('gitaddcommit', 'Manage git subtrees', function() {

		var options = this.options({
				flags: '--all',
				gitFlags: '',
				message: this.target,
				noVerify: false
			}),
			verifyFlag = options.noVerify ? ' --no-verify' : '',
			gitCmd = 'git ' + options.gitFlags + ' ';



		execSync.run(gitCmd + 'add ' + options.flags);
		execSync.run(gitCmd + 'commit -m "' + options.message.replace(/"/g, "") + '"' + verifyFlag);

	});
示例#14
0
function checkGnuPlot()
	{
		var result = execSync.run("gnuplot -V");
		if (result !=0 ) {
			console.log("gnuplot is not found")
			return 0
		}
	}
示例#15
0
  init: function () {
    this.pkg = require('../package.json');

    this.on('end', function () {
      if (!this.options['skip-install']) {
        this.installDependencies();
        this.spawnCommand('bundle', ['install']);
      }
    });

    //////////////////////////////
    // If the --git flag is passed, initialize git and add for initial commit
    //////////////////////////////
    if (this.options['git']) {
      sh.run('git init');
      sh.run('git add . && git commit -m "UX Prototype Generation"');
    }
  },
示例#16
0
var buildVendorFonts = function (target) {
    sh.run("mkdir -p builds/" + target + "/assets/fonts/");
    return new BPromise(function (resolve, reject) {
        var deps = JSON.parse(fs.readFileSync("deps.json"));
        gulp.src(deps.fonts)
            .pipe(gp.plumber(reject))
            .pipe(gulp.dest("builds/" + target + "/assets/fonts/"))
            .on("end", resolve);
    });
};
示例#17
0
function pullLatest(info){
	var repo_name = info.repository.name;

	if (!fs.existsSync('./repositories' + repo_name)){
		createDirGitInit(info);
	}

	var fetch_statement = sh_commands.fetchLatest(repo_name, config.archive);
	sh.run(fetch_statement);
}
示例#18
0
    _getSolution: function(json)
    {
        fs.writeFileSync(constraintInputDataFile, json);

        sh.run("cd " + constraintSolverRootFolder + chainCommandSeparator + " java -jar constraintSolver.jar");

        var result = fs.readFileSync(constraintSolutionDataFile, {encoding:"utf8"});

        return { isSuccessful: true, response: result };
    }
示例#19
0
    before(function() {

        es.run('mkdir -p ' + configPath);

        // create config mockup
        fs.writeFileSync(configPath + configFile, 'var config = ' +
            JSON.stringify(configMockup) +
            ';' +
            'module.exports = config;'
        );
    });
示例#20
0
var buildAppIndex = function (target) {
    sh.run("mkdir -p builds/" + target + "/");
    return new BPromise(function (resolve, reject) {
        gulp.src("app/main.html")
            .pipe(gp.plumber(reject))
            .pipe(gp.preprocess({context: {TARGET: target}}))
            .pipe(gp.rename("index.html"))
            .pipe(gulp.dest("builds/" + target + "/"))
            .on("end", resolve);
    });
};
示例#21
0
var buildAppStyles = function (target) {
    sh.run("mkdir -p builds/" + target + "/assets/css/");
    return new BPromise(function (resolve, reject) {
        gulp.src("app/main.scss")
            .pipe(gp.plumber(reject))
            .pipe(gp.sass())
            .pipe(gp.autoprefixer("last 3 version"))
            .pipe(gp.rename("app.css"))
            .pipe(gulp.dest("builds/" + target + "/assets/css/"))
            .on("end", resolve);
    });
};
示例#22
0
gulp.task('clean', function(done) {

  /*
  Note, the gulp-clean task is janky
  */
  //src('./dist/**/*', {read: false}).pipe(clean())

  sh.run('rm -rf dist')

  done()

})
function exec(cmd) {
  try {
    debug('exec command "%s"', cmd)
    let exitCode = sh.run('cd "' + playgroundFolder + '" && ' + cmd)
    if (exitCode !== 0) {
      throwInitError('Non-zero exit code from command "' + cmd + '": ' + exitCode)
    }
  } catch (e) {
    if (!isInitError(e)) {
      throwInitError('Exec command "' + cmd + '" caused unexpected exception: ' + e)
    }
  }
}
示例#24
0
  vampdSettingsToJSON: function () {

    this.log("Thank you so much! Your site role file will generate in a few moments");
    var mID = this.machineId;
    if (!this.options['skip-install']) {
      var projPath = './' + mID;
      if (!path.exists(projPath)) {
        sh.run('git clone https://github.com/vampd/vampd.git ' + ' ./' + mID);
      }
    }

    this.template('role.json', './' + mID + '/chef/roles/' + mID +'.json');
  },
示例#25
0
function execute(){
	var loginCmd = 'lscm login -r ' + program.repository + ' -u ' + program.username + ' -P ' + program.password + ' -n rAlias -c';
	sh.run(loginCmd);
	sh.run('lscm create workspace -r rAlias "tmp" --stream "1000"');

	var results = _.map(components, function(component){
		console.log("Loading history for component: " + component);
		return parseHistory(sh.exec('lscm history -r rAlias -w "tmp" -c "' + component + '" --maximum 1001').stdout);
	});

	sh.run('lscm workspace delete tmp -r rAlias');	
	sh.run('lscm logout -r rAlias');
	
	console.log('History collected for all components, consolidating results');
	var combinedResult = consolidateResults(results);

	console.log("Finding earliest changeset for each team member");
	var earliestChangeSets = findEarliestChangeSet(combinedResult);

	var times = {};
	_.forEach(teamMembers, function(tm){
		console.log(typeof tm.startDt);
		var teamMemberChangeSet = earliestChangeSets[tm.name];
		if(!teamMemberChangeSet){
			console.log("No change sets found for team member " + tm.name);
		} else {
			times[tm.name] = teamMemberChangeSet.date.getTime() - Date.parse(tm.startDt);
		}
	});

	var average = _.reduce(_.values(times), function(sum, t){return sum+t}, 0) /_.values(times).length;

	console.log("Average TTFD is " + Math.round(moment.duration(average).asHours()));

	_.forOwn(times, function(val, key){
		console.log(key + ': ' + moment.duration(val).asHours())
	})

}
示例#26
0
		_.each(parameters, function(value, key, list){
			plotfor = "plot "
			_(fold+1).times(function(n){
			// _.each(parameters,  function(value, key, list){ 
				plotfor = plotfor + " for [i=2:"+ (_.size(classifiers) + 1)+"] \'"+dir+value+"-fold"+n+"\' using 1:i with linespoints linecolor i pt "+n+" ps 3, "
				// fs.writeFileSync(dir+value+"-fold"+n, header, 'utf-8', function(err) {console.log("error "+err); return 0 })
				// },this)
			},this)
			plotfor = plotfor.substring(0,plotfor.length-2);
			command = "gnuplot -p -e \"reset; set term png truecolor size 1024,1024; set grid ytics; set grid xtics; set key bottom right; set output \'"+dir + value+".png\'; set key autotitle columnhead; "+plotfor +"\""
			result = execSync.run(command)
			// console.log(command)
			// process.exit(0)
		}, this)
示例#27
0
    exec('grunt {{task}}', function (err, stdout, stderr) {

      console.log(stdout);

      // restore stashed changes
      sh('git stash pop --quiet');

      var exitCode = 0;
      if (err) {
        console.log(stderr);
        exitCode = -1;
      }
      process.exit(exitCode);
    });
示例#28
0
function release(type) {
  execSync.run('git checkout master');
  var pkg = require(packageFilename);
  pkg.version = semver.inc(pkg.version, type);
  fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
  execSync.run('git commit -a -m "Bumped version to v' + pkg.version + '"');
  execSync.run('git push origin master');
  execSync.run('git tag v' + pkg.version);
  execSync.run('git push origin --tags');
  execSync.run('npm publish');
}
示例#29
0
    parser.parseString(config, function (err, res) {
        if (err) {
            console.log(chalk.red("Error parsing builds/ios/config.xml"));
            console.log(err);
            return;
        }
        res.widget.$.version = version;
        res.widget.platform = {$: {
            name: "ios"
        }};
        res.widget.platform.icon = [
            76,
            120,
            152,
            180
        ].map(function (size) {
            return {
                $: {
                    src: "www/assets/app-icon/ios-" + size + "x" + size + ".png",
                    width: "" + size,
                    height: "" + size
                }
            };
        });
        res.widget.platform.splash = [
            ["640", "960"],
            ["768", "1024"],
            ["1536", "2048"],
            ["640", "1136"],
            ["750", "1334"],
            ["1242", "2208"]
        ].map(function (size) {
            return {$: {
                src: "www/assets/app-splash/" + size[0] + "x" + size[1] + ".png",
                width: size[0],
                height: size[1]
            }};
        });

        var builder = new xml2js.Builder();
        var xml = builder.buildObject(res);
        fs.writeFileSync("builds/ios/config.xml", xml, "utf8");
        // Build
        sh.run("cd builds/ios && cordova build ios");
        console.log(chalk.green.bold("SUCCESS"));
    });
示例#30
0
// only two classifiers in string format
function plot(fold, parameter, stat, baseline, sota)
{
	stat = stat[parameter]

	var output = []
		
	if (fold != 'average')
	{
		_.each(stat, function(rowvalue, row, list){ 
			_.each(rowvalue, function(data, column, list){ 
				var result = data[sota][fold] - data[baseline][fold]
				if (bars.isNumber(result))
					output.push([row, column, result])
			}, this)
		}, this)	
	}
	else
	{
		_.each(stat, function(rowvalue, row, list){ 
			_.each(rowvalue, function(data, column, list){ 
				var result = distance.vec_minus(data[baseline], data[sota])
				var average = distance.average(result)
				output.push([row, column, average])
			}, this)
		}, this)
	}

	var results = _.groupBy(output, function(num){ return num[0] })
	var string = ""

	_.each(results, function(value, key, list){ 
		_.each(value, function(value1, key1, list1){ 
			string += value1.join(" ")+"\n"
		}, this)
		string += "\n"
	}, this)

	var mapfile = __dirname+"/learning_curves/map_"+fold+"_"+parameter+"_"+sota+"-"+baseline

    fs.writeFileSync(mapfile, string)

    var command = gnuplot +" -e \"set title '"+corpus+" : "+sota+" - "+baseline+"'; set output 'utils/learning_curves/"+fold+"_"+parameter+"_"+sota+"-"+baseline+".png'\" "+__dirname+"/com " + "-e \"plot \'"+mapfile+"\' using 2:1:3 with image\""
    console.log(command)
    execSync.run(command)

}