fix(build-flow): Undefined call to getVersion

This commit is contained in:
Ben Gotow 2015-08-21 16:51:59 -07:00
parent c639b85fad
commit 4faf2b1de2

View file

@ -8,6 +8,10 @@ Promise = require 'bluebird'
module.exports = (grunt) -> module.exports = (grunt) ->
{cp, spawn, rm} = require('./task-helpers')(grunt) {cp, spawn, rm} = require('./task-helpers')(grunt)
getVersion = ->
{version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
return version
appName = -> grunt.config.get('atom.appName') appName = -> grunt.config.get('atom.appName')
dmgName = -> "#{appName().split('.')[0]}.dmg" dmgName = -> "#{appName().split('.')[0]}.dmg"
zipName = -> "#{appName().split('.')[0]}.zip" zipName = -> "#{appName().split('.')[0]}.zip"
@ -19,12 +23,13 @@ module.exports = (grunt) ->
runEmailIntegrationTest = (s3Client) -> runEmailIntegrationTest = (s3Client) ->
buildDir = grunt.config.get('atom.buildDir') buildDir = grunt.config.get('atom.buildDir')
buildVersion = getVersion()
new Promise (resolve, reject) -> new Promise (resolve, reject) ->
appToRun = path.join(buildDir, appName()) appToRun = path.join(buildDir, appName())
scriptToRun = "./build/run-build-and-send-screenshot.scpt" scriptToRun = "./build/run-build-and-send-screenshot.scpt"
spawn spawn
cmd: "osascript" cmd: "osascript"
args: [scriptToRun, appToRun, getVersion()] args: [scriptToRun, appToRun, buildVersion]
, (error) -> , (error) ->
if error if error
reject(error) reject(error)
@ -85,10 +90,6 @@ module.exports = (grunt) ->
uploader.on "end", (data) -> uploader.on "end", (data) ->
resolve(data) resolve(data)
getVersion = ->
{version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
return version
uploadDMGToS3 = (s3Client) -> uploadDMGToS3 = (s3Client) ->
destName = "#{process.platform}/Edgehill_#{getVersion()}.dmg" destName = "#{process.platform}/Edgehill_#{getVersion()}.dmg"
dmgPath = path.join(grunt.config.get('atom.buildDir'), dmgName()) dmgPath = path.join(grunt.config.get('atom.buildDir'), dmgName())
@ -150,11 +151,12 @@ module.exports = (grunt) ->
s3Client = prepareS3() s3Client = prepareS3()
if s3Client if s3Client
Promise.all([runEmailIntegrationTest(), uploadDMGToS3(s3Client), uploadZipToS3(s3Client)]) runEmailIntegrationTest().then ->
.then -> Promise.all([uploadDMGToS3(s3Client), uploadZipToS3(s3Client)])
done() .then ->
.catch (err) -> done()
grunt.log.error(err) .catch (err) ->
return false grunt.log.error(err)
return false
else else
return false return false