Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
target = path.join(process.cwd(), target);
}
try {
fs.accessSync(source, fs.F_OK);
} catch (error) {
console.log('source directory does not exist');
process.exit(1);
}
source = tildify(source);
target = tildify(target);
let ssh = '';
let {user, host} = config;
user = user || username.sync();
if (host) {
target = `${user}@${host}:${target}`;
ssh = 'ssh';
}
let exclude = '';
if (config.excludes) {
exclude = config.excludes.map(item => `--exclude ${item}`).join(' ');
}
// https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps
const command = `'rsync -azOte ${ssh} --inplace --delete ${exclude} ${source}/ ${target}'`;
const watcher = path.join(__dirname, '../node_modules/.bin/watch-and-exec');
if (option === 'start') {
export async function initArchive(rpc, dir) {
// check if the dir is valid
await isDirInitable(dir)
// ask user questions
console.log(trim`
Initializing ${dir}
This utility will walk you through creating a dat.json file.
It only covers the most common items, and tries to guess sensible defaults.
`)
const q = (name, message, def, type='input') => ({ name, message, 'default': def, type })
var answers = await inquirer.prompt([
q('title', 'title:', path.basename(dir)),
q('description', 'description:'),
q('author', 'author:', await username())
])
console.log(`\nAbout to write ${path.join(dir, 'dat.json')}\n`)
console.log(JSON.stringify(answers, null, 2), '\n')
var confirm = await inquirer.prompt([{ type: 'confirm', name: 'ok', message: 'Is this ok?', default: true }])
if (!confirm.ok) {
console.log('Aborted.')
process.exit(0)
}
// create site in beaker
var datKey = await rpc.createNewArchive(answers)
console.log(trim`
Created new site
dat://${datKey}/
`)
function getWinStartupPath() {
/* istanbul ignore next */ // Requires Windows testing envrionment which travis-ci doesn't support right now
if (os.release().substring(2, 0).replace('.', '') >= 6) {
return 'C:\\Users\\' + username.sync() + '\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup';
} else {
return 'C:\\Documents and Settings\\' + username.sync() + '\\Start Menu\\Programs\\Startup';
}
}
if (!destPath) {
throw new Error('Need a path to copy to');
}
if (!newProjectName) {
throw new Error('Need a project name');
}
createDir(path.join(destPath, windowsDir));
createDir(path.join(destPath, windowsDir, newProjectName));
createDir(path.join(destPath, windowsDir, newProjectName, reactAssetsDir));
const ns = options.ns || newProjectName;
const projectGuid = uuid.v4();
const packageGuid = uuid.v4();
const currentUser = username.sync(); // Gets the current username depending on the platform.
const certificateThumbprint = generateCertificate(srcPath, destPath, newProjectName, currentUser);
const templateVars = {
'<%=ns%>': ns,
'<%=name%>': newProjectName,
'<%=projectGuid%>': projectGuid,
'<%=packageGuid%>': packageGuid,
'<%=currentUser%>': currentUser,
'<%=certificateThumbprint%>': certificateThumbprint ? `${certificateThumbprint}` : ''
};
[
{ from: path.join(srcPath, 'App.windows.js'), to: 'App.windows.js' },
{ from: path.join(srcPath, projDir, 'MyApp.sln'), to: path.join(windowsDir, newProjectName + '.sln') },
{ from: path.join(srcPath, projDir, 'MyApp.csproj'), to: path.join(windowsDir, newProjectName, newProjectName + '.csproj') },
{ from: path.join(srcPath, projDir, 'react.overrides.props'), to: path.join(windowsDir, 'react.overrides.props') },
if (!destPath) {
throw new Error('Need a path to copy to');
}
if (!newProjectName) {
throw new Error('Need a project name');
}
createDir(path.join(destPath, windowsDir));
createDir(path.join(destPath, windowsDir, newProjectName));
createDir(path.join(destPath, windowsDir, newProjectName, reactAssetsDir));
const ns = options.ns || newProjectName;
const projectGuid = uuid.v4();
const packageGuid = uuid.v4();
const currentUser = username.sync(); // Gets the current username depending on the platform.
const certificateThumbprint = generateCertificate(srcPath, destPath, newProjectName, currentUser);
const templateVars = {
'<%=ns%>': ns,
'<%=name%>': newProjectName,
'<%=projectGuid%>': projectGuid,
'<%=packageGuid%>': packageGuid,
'<%=currentUser%>': currentUser,
'<%=certificateThumbprint%>': certificateThumbprint ? `${certificateThumbprint}` : ''
};
[
{ from: path.join(srcPath, 'App.windows.js'), to: 'App.windows.js' },
{ from: path.join(srcPath, projDir, 'MyApp.sln'), to: path.join(windowsDir, newProjectName + '.sln') },
{ from: path.join(srcPath, projDir, 'MyApp.csproj'), to: path.join(windowsDir, newProjectName, newProjectName + '.csproj') },
{ from: path.join(srcPath, '_gitignore'), to: path.join(windowsDir, '.gitignore') },
then(function () {
expect(ngModelCtrl.$error['foo.size.toosmall']).toBe(true);
expect(ngModelCtrl.$error['username.taken']).toBe(true);
});
if (path === '') {
canWrite('./', function (err, isWritable) {
if (err) console.error(error('No write permissions, run as root'));
if (isWritable) {
if (!fs.existsSync('./airgeddon/')) { fs.mkdirSync('./airgeddon/') }
download('./airgeddon/' + filenameOne,
'./airgeddon/' + filenameTwo,
'./airgeddon/' + filenameThree,
'./airgeddon/' + filenameFour,
'./airgeddon/' + filenameFive,
'./airgeddon/' + filenameSix,
)
}
})
} else if (path.charAt(0) === '~') {
var fixedPath = '/home/' + whoami.sync() + '/';
if (fs.existsSync(fixedPath)) {
canWrite(fixedPath, function (err, isWritable) {
if (err) console.error(error('No write permissions, run as root'));
if (isWritable) {
if (!fs.existsSync(fixedPath + 'airgeddon/')) { fs.mkdirSync(fixedPath + 'airgeddon/') }
download(fixedPath + 'airgeddon/' + filenameOne,
fixedPath + 'airgeddon/' + filenameTwo,
fixedPath + 'airgeddon/' + filenameThree,
fixedPath + 'airgeddon/' + filenameFour,
fixedPath + 'airgeddon/' + filenameFive,
fixedPath + 'airgeddon/' + filenameSix,
)
}
})
}
} else if (path.slice(-1) === '/') {
Emitter.on('error', (event, details) => {
username.then((name) => {
window.showToast(TranslationProvider.query('message-uncaught-error'), false,
TranslationProvider.query('message-uncaught-error-button'), '#E53935',
(buttonEvent, toast) => {
const title = `Uncaught Exception: ${details.error.message.split(/\n/g)[0].substring(0, 100)}`;
const body = `
An uncaught exception was reported. %0A
%23%23%23%23 Info:%0A
**OS:** ${process.platform}%0A
**Arch:** ${process.arch}%0A
**GPMDP Version:** ${require('../../../../package.json').version}%0A
**Time:** ${new Date()}%0A
%0A
%23%23%23%23 Error:%0A
*${details.error.message.split(/\n/g)[0].substring(0, 100).replace(new RegExp(name, 'g'), '')}*%0A
\`\`\`js%0A
${details.error.stack.replace(/(?:\r\n|\r|\n)/g, '%0A').substring(0, 1200).replace(new RegExp(name, 'g'), '')}
function isAutostartEnabled(key, callback) {
var err;
if(process.env.FORCEERROR === 'true') {
err = new Error('Test error');
} else {
err = null;
}
callback(err, fileExists('/Users/' + username.sync() + '/Library/LaunchAgents/' + key + '.plist'));
}
var fs = require('fs'),
username = require('username');
chk = 0x12345678,
i;
grunt.log.writeln('deploy file:', deploy_file_name);
var deploy_file = grunt.file.read(deploy_file_name);
string = deploy_file.replace(/var CHECKSUM = .*;/,"");
string = string.replace(/var BUILDER = .*;/,"");
string = string.replace(/\s/g,""); //Remove all whitespace from the string.
for (i = 0; i < string.length; i++) {
chk += (string.charCodeAt(i) * i);
}
var builder = username.sync();
grunt.log.writeln('setting builder:', builder);
//
grunt.template.addDelimiters('square-brackets','[%','%]');
var data = { checksum: chk, builder: builder };
var output = grunt.template.process(deploy_file, {
data: data,
delimiters: 'square-brackets'
});
grunt.file.write(deploy_file_name,output);
});