Permalink
Browse files

Updated Cake File

  • Loading branch information...
1 parent 83df93b commit 2dd0b0e6c9aa39d251277c3fd4318727f413d4f9 @joshbtn committed Oct 10, 2012
Showing with 14 additions and 86 deletions.
  1. +14 −86 Cakefile
View
@@ -5,23 +5,21 @@ fs = require 'fs'
querystring = require 'querystring'
#Globals
-COMPILER_PATH = './node_modules/closure-compiler/lib/vendor/compiler.jar'
VERSION = '0.9.4'
YEAR = (new Date).getFullYear
LICENSE = fs.readFileSync './license.include', 'utf8'
-#build
+COMPILER_PATH = './node_modules/closure-compiler/lib/vendor/compiler.jar'
+DOCCO_PATH = './node_modules/docco/lib/docco.js'
+CORE_PATH = './src/core.js'
+EXCEL_FORMULA_UTILITIES_PATH = './src/ExcelFormulaUtilities.js'
+LICENSE_PATH = './license.include'
+DEV_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.js"
+PROD_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.min.js"
+
+# build
#------
-#This is the offline build.
-#Requires:
-# (mac, linux, cygwin(windows), minGW(windows)), node, npm, coffee-script, docco, and the google closure compiler.
task 'build', 'Building', ->
- # Join all the files together
- CORE_PATH = './src/core.js'
- EXCEL_FORMULA_UTILITIES_PATH = './src/ExcelFormulaUtilities.js'
- LICENSE_PATH = './license.include'
- DEV_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.js"
- PROD_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.min.js"
fileLicense = fs.readFileSync(LICENSE_PATH, 'utf8').toString().replace('#{VERSION}', "#{VERSION}").replace('#{YEAR}', (new Date()).getFullYear())
jsFileCore = fs.readFileSync CORE_PATH, 'utf8'
@@ -35,79 +33,9 @@ task 'build', 'Building', ->
# Minify
exec "java -jar #{COMPILER_PATH} --compilation_level SIMPLE_OPTIMIZATIONS --js ./src/core.js --js ./src/ExcelFormulaUtilities.js --js_output_file ./excelFormulaUtilities-#{VERSION}.min.js" , (err, stdout, stderr) ->
- throw err if err
- cnosole.log stdout + stderr
-
-
-
- exec 'node_modules/.bin/docco ./src/*.js', (err, stdout, stderr) ->
- throw err if err
- console.log stdout + stderr
-
-
-
-#Build for cloud9IDE
-#-------------------
-#
-#To get up and running on cloud9ide check out the wiki section.
-#
-task 'cloudBuild', 'Building in the cloud.', ->
- CORE_PATH = './src/core.js'
- EXCEL_FORMULA_UTILITIES_PATH = './src/ExcelFormulaUtilities.js'
- LICENSE_PATH = './license.include'
- DEV_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.js"
- PROD_BUILD_PATH = "./excelFormulaUtilities-#{VERSION}.min.js"
-
- fileLicense = fs.readFileSync(LICENSE_PATH, 'utf8').toString().replace('#{VERSION}', "#{VERSION}").replace('#{YEAR}', (new Date()).getFullYear())
- jsFileCore = fs.readFileSync CORE_PATH, 'utf8'
- jsFileExcelFormulaUtilities = fs.readFileSync EXCEL_FORMULA_UTILITIES_PATH, 'utf8'
-
- jsCode = jsFileCore + "\n" + jsFileExcelFormulaUtilities
-
- fs.writeFile DEV_BUILD_PATH, jsCode, 'utf8', (err)->
- console.log "Saved script to #{DEV_BUILD_PATH}"
-
- data =
- 'compilation_level': 'SIMPLE_OPTIMIZATIONS',
- 'output_format' : 'text',
- 'output_info' : 'compiled_code',
- 'warning_level' : 'QUIET',
- 'js_code' : jsCode
-
- query = querystring.stringify data
-
- headers =
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Content-Length': query.length
-
- options =
- 'host': 'closure-compiler.appspot.com',
- 'port': '80',
- 'path': "/compile",
- 'method': 'POST',
- 'headers': headers
-
- req = http.request options, (res)->
- res.setEncoding('utf-8')
- jsCompiled =''
-
-
- res.on 'end', (e)->
- fs.writeFile PROD_BUILD_PATH, "#{fileLicense}\n#{jsCompiled}", 'utf8', (err)->
- if err?
- throw err
- console.log "Saved compiled script to #{PROD_BUILD_PATH}"
- res.on 'data', (chunk)->
- jsCompiled += chunk
-
+ throw err if err
+ cnosole.log stdout + stderr
- req.on 'error', (e)->
- console.log('problem with request: ' + e.message);
-
- req.on 'close', (e)->
- console.log('end')
-
- req.write query
- req.end
-
- #TODO Get docco working with cloud9.
+ exec "node #{DOCCO_PATH} ./src/*.js", (err, stdout, stderr) ->
+ throw err if err
+ console.log stdout + stderr

0 comments on commit 2dd0b0e

Please sign in to comment.