Skip to content
Permalink
Browse files

feat(option): add build option exclude.default.client.files which is …

…a boolean and defaults to false
  • Loading branch information
jyounce committed Nov 13, 2015
1 parent 462a0a7 commit 8ec2049578428b336af8cdeb96b1d96c0b4d1920
@@ -176,6 +176,7 @@ package.json
# exclude.spa = (boolean) defaults to false = set to true to exclude spa.html from client dist
# exclude.angular.files = (boolean) defaults to false = set to true to exclude the angular files that come with rapid-build from dist (lib and modules)
# exclude.angular.modules = (boolean) defaults to false = set to true to exclude injecting the angular modules that come with rapid-build ['ngResource', 'ngRoute', 'ngSanitize']
# exclude.default.client.files = (boolean) defaults to false = set to true to exclude the client files rapid-build sends to the dist client directory
# exclude.default.server.files = (boolean) defaults to false = set to true to exclude the server files rapid-build sends to the dist server directory
# exclude.from.cacheBust = (array of strings) = file paths: exclude files from the cache bust
# exclude.from.minFile[scripts|styles] = (array of strings) = file paths: exclude script or style files from automatically being generated in the scripts.min.js or styles.min.css file
@@ -25,6 +25,8 @@ module.exports = (config, options) ->
angular:
files: get.opt.deep2 'angular', 'files', false
default:
client:
files: get.opt.deep3 'default', 'client', 'files', false
server:
files: get.opt.deep3 'default', 'server', 'files', false
rb:
@@ -95,6 +95,7 @@ module.exports = (config, options) ->
options.exclude.spa = null unless isType.boolean options.exclude.spa
options.exclude.angular.files = null unless isType.boolean options.exclude.angular.files
options.exclude.angular.modules = null unless isType.boolean options.exclude.angular.modules
options.exclude.default.client = {} unless isType.object options.exclude.default.client
options.exclude.default.server = {} unless isType.object options.exclude.default.server
options.exclude.from.cacheBust = null unless isType.array options.exclude.from.cacheBust
options.exclude.from.minFile = {} unless isType.object options.exclude.from.minFile
@@ -106,6 +107,7 @@ module.exports = (config, options) ->
options.exclude.from.spaFile.styles = null unless isType.array options.exclude.from.spaFile.styles
options.exclude.from.dist.client = null unless isType.array options.exclude.from.dist.client
options.exclude.from.dist.server = null unless isType.array options.exclude.from.dist.server
options.exclude.default.client.files = null unless isType.boolean options.exclude.default.client.files
options.exclude.default.server.files = null unless isType.boolean options.exclude.default.server.files

testOptions = ->
@@ -22,10 +22,12 @@ module.exports = (gulp, config) ->

# clean
# =====
taskHelp.addTask 'clean-config', '/clean/clean-config'
taskHelp.addTask 'clean-dist', '/clean/clean-dist'
taskHelp.addTask 'clean-files', '/clean/clean-files'
taskHelp.addTask 'cleanup-client', '/clean/cleanup-client'
taskHelp.addTask 'clean-config', '/clean/clean-config'
taskHelp.addTask 'clean-dist', '/clean/clean-dist'
taskHelp.addTask 'clean-files', '/clean/clean-files'
taskHelp.addTask 'clean-rb-client', '/clean/clean-rb-client'
taskHelp.addTask 'clean-rb-client:test', '/clean/clean-rb-client', env: 'test'
taskHelp.addTask 'cleanup-client', '/clean/cleanup-client'

# common
# ======
@@ -116,6 +118,7 @@ module.exports = (gulp, config) ->
taskHelp.addTask 'copy-client-tests', '/test/client/copy-client-tests'
taskHelp.addTask 'run-client-tests', '/test/client/run-client-tests'
taskHelp.addTask 'run-client-tests:dev', '/test/client/run-client-tests', env: 'dev'

# server test
# ===========
taskHelp.addTask 'clean-server-test-dist', '/test/server/clean-server-test-dist'
@@ -0,0 +1,41 @@
module.exports = (config, gulp, taskOpts={}) ->
q = require 'q'
del = require 'del'
promiseHelp = require "#{config.req.helpers}/promise"
configHelp = require("#{config.req.helpers}/config") config

# tasks
# =====
cleanRbClient = ->
defer = q.defer()
src = config.dist.rb.client.dir
del(src, force:true).then (paths) ->
# console.log 'removed rb client dist dir'.yellow
defer.resolve()
defer.promise

rebuildConfig = (env) ->
return promiseHelp.get() if env is 'test'
return promiseHelp.get() if config.spa.custom
return promiseHelp.get() if config.exclude.spa
config.exclude.spa = true
configHelp.buildFile true, 'rebuild'

# API
# ===
api =
runTask: (env) ->
defer = q.defer()
q.all([
cleanRbClient()
rebuildConfig env
]).done ->
# console.log 'cleaned rb client dist'.yellow
defer.resolve()
defer.promise

# return
# ======
return promiseHelp.get() unless config.exclude.default.client.files
api.runTask taskOpts.env

@@ -29,6 +29,7 @@ module.exports = (config, gulp, taskOpts={}) ->
"#{config.rb.prefix.task}copy-extra-files:client"
]
"#{config.rb.prefix.task}absolute-css-urls"
"#{config.rb.prefix.task}clean-rb-client" # if exclude.default.client.files
"#{config.rb.prefix.task}build-files"
cb
)
@@ -16,6 +16,7 @@ module.exports = (config, gulp, taskOpts={}) ->
"#{config.rb.prefix.task}copy-angular-mocks"
]
"#{config.rb.prefix.task}copy-client-tests"
"#{config.rb.prefix.task}clean-rb-client:test" # if exclude.default.client.files
"#{config.rb.prefix.task}build-client-test-files"
cb
)
@@ -123,8 +123,9 @@ module.exports = (config, gulp) ->
# html watch (handle angular template cache)
# ==========================================
htmlWatch = (views) ->
return if config.angular.templateCache.dev
createWatch views, 'tCache', lang:'html', srcType:'views', taskOnly:true, logTaskName:'template cache'
if config.angular.templateCache.dev
return promiseHelp.get() if config.exclude.default.client.files
return createWatch views, 'tCache', lang:'html', srcType:'views', taskOnly:true, logTaskName:'template cache'
createWatch views, 'html', lang:'html', srcType:'views', bsReload:true

# spa watch (if custom spa file then watch it)

0 comments on commit 8ec2049

Please sign in to comment.
You can’t perform that action at this time.