Skip to content
Snippets Groups Projects
Commit 0f6da420 authored by Daniel Bayley's avatar Daniel Bayley
Browse files

Tidy up

parent fb5670e3
No related branches found
No related tags found
No related merge requests found
...@@ -4,11 +4,15 @@ root = true ...@@ -4,11 +4,15 @@ root = true
end_of_line = LF end_of_line = LF
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab indent_style = tab
indent_size = 2 indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[{*.md,package.json}]
indent_style = space
indent_size = 2
{execSync, exec} = require 'child_process' {execSync, exec} = require 'child_process'
{writeFile, unlink} = require 'fs' {writeFile, unlink} = require 'fs'
SubAtom = require 'sub-atom'
tmp = '/tmp/GitKraken.json'
id = 'com.axosoft.GitKraken'
selector = '[class^="status-bar"] .git-branch'
#-------------------------------------------------------------------------------
module.exports = module.exports =
#os: process.platform #os: process.platform
#timeout: #timeout:
#timeout: 10000 #timeout: 10000
#killSignal: 'SIGKILL' #killSignal: 'SIGKILL'
subs: null
activate: -> project: atom.project.getDirectories()[0]
SubAtom = require 'sub-atom' tmp: '/tmp/GitKraken.json'
@subs = new SubAtom
id: 'com.axosoft.GitKraken'
selector: '[class^=status-bar] .git-branch'
subs: new SubAtom
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
activate: ->
@subs.add atom.commands.add 'atom-workspace', @subs.add atom.commands.add 'atom-workspace',
'gitkraken:release': => @open() 'gitkraken:release': => @open @project
atom.packages.onDidActivateInitialPackages => atom.packages.onDidActivateInitialPackages =>
@subs.add 'status-bar','click', selector, @open @subs.add 'status-bar','click', selector, @open @project
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
open: -> open: ({path}) ->
{path} = atom.project.getDirectories()[0]
if atom.config.get 'gitkraken.singleInstance' if atom.config.get 'gitkraken.singleInstance'
exec "pkill GitKraken; sleep .1 && open -Fb #{id} --args -p '#{path}'" #, @timeout exec "pkill GitKraken; sleep .1 && open -Fb #{@id} --args -p '#{path}'" #, @timeout
else else
projects = {} projects = {}
try try
projects = require tmp projects = require @tmp
execSync "ps #{projects[path]} | grep -q GitKraken && execSync "ps #{projects[path]} | grep -q GitKraken &&
open -b #{id} --args -p '#{path}'" open -b #{@id} --args -p '#{path}'"
catch catch
pid = execSync "open -nb #{id} --args -p '#{path}' & echo $!" pid = execSync "open -nb #{@id} --args -p '#{path}' & echo $!"
projects[path] = (parseInt pid) + 1 projects[path] = (parseInt pid) + 1
writeFile tmp, JSON.stringify projects writeFile @tmp, JSON.stringify projects
window.addEventListener 'beforeunload', -> window.addEventListener 'beforeunload', ->
exec "kill #{projects[path]}" exec "kill #{projects[path]}"
...@@ -47,4 +46,4 @@ module.exports = ...@@ -47,4 +46,4 @@ module.exports =
deactivate: -> deactivate: ->
@subs.dispose() @subs.dispose()
window.removeEventListener 'beforeunload' window.removeEventListener 'beforeunload'
unlink tmp unlink @tmp
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment