2013-10-21 18:23:22 +04:00
|
|
|
path = require 'path'
|
2014-02-24 05:19:00 +04:00
|
|
|
fs = require 'fs-plus'
|
2013-10-21 17:20:19 +04:00
|
|
|
temp = require 'temp'
|
2013-09-18 05:58:41 +04:00
|
|
|
installer = require '../src/command-installer'
|
2013-05-15 21:28:31 +04:00
|
|
|
|
|
|
|
describe "install(commandPath, callback)", ->
|
2014-01-23 01:35:07 +04:00
|
|
|
commandFilePath = temp.openSync("atom-command").path
|
|
|
|
commandName = path.basename(commandFilePath)
|
2014-01-23 03:54:49 +04:00
|
|
|
installationPath = temp.mkdirSync("atom-bin")
|
|
|
|
installationFilePath = path.join(installationPath, commandName)
|
2013-05-15 21:28:31 +04:00
|
|
|
|
|
|
|
beforeEach ->
|
2014-02-15 05:53:31 +04:00
|
|
|
fs.chmodSync(commandFilePath, '755')
|
2014-01-23 03:54:49 +04:00
|
|
|
spyOn(installer, 'getInstallDirectory').andReturn installationPath
|
2013-05-15 21:28:31 +04:00
|
|
|
|
2013-11-06 04:44:03 +04:00
|
|
|
describe "on #darwin", ->
|
|
|
|
it "symlinks the command and makes it executable", ->
|
2014-01-23 01:35:07 +04:00
|
|
|
expect(fs.isFileSync(commandFilePath)).toBeTruthy()
|
2014-01-23 03:54:49 +04:00
|
|
|
expect(fs.isFileSync(installationFilePath)).toBeFalsy()
|
2013-05-15 21:28:31 +04:00
|
|
|
|
2013-11-06 04:44:03 +04:00
|
|
|
installDone = false
|
|
|
|
installError = null
|
2014-02-13 22:08:08 +04:00
|
|
|
installer.install commandFilePath, false, (error) ->
|
2013-11-06 04:44:03 +04:00
|
|
|
installDone = true
|
|
|
|
installError = error
|
2013-05-15 21:28:31 +04:00
|
|
|
|
2014-01-23 01:35:07 +04:00
|
|
|
waitsFor ->
|
|
|
|
installDone
|
2013-05-15 21:28:31 +04:00
|
|
|
|
2013-11-06 04:44:03 +04:00
|
|
|
runs ->
|
|
|
|
expect(installError).toBeNull()
|
2014-01-23 03:54:49 +04:00
|
|
|
expect(fs.isFileSync(installationFilePath)).toBeTruthy()
|
|
|
|
expect(fs.realpathSync(installationFilePath)).toBe fs.realpathSync(commandFilePath)
|
|
|
|
expect(fs.isExecutableSync(installationFilePath)).toBeTruthy()
|