Install atom executable during window.startup()

Previously this was done during `rake install`.

Also default to `~/github/atom` as the default resource path
when no `--resource-path` argument is specified.  This argument
will now be required when running in dev mode if the repository
is not at the default location.

Closes #300
This commit is contained in:
Kevin Sawicki
2013-02-22 20:49:37 -08:00
parent c7ff431d13
commit d35c871e17
6 changed files with 59 additions and 39 deletions

View File

@@ -1,5 +1,6 @@
fs = require 'fs'
$ = require 'jquery'
ChildProcess = require 'child-process'
require 'jquery-extensions'
require 'underscore-extensions'
require 'space-pen-extensions'
@@ -39,6 +40,7 @@ window.setUpEnvironment = ->
# This method is only called when opening a real application window
window.startup = ->
installAtomCommand('/opt/github/bin/atom')
handleWindowEvents()
config.load()
atom.loadTextPackage()
@@ -65,6 +67,14 @@ window.shutdown = ->
window.rootView = null
window.project = null
window.installAtomCommand = (commandPath) ->
return if fs.exists(commandPath)
bundledCommandPath = fs.resolve(window.resourcePath, 'atom.sh')
if bundledCommandPath?
fs.write(commandPath, fs.read(bundledCommandPath))
ChildProcess.exec("chmod u+x '#{commandPath}'")
window.handleWindowEvents = ->
$(window).on 'core:close', => window.close()
$(window).command 'window:close', => window.close()