#! /usr/bin/env node console.log('importing.') var fs = require('fs') var path = require('path') var os = require('os') var fse = require('fs.extra') var Zip = require('node-zip') var util = require('./util') var DM_CERTS_DIR = '/.docker/machine/certs/' var DM_MACHINE_DIR = '/.docker/machine/machines' var HOME = os.homedir() var TMP = os.tmpdir() var args = process.argv.slice(2) var machineArg = args[0] if (!machineArg) { console.log('machine-import <config-zip>') process.exit(1) } var machine = machineArg.substring(0, machineArg.length - 4) var configDir = path.join(HOME, DM_MACHINE_DIR, machine) try { fs.statSync(configDir) console.log('that machine already exists') process.exit(1) } catch (e) {} var tmp = path.join(TMP, machine)
setConfig: function (pConfig) { config.merge(pluginConfig, pConfig) let rep = p => path.normalize(p.replace(/^~/, os.homedir())) pluginConfig.include_path = pluginConfig.include_path.map(rep) || os.homedir() },
function setupHistory(repl, historyPath, oldHistoryPath, ready) { if (!historyPath) { try { historyPath = path.join(os.homedir(), '.node_repl_history'); } catch (err) { repl._writeToOutput('\nError: Could not get the home directory.\n' + 'REPL session history will not be persisted.\n'); repl._refreshLine(); debug(err.stack); repl._historyPrev = _replHistoryMessage; return ready(null, repl); } } var timer = null; var writing = false; var pending = false; repl.pause(); fs.open(historyPath, 'a+', oninit); function oninit(err, hnd) { if (err) { // Cannot open history file. // Don't crash, just don't persist history. repl._writeToOutput('\nError: Could not open history file.\n' + 'REPL session history will not be persisted.\n'); repl._refreshLine(); debug(err.stack); repl._historyPrev = _replHistoryMessage; repl.resume(); return ready(null, repl); } fs.close(hnd, onclose); } function onclose(err) { if (err) { return ready(err); } fs.readFile(historyPath, 'utf8', onread); } function onread(err, data) { if (err) { return ready(err); } if (data) { repl.history = data.split(/[\n\r]+/, repl.historySize); } else if (oldHistoryPath === historyPath) { // If pre-v3.0, the user had set NODE_REPL_HISTORY_FILE to // ~/.node_repl_history, warn the user about it and proceed. repl._writeToOutput( '\nThe old repl history file has the same name and location as ' + `the new one i.e., ${historyPath} and is empty.\nUsing it as is.\n`); repl._refreshLine(); } else if (oldHistoryPath) { // Grab data from the older pre-v3.0 JSON NODE_REPL_HISTORY_FILE format. repl._writeToOutput( '\nConverting old JSON repl history to line-separated history.\n' + `The new repl history file can be found at ${historyPath}.\n`); repl._refreshLine(); try { // Pre-v3.0, repl history was stored as JSON. // Try and convert it to line separated history. const oldReplJSONHistory = fs.readFileSync(oldHistoryPath, 'utf8'); // Only attempt to use the history if there was any. if (oldReplJSONHistory) repl.history = JSON.parse(oldReplJSONHistory); if (!Array.isArray(repl.history)) { throw new Error('Expected array, got ' + typeof repl.history); } repl.history = repl.history.slice(0, repl.historySize); } catch (err) { if (err.code !== 'ENOENT') { return ready( new Error(`Could not parse history data in ${oldHistoryPath}.`)); } } } fs.open(historyPath, 'w', onhandle); } function onhandle(err, hnd) { if (err) { return ready(err); } repl._historyHandle = hnd; repl.on('line', online); // reading the file data out erases it repl.once('flushHistory', function() { repl.resume(); ready(null, repl); }); flushHistory(); } // ------ history listeners ------ function online() { repl._flushing = true; if (timer) { clearTimeout(timer); } timer = setTimeout(flushHistory, kDebounceHistoryMS); } function flushHistory() { timer = null; if (writing) { pending = true; return; } writing = true; const historyData = repl.history.join(os.EOL); fs.write(repl._historyHandle, historyData, 0, 'utf8', onwritten); } function onwritten(err, data) { writing = false; if (pending) { pending = false; online(); } else { repl._flushing = Boolean(timer); if (!repl._flushing) { repl.emit('flushHistory'); } } } }
const fs = require('fs'); const path = require('path'); const os = require('os'); const mkdirp = require('mkdirp'); const rimraf = require('rimraf'); const es = require('event-stream'); const rename = require('gulp-rename'); const vfs = require('vinyl-fs'); const ext = require('./extensions'); const util = require('gulp-util'); const root = path.dirname(path.dirname(__dirname)); // @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file const builtInExtensions = require('../builtInExtensions.json'); const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json'); function getExtensionPath(extension) { return path.join(root, '.build', 'builtInExtensions', extension.name); } function isUpToDate(extension) { const packagePath = path.join(getExtensionPath(extension), 'package.json'); if (!fs.existsSync(packagePath)) { return false; } const packageContents = fs.readFileSync(packagePath, { encoding: 'utf8' }); try {
var exec = require('child_process').exec; var fs = require('fs'); var path = require('path'); var os = require('os') var cert = '/root/lamassu-server.crt'; var fingerprint = null; try { var path1 = path.resolve(os.homedir(), '.lamassu', 'lamassu.json') cert = JSON.parse(fs.readFileSync(path1)).certPath } catch (_) { cert = '/root/lamassu-server.crt' } function generateFingerprint(cert) { exec('openssl x509 -fingerprint -sha1 -noout -in ' + cert + ' | sed \'s/SHA1 Fingerprint=//\'', function (err, stdout) { if (err) throw err; // Should we throw if there's anything in `stderr`? Are there any unusual // warnings that would cause this to crash? fingerprint = stdout.trim(); }); }; // Generate fingerprint from what users already have in `/root/lamassu-server.crt` fs.exists(cert, function(exists) { if(exists) generateFingerprint(cert); });
User.storagePath = function() { if (customStoragePath) return customStoragePath; return path.join(os.homedir(), ".homebridge"); }
async create( path, { wantsPublic, quiet = false, env = {}, followSymlinks = true, forceNew = false, forwardNpm = false, // From readMetaData name, description, type = 'npm', pkg = {}, nowConfig = {}, hasNowJson = false, sessionAffinity = 'ip' } ) { this._path = path let files let engines if (this._debug) { console.time('> [debug] Getting files') } const opts = { debug: this._debug, hasNowJson } if (type === 'npm') { files = await getNpmFiles(path, pkg, nowConfig, opts) // A `start` or `now-start` npm script, or a `server.js` file // in the root directory of the deployment are required if (!hasNpmStart(pkg) && !hasFile(path, files, 'server.js')) { const err = new Error( 'Missing `start` (or `now-start`) script in `package.json`. ' + 'See: https://docs.npmjs.com/cli/start.' ) err.userError = true throw err } engines = nowConfig.engines || pkg.engines forwardNpm = forwardNpm || nowConfig.forwardNpm } else if (type === 'static') { files = await getFiles(path, nowConfig, opts) } else if (type === 'docker') { files = await getDockerFiles(path, nowConfig, opts) } if (this._debug) { console.timeEnd('> [debug] Getting files') } // Read `registry.npmjs.org` authToken from .npmrc let authToken if (type === 'npm' && forwardNpm) { authToken = (await readAuthToken(path)) || (await readAuthToken(homedir())) } if (this._debug) { console.time('> [debug] Computing hashes') } const pkgDetails = Object.assign({ name }, pkg) const hashes = await hash(files, pkgDetails) if (this._debug) { console.timeEnd('> [debug] Computing hashes') } this._files = hashes const deployment = await this.retry(async bail => { if (this._debug) { console.time('> [debug] v2/now/deployments') } // Flatten the array to contain files to sync where each nested input // array has a group of files with the same sha but different path const files = await Promise.all( Array.prototype.concat.apply( [], await Promise.all( Array.from(this._files).map(async ([sha, { data, names }]) => { const statFn = followSymlinks ? stat : lstat return names.map(async name => { const getMode = async () => { const st = await statFn(name) return st.mode } const mode = await getMode() return { sha, size: data.length, file: toRelative(name, this._path), mode } }) }) ) ) ) const res = await this._fetch('/v2/now/deployments', { method: 'POST', body: { env, public: wantsPublic || nowConfig.public, forceNew, name, description, deploymentType: type, registryAuthToken: authToken, files, engines, sessionAffinity, atlas: hasNowJson && Boolean(nowConfig.atlas) } }) if (this._debug) { console.timeEnd('> [debug] v2/now/deployments') } // No retry on 4xx let body try { body = await res.json() } catch (err) { throw new Error('Unexpected response') } if (res.status === 429) { let msg = `You reached your 20 deployments limit in the OSS plan.\n` msg += `${chalk.gray('>')} Please run ${chalk.gray('`')}${chalk.cyan( 'now upgrade' )}${chalk.gray('`')} to proceed` const err = new Error(msg) err.status = res.status err.retryAfter = 'never' return bail(err) } else if (res.status === 400 && body.error && body.error.code === 'missing_files') { return body } else if (res.status >= 400 && res.status < 500) { const err = new Error(body.error.message) err.userError = true return bail(err) } else if (res.status !== 200) { throw new Error(body.error.message) } return body }) // We report about files whose sizes are too big let missingVersion = false if (deployment.warnings) { let sizeExceeded = 0 deployment.warnings.forEach(warning => { if (warning.reason === 'size_limit_exceeded') { const { sha, limit } = warning const n = hashes.get(sha).names.pop() console.error( '> \u001B[31mWarning!\u001B[39m Skipping file %s (size exceeded %s)', n, bytes(limit) ) hashes.get(sha).names.unshift(n) // Move name (hack, if duplicate matches we report them in order) sizeExceeded++ } else if (warning.reason === 'node_version_not_found') { const { wanted, used } = warning console.error( '> \u001B[31mWarning!\u001B[39m Requested node version %s is not available', wanted, used ) missingVersion = true } }) if (sizeExceeded) { console.error( `> \u001B[31mWarning!\u001B[39m ${sizeExceeded} of the files ` + 'exceeded the limit for your plan.\n' + `> Please run ${chalk.gray('`')}${chalk.cyan( 'now upgrade' )}${chalk.gray('`')} to upgrade.` ) } } if (deployment.error && deployment.error.code === 'missing_files') { this._missing = deployment.error.missing || [] this._fileCount = files.length return null; } if (!quiet && type === 'npm' && deployment.nodeVersion) { if (engines && engines.node) { if (missingVersion) { console.log( `> Using Node.js ${chalk.bold(deployment.nodeVersion)} (default)` ) } else { console.log( `> Using Node.js ${chalk.bold( deployment.nodeVersion )} (requested: ${chalk.dim(`\`${engines.node}\``)})` ) } } else { console.log( `> Using Node.js ${chalk.bold(deployment.nodeVersion)} (default)` ) } } this._id = deployment.deploymentId this._host = deployment.url this._missing = [] this._fileCount = files.length return this._url }
process.on('unhandledRejection', function (err) { console.error('Unhandled error: ' + (err && err.stack || err)); bugsnag.notify(err); }); var ipc = require('electron').ipcMain; var globalShortcut = require('electron').globalShortcut; var autoUpdater = require('electron').autoUpdater; var menubar = require('menubar'); var fs = require('fs'); var AutoLaunch = require('auto-launch'); var os = require('os') const isDev = require('electron-is-dev'); try { global.options = require(os.homedir() + '/.nimble-options.json'); } catch (e) { global.options = { "mathjs": true, "startup": true, "center": false, "bugreport": true, "autoupdate": true, theme: { "red": false, "orange": true, "yellow": false, "green": false, "blue": false, "purple": false, "pink": false,
const Module = require("module"), assert = require("chai").assert, leche = require("leche"), sinon = require("sinon"), path = require("path"), fs = require("fs"), os = require("os"), yaml = require("js-yaml"), shell = require("shelljs"), espree = require("espree"), ConfigFile = require("../../../lib/config/config-file"), Linter = require("../../../lib/linter"), Config = require("../../../lib/config"); const userHome = os.homedir(); const temp = require("temp").track(); const proxyquire = require("proxyquire").noCallThru().noPreserveCache(); let configContext; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ /* * Project path is the project that is including ESLint as a dependency. In the * case of these tests, it will end up the parent of the "eslint" folder. That's * fine for the purposes of testing because the tests are just relative to an * ancestor location. */ const PROJECT_PATH = path.resolve(__dirname, "../../../../"),
const path = require('path') const os = require('os') const platform = {} platform.win32 = { filePath: [ path.join(os.homedir()), ], appPath: [], excludePath: [], excludeName: [ 'node_modules', 'bower_components', 'vendor', 'tmp', 'tags', 'log', ], } if (os.platform() === 'win32') { if (process.env.USERPROFILE) { platform.win32.appPath.push(path.join(process.env.USERPROFILE, 'Desktop')) } if (process.env.APPDATA) { platform.win32.appPath.push(path.join(process.env.APPDATA, 'Microsoft', 'Windows', 'Start Menu', 'Programs')) } if (process.env.ProgramData) { platform.win32.appPath.push(path.join(process.env.ProgramData, 'Microsoft', 'Windows', 'Start Menu', 'Programs'))
robot.keyTap(key) } } const hyperPath = path.join(__dirname, 'Hyper.app/Contents') const replaceCode = (filePath, from, to) => { fs.writeFileSync( filePath, fs.readFileSync(filePath, 'utf-8') .replace(from, to) ) } [ [`${homedir()}/.test-hyper.js`, 'LOCAL_PACKAGE', process.cwd()], [`${hyperPath}/Resources/app/config.js`, '.hyper.js', '.test-hyper.js'], [`${hyperPath}/Resources/app/plugins.js`, '.hyper_plugins', '.test-hyper_plugins'] ].forEach(args => replaceCode.apply(this, args)) describe('Open devtools', function spec() { this.timeout(10000) before(() => { this.app = new Application({ path: `${hyperPath}/MacOS/Hyper`, args: [], }) return this.app.start() })
import NodeAgent from '../src/index'; import chai from 'chai'; import os from 'os'; import PouchDB from 'pouchdb'; var gcdb = new PouchDB(os.homedir()+'/.node-agent/gcdb-test'); var osdb = new PouchDB(os.homedir()+'/.node-agent/osdb-test'); let assert = chai.assert; describe('NodeAgent', function() { it('should be and object', function () { let agent = new NodeAgent({ gc: true, cpu: true, mem: true, env: 'PRODUCTION' }); assert.typeOf(agent, 'object'); agent.start(); assert.typeOf(agent, 'object'); }); });
const http = require('http'); const os = require('os'); const express = require('express'); const io = require('socket.io'); const writejson = require('writejson'); const readjson = require('readjson'); const {promisify} = require('util'); process.env.NODE_ENV = 'development'; const cloudcmd = require('../server/cloudcmd'); const {assign} = Object; const pathConfig = os.homedir() + '/.cloudcmd.json'; const currentConfig = readjson.sync.try(pathConfig); module.exports = before; function before(options, fn = options) { const { config, plugins, modules, } = options; const app = express(); const server = http.createServer(app); const after = (cb) => { if (currentConfig)
'use strict'; const _ = require('lodash'), chalk = require('chalk'), electron = require('electron'), fs = require('fs'), path = require('path'), yaml = require('js-yaml'), log = require('./log').asInternal(__filename), util = require('util'), availableBrowserWindowOptions = [ 'width', 'height', 'useContentSize', 'resizable', 'moveable', 'center', 'alwaysOnTop', 'show', 'frame' ], windows = {}, os = require('os'), homedir = os.homedir(); /** * @this {BrowserWindow} */ function onClose() { log('info', 'onClose'); // remove reference from list of windows const key = _.findKey(windows, {id: this.id}); if (key) { delete windows[key]; } else { log('warn', 'unable to unreference window'); }
const os = require('os') const home = os.homedir() module.exports = { title: 'ELaunch', width: 600, height: 60, maxHeight: 500, language: null, autoLaunch: true, position: 'center', // 'center' or {x: 100, y:200} // default is your primary display, you can change it by setting display id(integer), // get all ids by require('electron').screen.getAllDisplays().map(d=>d.id) display: 'primary', shortcuts: { toggle: { default: 'Super+Space' }, selectPrevItem: { default: 'Up' }, selectNextItem: { default: 'Down' }, selectPrevItemOpt: { default: 'Left' }, selectNextItemOpt: { default: 'Right' }, }, plugins: { app: { path: `${__dirname}/../plugins/app/index.js`, enable: true, // whether the plugin is enable, default is true default: true, // default plugin don't need to input key config: { darwin: { appPaths: ['/Applications', `${home}/Applications`], }, linux: {
gpii.settingsDir.baseDir.standard = function () { return os.homedir(); };
function migrateSSL(ctx, migrateTask) { const replace = require('replace-in-file'); const acme = require('./acme'); const parsedUrl = url.parse(ctx.instance.config.get('url')); const confFile = path.join(ctx.instance.dir, 'system', 'files', `${parsedUrl.hostname}-ssl.conf`); const rootPath = path.resolve(ctx.instance.dir, 'system', 'nginx-root'); // Case to skip 1: SSL config for nginx does not exist if (!fs.existsSync(confFile)) { return migrateTask.skip('SSL config has not been set up for this domain'); } const originalAcmePath = path.join(os.homedir(), '.acme.sh'); const originalCertFolder = path.join(originalAcmePath, parsedUrl.hostname); // Case to skip 2: SSL cert doesn't exist in the original location for this domain if (!fs.existsSync(originalCertFolder)) { return migrateTask.skip('SSL cert does not exist for this domain'); } const confFileContents = fs.readFileSync(confFile, {encoding: 'utf8'}); const certCheck = new RegExp(`ssl_certificate ${originalCertFolder}/fullchain.cer;`); // Case to skip 3: SSL conf does not contain a cert config using the old LE cert if (!certCheck.test(confFileContents)) { return migrateTask.skip('LetsEncrypt SSL cert is not being used for this domain'); } // 1. parse ~/.acme.sh/account.conf to get the email const accountConf = fs.readFileSync(path.join(originalAcmePath, 'account.conf'), {encoding: 'utf8'}); const parsed = accountConf.match(/ACCOUNT_EMAIL='(.*)'\n/); if (!parsed) { throw new cli.errors.SystemError('Unable to parse letsencrypt account email'); } return this.ui.listr([{ // 2. install acme.sh in /etc/letsencrypt if that hasn't been done already title: 'Installing acme.sh in new location', task: (ctx, task) => acme.install(this.ui, task) }, { // 3. run install cert for new acme.sh instance title: 'Regenerating SSL certificate in new location', task: () => acme.generate(this.ui, parsedUrl.hostname, rootPath, parsed[1], false) }, { // 4. Update cert locations in nginx-ssl.conf title: 'Updating nginx config', task: () => { const acmeFolder = path.join('/etc/letsencrypt', parsedUrl.hostname); return replace({ files: confFile, from: [ // Ensure here that we ONLY replace instances of the LetsEncrypt cert in the file, // that way we don't overwrite the cert config of other certs. certCheck, new RegExp(`ssl_certificate_key ${originalCertFolder}/${parsedUrl.hostname}.key;`) ], to: [ `ssl_certificate ${path.join(acmeFolder, 'fullchain.cer')};`, `ssl_certificate_key ${path.join(acmeFolder, `${parsedUrl.hostname}.key`)};` ] }); } }, { title: 'Restarting Nginx', task: () => this.restartNginx() }, { // 5. run acme.sh --remove -d domain in old acme.sh directory to remove the old cert from renewal title: 'Disabling renewal for old certificate', task: () => acme.remove(parsedUrl.hostname, this.ui, originalAcmePath) }], false); }
function getHomedir() { return typeof os.homedir == 'function' ? os.homedir() : process.env[process.platform == 'win32' ? 'USERPROFILE' : 'HOME']; }
this.files = [].concat.apply([], [ 'json', 'cson', 'yaml', 'yml', 'js' ].map(ext => [ path.join(this.cwd, `.atom-build.${ext}`), path.join(os.homedir(), `.atom-build.${ext}`) ])).filter(fs.existsSync);
function ensoureRootPath() { let rootPath = path.join(os.homedir(), '.lgit'); util.ensureDir(rootPath); return rootPath; }
const os = require('os'); const path = require('path'); const program = require('commander'); const version = appRequire('package').version; const log = appRequire('init/log'); const log4js = require('log4js'); const logger = log4js.getLogger('system'); const ssmgrPath = path.resolve(os.homedir() + '/.ssmgr/'); program .version('shadowsocks-manager ' + version) .option('-c, --config [file]', 'config file, default: ~/.ssmgr/default.yml') .option('-d, --db [file]', 'sqlite3 file, sample: ~/.ssmgr/db.sqlite') .option('-e, --empty', 'clean database') .option('-t, --type [type]', 'type, s for server side, m for manager side') .option('-s, --shadowsocks [address]', 'ss-manager address, sample: 127.0.0.1:6001') .option('-m, --manager [address]', 'manager address, sample: 0.0.0.0:6002') .option('-p, --password [password]', 'manager password, both server side and manager side must be equals') .option('-r, --run [type]', 'run shadowsocks from child_process, sample: libev / libev:aes-256-cfb / python / python:aes-256-cfb') .option('--debug', 'show debug message') .parse(process.argv); if(program.config) { global.configFile = program.config; } if(!program.debug) { log.setConsoleLevel('ERROR'); } const config = appRequire('services/config');
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const axios_1 = require("axios"); const fs = require("fs"); const os = require("os"); const path = require("path"); const dotconfig_1 = require("./dotconfig"); const CACHE_FILE = path.join(os.homedir(), '.cache', 'openex.json'); const CACHE_MAX_AGE_IN_HOURS = 12; const MAPPINGS = { $: 'USD', NIS: 'ILS' }; const DEFAULTS = ['ILS', 'USD']; class Rates { constructor(data) { this.data = data; } convert(from, toCurrency) { const fromCurrency = this.normalize(from.currency); if (fromCurrency == null) return; toCurrency = this.normalize(toCurrency) || this.getDefaultTo(fromCurrency);
#!/usr/bin/env node 'use strict' const os = require('os') const path = require('path') const pretty = require('@medv/prettyjson') const {stdin, stdout, stderr} = process try { require(path.join(os.homedir(), '.fxrc')) } catch (err) { if (err.code !== 'MODULE_NOT_FOUND') { throw err } } const usage = ` Usage $ fx [code ...] Examples $ echo '{"key": "value"}' | fx 'x => x.key' value $ echo '[1,2,3]' | fx 'this.map(x => x * 2)' [2, 4, 6] $ echo '{"items": ["one", "two"]}' | fx 'this.items' 'this[1]' two $ echo '{"count": 0}' | fx '{...this, count: 1}' {"count": 1}
/** * Get the home directory path for the current user. Returns root directory for environments where there is no * file system path available. * @returns {String} A file system path. */ static homeDirectory() { return (os.homedir && os.homedir()) || path.sep; }
this.files = [].concat.apply([], ['json', 'cson', 'yml', 'js'].map(function (ext) { return [path.join(_this.cwd, '.atom-build.' + ext), path.join(os.homedir(), '.atom-build.' + ext)]; })).filter(fs.existsSync);
/** * Exapnds ~ to homedir in non-Windows platform */ function resolveHomeDir(inputPath) { if (!inputPath || !inputPath.trim()) return inputPath; return inputPath.startsWith('~') ? path.join(os.homedir(), inputPath.substr(1)) : inputPath; }
let rep = p => path.normalize(p.replace(/^~/, os.homedir()))
'use strict' const fs = require('fs') const os = require('os') const chalk = require('chalk') const npmName = require('npm-name') const pify = require('pify') const recast = require('recast') const fileName = `${os.homedir()}/.hyper.js` const oldConf = `${os.homedir()}/.hyperterm.js` function getPluginName(item) { if (item.type === 'TemplateLiteral') { return item.quasis[0].value.raw } return item.value } let fileContents let parsedFile let plugins let localPlugins try { fileContents = fs.readFileSync(fileName, 'utf8') parsedFile = recast.parse(fileContents) const expression = parsedFile.program.body[0].expression const properties = (expression && expression.right && expression.right.properties) || []
/* eslint-env mocha */ const assert = require('assert') const os = require('os') const proxyquire = require('proxyquire') const platforms = [ ['darwin', `${os.homedir()}/Library/Caches/linusu`], ['freebsd', `${os.homedir()}/.cache/linusu`], ['linux', `${os.homedir()}/.cache/linusu`], ['openbsd', `${os.homedir()}/.cache/linusu`], ['win32', `${os.homedir()}/AppData/Local/linusu/Cache`] ] platforms.forEach(function (platform) { describe(platform[0], () => { let cachedir before(() => { const os = { platform () { return platform[0] } } cachedir = proxyquire('./', { os }) }) it('should give the correct path', () => { const actual = cachedir('linusu') const expected = platform[1] assert.equal(actual, expected)
constructor() { this.filterSetConfigFile = path.join( os.homedir(), '.catalogger', 'filter.json' ); }