runs(() => {
   expect(preview.getTitle()).toBe('file.markdown Preview')
   preview.onDidChangeTitle(titleChangedCallback)
   fs.renameSync(
     preview.getPath(),
     path.join(path.dirname(preview.getPath()), 'file2.md')
   )
 })
示例#2
0
/**
 * We occasionally see EPERM errors on the compile cache during boot on
 * Windows. See https://phab.nylas.com/T8128. This will simply catch these
 * errors and defer writing to the cache instead of taking down the whole
 * app on boot.
 *
 * TODO: Determine root cause of the EPERM lock. Maybe antivirus.  Maybe
 * multiple processes loading at once.
 */
function writeCachedJavascript(relativeCachePath, code) {
  try {
    const cacheTmpPath = path.join(cacheDirectory, `${relativeCachePath}.${process.pid}`)
    const cachePath = path.join(cacheDirectory, relativeCachePath)
    fs.writeFileSync(cacheTmpPath, code, 'utf8')
    fs.renameSync(cacheTmpPath, cachePath)
  } catch (err) {
    console.error(err)
  }
}
 runs(() => {
   expect(preview.getTitle()).toBe('file.markdown Preview')
   preview.onDidChangeTitle(titleChangedCallback)
   fs.renameSync(
     atom.workspace.getActiveTextEditor().getPath(),
     path.join(
       path.dirname(atom.workspace.getActiveTextEditor().getPath()),
       'file2.md'
     )
   )
 })
示例#4
0
function copyRepository () {
  const workingDirPath = temp.mkdirSync('atom-spec-git')
  fs.copySync(
    path.join(__dirname, 'fixtures', 'git', 'working-dir'),
    workingDirPath
  )
  fs.renameSync(
    path.join(workingDirPath, 'git.git'),
    path.join(workingDirPath, '.git')
  )
  return workingDirPath
}
示例#5
0
文件: package-task.js 项目: OJFord/N1
  function runCopyAPM(buildPath, electronVersion, platform, arch, callback) {
    // Move APM up out of the /app folder which will be inside the ASAR
    const apmTargetDir = path.resolve(buildPath, '..', 'apm');
    fs.moveSync(path.join(buildPath, 'apm'), apmTargetDir)

    // Move /apm/node_modules/atom-package-manager up a level. We're essentially
    // pulling the atom-package-manager module up outside of the node_modules folder,
    // which is necessary because npmV3 installs nested dependencies in the same dir.
    const apmPackageDir = path.join(apmTargetDir, 'node_modules', 'atom-package-manager')
    for (const name of fs.readdirSync(apmPackageDir)) {
      fs.renameSync(path.join(apmPackageDir, name), path.join(apmTargetDir, name));
    }

    const apmSymlink = path.join(apmTargetDir, 'node_modules', '.bin', 'apm');
    if (fs.existsSync(apmSymlink)) {
      fs.unlinkSync(apmSymlink);
    }
    fs.rmdirSync(apmPackageDir);
    callback();
  }
 function adjustArcConfig(dir: string) {
   fs.renameSync(
     nuclideUri.join(dir, '.arcconfig.test'),
     nuclideUri.join(dir, '.arcconfig'));
 }
示例#7
0
 function adjustArcConfig(dir: string) {
   fs.renameSync(
     path.join(dir, '.arcconfig.test'),
     path.join(dir, '.arcconfig'));
 }
示例#8
0
 const reGit = (name) => {
   fs.renameSync(path.join(workingDirectory, name, 'git.git'), path.join(workingDirectory, name, '.git'))
 }
示例#9
0
function copyRepository (name = 'working-dir') {
  const workingDirPath = temp.mkdirSync('atom-working-dir')
  fs.copySync(path.join(__dirname, 'fixtures', 'git', name), workingDirPath)
  fs.renameSync(path.join(workingDirPath, 'git.git'), path.join(workingDirPath, '.git'))
  return fs.realpathSync(workingDirPath)
}
示例#10
0
function writeCachedJavascript (relativeCachePath, code) {
  var cacheTmpPath = path.join(cacheDirectory, relativeCachePath + '.' + process.pid)
  var cachePath = path.join(cacheDirectory, relativeCachePath)
  fs.writeFileSync(cacheTmpPath, code, 'utf8')
  fs.renameSync(cacheTmpPath, cachePath)
}