Also change the version field of package.json in set-development-version task.

Esse commit está contido em:
Cheng Zhao
2013-12-05 18:13:42 +08:00
commit a7db8229d5
2 arquivos alterados com 32 adições e 23 exclusões
+1 -1
Ver Arquivo
@@ -3,11 +3,11 @@
set -e set -e
BUILT_PRODUCTS_DIR=$1 BUILT_PRODUCTS_DIR=$1
VERSION=$2
PLIST_PATH="$BUILT_PRODUCTS_DIR/Atom.app/Contents/Info.plist" PLIST_PATH="$BUILT_PRODUCTS_DIR/Atom.app/Contents/Info.plist"
HELPER_PLIST_PATH="$BUILT_PRODUCTS_DIR/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/Info.plist" HELPER_PLIST_PATH="$BUILT_PRODUCTS_DIR/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/Info.plist"
# Update version # Update version
VERSION=$(git rev-parse --short HEAD | tr -d "\n")
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$PLIST_PATH" /usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$PLIST_PATH" /usr/libexec/PlistBuddy -c "Set CFBundleVersion $VERSION" "$PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$HELPER_PLIST_PATH" /usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $VERSION" "$HELPER_PLIST_PATH"
+31 -22
Ver Arquivo
@@ -1,3 +1,4 @@
fs = require 'fs'
path = require 'path' path = require 'path'
module.exports = (grunt) -> module.exports = (grunt) ->
@@ -6,27 +7,35 @@ module.exports = (grunt) ->
grunt.registerTask 'set-development-version', 'Sets version to current SHA-1', -> grunt.registerTask 'set-development-version', 'Sets version to current SHA-1', ->
done = @async() done = @async()
if process.platform is 'darwin' cmd = 'git'
cmd = 'script/set-version' args = ['rev-parse', '--short', 'HEAD']
args = [grunt.config.get('atom.buildDir')] spawn {cmd, args}, (error, result, code) ->
spawn {cmd, args}, (error, result, code) -> done(error) return done(error) if error?
else if process.platform is 'win32'
shellAppDir = grunt.config.get('atom.shellAppDir')
shellExePath = path.join(shellAppDir, 'atom.exe')
cmd = 'git' version = result.stdout.trim()
args = ['rev-parse', '--short', 'HEAD'] appDir = grunt.config.get('atom.appDir')
spawn {cmd, args}, (error, result, code) ->
if error?
done(error)
else
version = result.stdout.trim()
strings =
CompanyName: 'GitHub, Inc.'
FileDescription: 'The hackable, collaborative editor of tomorrow!'
LegalCopyright: 'Copyright (C) 2013 GitHub, Inc. All rights reserved'
ProductName: 'Atom'
ProductVersion: version
rcedit = require('rcedit') # Replace version field of package.json.
rcedit(shellExePath, {'version-string': strings}, done) packageJsonPath = path.join(appDir, 'package.json')
packageJson = require(packageJsonPath)
packageJson.version = version
packageJsonString = JSON.stringify(packageJson, null, 2)
fs.writeFileSync(packageJsonPath, packageJsonString)
if process.platform is 'darwin'
cmd = 'script/set-version'
args = [grunt.config.get('atom.buildDir'), version]
spawn {cmd, args}, (error, result, code) -> done(error)
else if process.platform is 'win32'
shellAppDir = grunt.config.get('atom.shellAppDir')
shellExePath = path.join(shellAppDir, 'atom.exe')
strings =
CompanyName: 'GitHub, Inc.'
FileDescription: 'The hackable, collaborative editor of tomorrow!'
LegalCopyright: 'Copyright (C) 2013 GitHub, Inc. All rights reserved'
ProductName: 'Atom'
ProductVersion: version
rcedit = require('rcedit')
rcedit(shellExePath, {'version-string': strings}, done)