Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
var sh = require('execSync').run;
var shOutput = require('execSync').exec;
var file, command, fileChanged;
var object = require('../../hooks/data/update');
for (var i in object) {
file = object[i].file;
command = object[i].command;
fileChanged = (shOutput('git diff HEAD@{1} --stat -- ' + file + ' | wc -l').stdout > 0);
if (fileChanged) {
console.log(file + ' has changed, dependencies will be updated.'); // jshint ignore:line
sh(command);
}
}
process.exit(0);
sh.run('bundle install --path vendor');
this.installDependencies({
callback: function () {
console.log('\u001b[2J\u001b[0;0H');
console.log(chalk.yellow('★ ') + chalk.green('Installation Complete!\n') +
' ▪ Move into the ' + chalk.cyan(dir) + ' directory\n' +
' ▪ Run ' + chalk.yellow('gulp') + ' to start working with Style Prototypes!');
}
});
}
//////////////////////////////
// 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 "Style Prototype Generation"');
}
});
},
_(fold+1).times(function(n){
// _.each(parameters, function(value, key, list){
foldcom = " for [i=2:"+ (_.size(classifiers) + 1)+"] \'"+dir+value+"-fold"+n+"\' using 1:i with linespoints linecolor i pt "+n+" ps 3"
com = "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+"fold"+n+".png\'; set key autotitle columnhead; plot "+foldcom +"\""
result = execSync.run(com)
plotfor = plotfor + foldcom + ", "
// 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);
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"');
}
});
},
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 "North Generation"');
}
}
});
if(options.apache_scheme === 'vhost'){
// vhost setting
var vhostTemplate = grunt.file.read(__dirname + '/../templates/vhost.ejs'),
newVhostFile = options.vhost_dir + '/' + options.site_slug + '.conf',
vhostData = {
slug: options.site_slug,
hostName: hostName,
docRoot: options.doc_root,
logsDir: options.logs_dir
},
vhostContents = ejs.render(vhostTemplate, vhostData);
// create the vhost file
grunt.hpLog.subhead('Creating virtualhost file...');
execSync.run( sudo.apply('echo "' + vhostContents.replace('"', '\"') + '" > ' + newVhostFile ) );
// Point host name to localhost in hosts file
grunt.hpLog.subhead('Defining "' + hostName + '" in hosts file...');
if( hostExists(hostName, '127.0.0.1') ){
grunt.hpLog.ok('Host already defined.');
}else{
var lhLine = '\n127.0.0.1 ' + hostName;
execSync.run( sudo.apply('echo "' + lhLine + '" >> /etc/hosts') );
grunt.hpLog.ok('Host defined.');
}
var traceFile = path.join(benchOutputDir, 'mem-trace');
var cliArgs = [
lifetimeAnalysisScript,
"--no-progress",
// "--ref-trace",
"--ref",
"--trace",
traceFile,
">",
path.join(benchOutputDir, 'enhanced-trace')
];
var cliStr = "export LIFETIME_ANALYSIS_OPTS=\" -Xmx2G -Dtesting=no\" && " + cliArgs.join(' ');
var result = new fastStats.Stats();
for (var i = 0; i < NUM_ENHANCED_RUNS; i++) {
var time = Date.now();
sh.run(cliStr);
result.push(Date.now() - time);
}
return result;
}
function execSync(cmd) {
if (cp.execSync) {
// node v0.12; use the built-in functionality
try {
cp.execSync(cmd);
return false;
} catch (e) {
return true;
}
} else {
// node v0.10; fall back on execSync package
return require("execSync").run(cmd);
}
}
function execSync(cmd) {
/* var FFI = require("node-ffi");
var libc = new FFI.Library(null, {
"system": ["int32", ["string"]]
});
var run = libc.system;
run(cmd);*/
es = require('execSync')
es.run(cmd)
}
}).then(function (result) {
checkResult(result);
traceFile = result.traceFile;
execSync.run("wc -l " + traceFile);
console.log("---Record")
console.log(result.stdout);
console.log(result.stderr);
return jalangi.replay(traceFile);
}).then(function (result) {
checkResult(result);