mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Show Atom's version.
This commit is contained in:
19
atom.gyp
19
atom.gyp
@@ -1,4 +1,7 @@
|
||||
{
|
||||
'variables': {
|
||||
'version%': "<!(git rev-parse --short HEAD)",
|
||||
},
|
||||
'includes': [
|
||||
'sources.gypi',
|
||||
],
|
||||
@@ -76,6 +79,22 @@
|
||||
],
|
||||
},
|
||||
],
|
||||
'actions': [
|
||||
{
|
||||
'action_name': 'generate_version',
|
||||
'inputs': [
|
||||
'script/generate-version',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/Atom.app/Contents/Resources/version'
|
||||
],
|
||||
'action': [
|
||||
'script/generate-version',
|
||||
'<(version)',
|
||||
'<(PRODUCT_DIR)/Atom.app/Contents/Resources/version'
|
||||
]
|
||||
},
|
||||
],
|
||||
'postbuilds': [
|
||||
{
|
||||
'postbuild_name': 'Copy Static Files',
|
||||
|
||||
3
script/generate-version
Executable file
3
script/generate-version
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -n $1 > $2
|
||||
@@ -262,4 +262,4 @@ window.atom =
|
||||
console.error "Failed to load `#{userInitScriptPath}`", error.stack, error
|
||||
|
||||
getVersion: ->
|
||||
@sendMessageToBrowserProcess('getVersion')
|
||||
ipc.sendChannelSync 'get-version'
|
||||
|
||||
@@ -13,6 +13,9 @@ testMode = false
|
||||
getHomeDir = ->
|
||||
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||
|
||||
getVersion = ->
|
||||
String fs.readFileSync(path.join(__dirname, '..', '..', 'version'))
|
||||
|
||||
setupNodePath = ->
|
||||
resourcePaths = [
|
||||
'src/stdlib',
|
||||
@@ -120,6 +123,7 @@ class AtomApplication
|
||||
label: 'Atom'
|
||||
submenu: [
|
||||
{ label: 'About Atom', selector: 'orderFrontStandardAboutPanel:' }
|
||||
{ label: "Version #{getVersion()}", enabled: false }
|
||||
{ type: 'separator' }
|
||||
{ label: 'Preferences...', accelerator: 'Command+,', click: => @openConfig() }
|
||||
{ type: 'separator' }
|
||||
@@ -184,6 +188,9 @@ class AtomApplication
|
||||
ipc.on 'new-window', =>
|
||||
@open()
|
||||
|
||||
ipc.on 'get-version', (event) ->
|
||||
event.result = getVersion()
|
||||
|
||||
sendCommand: (command) ->
|
||||
atomWindow.sendCommand command for atomWindow in @windows when atomWindow.browserWindow.isFocused()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user