Skip to content

Commit

Permalink
Merge pull request #3 from stevematney/add-basedir
Browse files Browse the repository at this point in the history
Pre-building the proper files so the build doesn't early-exit.
  • Loading branch information
bobpace committed Jul 7, 2014
2 parents 1f4abdf + 73fc119 commit 12f8493
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 24 deletions.
8 changes: 5 additions & 3 deletions lib/config.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions lib/fubu-import.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions lib/scaffolding.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

_ = require "lodash"
path = require 'path'
fs = require 'fs'

exports.defaults = ->
fubumvc:
Expand Down Expand Up @@ -40,7 +41,7 @@ exports.validate = (config, validators) ->

{excludePaths, conventions, usePolling, interval, binaryInterval, baseDir} = fubumvc

unless !baseDir? or (baseDir? and path.existsSync baseDir)
unless !baseDir? or (baseDir? and fs.existsSync baseDir)
errors.push "fubumvc.baseDir"
return errors

Expand Down
5 changes: 3 additions & 2 deletions src/fubu-import.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,12 @@ cleanAssets = (mimosaConfig, options, next) ->
mimosaConfig.fubumvc
extensions = buildExtensions mimosaConfig
options = {sourceDir, conventions, baseDir}
setWorkingDir baseDir

filesFor = (target) ->
log "debug", "finding files for: #{target} with extensions: #{extensions} and excludePaths: #{excludePaths}"
files = findSourceFiles target, extensions, excludePaths
outputFiles = _.map files, (f) -> transformPath f, target, options, mimosaConfig
files = findSourceFiles target, extensions, excludePaths, baseDir
outputFiles = _.map files, (f) -> transformPath f, target, options
[target, files, outputFiles]

targets = getTargets workingDir
Expand Down
5 changes: 4 additions & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ fubuImport = require './fubu-import'
scaffolding = require './scaffolding'

registration = (mimosaConfig, register) ->
register ['preBuild'], 'init', fubuImport.importAssets
mimosaConfig.log["info"] "setting up fubumvc"
scaffolding.setupFileSystemWithConfig mimosaConfig
register ['preBuild'], 'init', (mimosaConfig, options, next) ->
fubuImport.importAssets mimosaConfig, options, next
register ['postClean'], 'init', fubuImport.cleanAssets

registerCommand = (program, retrieveConfig) ->
Expand Down
11 changes: 7 additions & 4 deletions src/scaffolding.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ cwd = process.cwd()

setupFileSystem = (args, retrieveConfig) ->
retrieveConfig(false, (config) ->
baseDir = if config.fubumvc then config.fubumvc.baseDir else cwd
makeFolders(baseDir)
initFiles(args, baseDir)
setupFileSystemWithConfig config, args
)

setupFileSystemWithConfig = (config, args) ->
baseDir = if config.fubumvc then config.fubumvc.baseDir else cwd
makeFolders(baseDir)
initFiles(args, baseDir)

resetFileSystem = (args, retrieveConfig) ->
retrieveConfig(false, (config) ->
Expand Down Expand Up @@ -82,4 +85,4 @@ copyContents = ([fileName, contents]) ->
log "info", "creating #{fileName}"
fs.writeFileSync fileName, contents

module.exports = {setupFileSystem, resetFileSystem}
module.exports = {setupFileSystem, resetFileSystem, setupFileSystemWithConfig}

0 comments on commit 12f8493

Please sign in to comment.