🔥 ncp; use fs.copySync

This commit is contained in:
Max Brunsfeld 2015-02-12 22:14:02 -08:00
parent 30bd85d8cc
commit ac78cee584
2 changed files with 10 additions and 23 deletions

View File

@ -26,7 +26,6 @@
"harmony-collections": "~0.3.8", "harmony-collections": "~0.3.8",
"legal-eagle": "~0.9.0", "legal-eagle": "~0.9.0",
"minidump": "~0.8", "minidump": "~0.8",
"ncp": "^1.0.1",
"npm": "~1.4.5", "npm": "~1.4.5",
"rcedit": "~0.3.0", "rcedit": "~0.3.0",
"request": "~2.27.0", "request": "~2.27.0",

View File

@ -8,7 +8,6 @@ BufferedProcess = require '../src/buffered-process'
{Directory} = require 'pathwatcher' {Directory} = require 'pathwatcher'
GitRepository = require '../src/git-repository' GitRepository = require '../src/git-repository'
temp = require "temp" temp = require "temp"
{ncp} = require "../build/node_modules/ncp"
describe "Project", -> describe "Project", ->
beforeEach -> beforeEach ->
@ -235,29 +234,18 @@ describe "Project", ->
directory2 = temp.mkdirSync("git-repo1") directory2 = temp.mkdirSync("git-repo1")
directory3 = temp.mkdirSync("git-repo2") directory3 = temp.mkdirSync("git-repo2")
waitsFor (done) -> gitDirPath = fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git'))
ncp( fs.copySync(gitDirPath, path.join(directory2, ".git"))
fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git')), fs.copySync(gitDirPath, path.join(directory3, ".git"))
path.join(directory2, ".git"),
done
)
waitsFor (done) -> atom.project.setPaths([directory1, directory2, directory3])
ncp(
fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git')),
path.join(directory3, ".git"),
done
)
runs -> [repo1, repo2, repo3] = atom.project.getRepositories()
atom.project.setPaths([directory1, directory2, directory3]) expect(repo1).toBeNull()
expect(repo2.getShortHead()).toBe "master"
[repo1, repo2, repo3] = atom.project.getRepositories() expect(repo2.getPath()).toBe fs.realpathSync(path.join(directory2, ".git"))
expect(repo1).toBeNull() expect(repo3.getShortHead()).toBe "master"
expect(repo2.getShortHead()).toBe "master" expect(repo3.getPath()).toBe fs.realpathSync(path.join(directory3, ".git"))
expect(repo2.getPath()).toBe fs.realpathSync(path.join(directory2, ".git"))
expect(repo3.getShortHead()).toBe "master"
expect(repo3.getPath()).toBe fs.realpathSync(path.join(directory3, ".git"))
it "calls callbacks registered with ::onDidChangePaths", -> it "calls callbacks registered with ::onDidChangePaths", ->
onDidChangePathsSpy = jasmine.createSpy('onDidChangePaths spy') onDidChangePathsSpy = jasmine.createSpy('onDidChangePaths spy')