Fixed #1816. Cleaned up logging in config.coffee.

This commit is contained in:
Scott Erickson 2014-11-29 13:47:04 -08:00
parent 129e07e231
commit 02ddd7f698
4 changed files with 26 additions and 28 deletions

View file

@ -82,4 +82,4 @@ block modal-footer
div.network-login
.gplus-login-button#gplus-login-button
div#recover-account-wrapper
a(data-toggle="coco-modal", data-target="modal/RecoverModal", data-i18n="login.recover")#link-to-recover recover account
a(data-toggle="coco-modal", data-target="core/RecoverModal", data-i18n="login.recover")#link-to-recover recover account

View file

@ -1,5 +1,5 @@
ModalView = require 'views/core/ModalView'
template = require 'templates/modal/recover'
template = require 'templates/core/recover-modal'
forms = require 'core/forms'
{genericFailure} = require 'core/errors'

View file

@ -10,29 +10,6 @@ commonjsHeader = fs.readFileSync('node_modules/brunch/node_modules/commonjs-requ
regJoin = (s) -> new RegExp(s.replace(/\//, '[\\\/\\\\]'))
#- Find all .coffee and .jade files in /app
dirStack = ['./app']
coffeeFiles = []
jadeFiles = []
while dirStack.length
dir = dirStack.pop()
contents = fs.readdirSync(dir)
for file in contents
fullPath = "#{dir}/#{file}"
stat = fs.statSync(fullPath)
if stat.isDirectory()
dirStack.push(fullPath)
else
if _.str.endsWith(file, '.coffee')
coffeeFiles.push(fullPath)
else if _.str.endsWith(file, '.jade')
jadeFiles.push(fullPath)
console.log "Got #{coffeeFiles.length} coffee files and #{jadeFiles.length} jade files."
#- Build the config
exports.config =
@ -102,6 +79,8 @@ exports.config =
#- test, demo libraries
'javascripts/test-app.js': regJoin('^test/app/')
'javascripts/demo-app.js': regJoin('^test/demo/')
#- More output files are generated at the below
order:
before: [
@ -180,11 +159,31 @@ exports.config =
defn = if path in needHeaders then commonjsHeader else ''
return defn
#- Find all .coffee and .jade files in /app
dirStack = ['./app']
coffeeFiles = []
jadeFiles = []
while dirStack.length
dir = dirStack.pop()
contents = fs.readdirSync(dir)
for file in contents
fullPath = "#{dir}/#{file}"
stat = fs.statSync(fullPath)
if stat.isDirectory()
dirStack.push(fullPath)
else
if _.str.endsWith(file, '.coffee')
coffeeFiles.push(fullPath)
else if _.str.endsWith(file, '.jade')
jadeFiles.push(fullPath)
for file in coffeeFiles
inputFile = file.replace('./app', 'app')
outputFile = file.replace('.coffee', '.js').replace('./app', 'javascripts/app')
exports.config.files.javascripts.joinTo[outputFile] = inputFile
console.log 'output file?', outputFile
numBundles = 0
@ -199,7 +198,6 @@ for file in jadeFiles
possibleViewFilePath = outputFile.replace(templateFileName, viewFileName).replace('/templates/', '/views/')
if exports.config.files.javascripts.joinTo[possibleViewFilePath]
exports.config.files.templates.joinTo[possibleViewFilePath] = inputFile
console.log 'bundling', inputFile, 'to', possibleViewFilePath
numBundles += 1
console.log 'Bundled', numBundles, 'templates with their views.'
console.log "Got #{coffeeFiles.length} coffee files and #{jadeFiles.length} jade files (bundled #{numBundles} of them together)."