Last active
June 15, 2018 15:55
-
-
Save jmcmellen/b25bb117474c110100f3a7c899f1c9de to your computer and use it in GitHub Desktop.
Atom init script. This shows how to make atom understand my paths, and use ssh-agent for git stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> | |
# console.log "Saved! #{editor.getPath()}" | |
execSync = require('child_process').execSync | |
process.env.PATH = "C:\\ProgramData\\Anaconda2;C:\\ProgramData\\Anaconda2\\Library\\mingw-w64\\bin;C:\\ProgramData\\Anaconda2\\Library\\usr\\bin;C:\\ProgramData\\Anaconda2\\Library\\bin;C:\\ProgramData\\Anaconda2\\Scripts;C:\\ProgramData\\Anaconda2\\bin;" + process.env.PATH | |
process.env.PATH = process.env.PATH + ";C:\\Users\\jmcmellen\\bettershell\\cmder\\vendor\\git-for-windows\\cmd;C:\\Users\\jmcmellen\\bettershell\\cmder\\vendor\\git-for-windows\\usr\\bin;" | |
process.env.PATH = process.env.PATH + "C:\\Ruby22-x64\\bin" | |
cwd = "C:\\Users\\jmcmellen" | |
errMessage = "" | |
ssh_agent = "start-ssh-agent.cmd" | |
try | |
output = execSync ssh_agent, {cwd, timeout: 10e3, env: {'SVN_SSH': '', 'SSH_AGENT_PID': '', 'SSH_AUTH_SOCK': ''}, stdio: 'pipe', shell: 'cmd.exe'} | |
output = output.toString() | |
console.log "Hello" | |
agent_pid = output.match(/found ssh-agent at (.+)/i)[1] | |
agent_socket = output.match(/found ssh-agent socket at (.+)/i)[1] | |
process.env.SSH_AGENT_PID=agent_pid | |
process.env.SSH_AUTH_SOCK=agent_socket | |
process.env.SVN_SSH="C:\\Users\\jmcmellen\\bettershell\\cmder\\vendor\\git-for-windows\\bin\\ssh.exe" | |
atom.notifications.addSuccess("Success", {detail: output, dismissable: false }) | |
catch e | |
console.log e | |
errMessage += '\n' + e.stderr.toString() | |
atom.notifications.addWarning('Attention', {detail: dirMessage, dismissable: true }) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment