Created
April 23, 2012 20:22
-
-
Save mikebevz/2473574 to your computer and use it in GitHub Desktop.
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
path = require "path" | |
fs = require 'fs' | |
{exec} = require 'child_process' | |
SDKPath = "/Developer/WWSDK-2.3.1.5" | |
buildPath = "./build" | |
mainJsPath = "./public/application.js" | |
mainCssPath = "./public/application.css" | |
publicPath = "./public" | |
archiveName = "ts" | |
zipFilename = "#{archiveName}.zip" | |
appArchivePath = "#{buildPath}/#{zipFilename}" | |
devicePass= "password_to_your_device" | |
codPath = "#{buildPath}/StandardInstall/#{archiveName}.cod" | |
javaloaderPath = "#{SDKPath}/bin/javaloader" | |
task 'clean', 'Clean temporary files', -> | |
console.log 'Cleaning up...' | |
exec "rm -Rf #{buildPath}", (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Deleted #{buildPath}" | |
return | |
exec 'mkdir build', (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Created build dir" | |
#TODO check for both files | |
exec "rm #{mainJsPath} #{mainCssPath}", (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Clean in public" | |
task 'archive', 'Archive application', -> | |
console.log 'Building with Hem...' | |
exec 'hem build', (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Archiving #{publicPath} with ZIP to #{appArchivePath}" | |
exec "cd #{publicPath}; zip -1 -r ../#{appArchivePath} .", (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Archived application to #{appArchivePath}" | |
task 'compile', "Compile blackberry app", -> | |
console.log "Compiling Blackberry App" | |
command = "#{SDKPath}/bbwp #{appArchivePath} -g #{devicePass} -o #{buildPath}" | |
console.log "Executing command #{command}" | |
exec command, (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Application compiled to #{buildPath}" | |
task 'deploy', "Compile blackberry app", -> | |
console.log "Deploying application to device" | |
exec "#{javaloaderPath} -w#{devicePass} load #{codPath}", (err, stdout, stderr) -> | |
throw err if err | |
console.log stdout + stderr | |
console.log "Application successfully deployed" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment