Skip to content
Permalink
Browse files

fix(api): change task test:prod to prod:test

  • Loading branch information
jyounce committed Sep 28, 2015
1 parent 25279b1 commit 8d19e4f1ff77cc19bc22b5b008844aeeca93a17e
Showing with 80 additions and 66 deletions.
  1. +2 −2 README.md
  2. +1 −2 config/config-angular.coffee
  3. +32 −19 config/config-env.coffee
  4. +9 −6 config/config-rb.coffee
  5. +36 −37 init/rapid.coffee
@@ -87,11 +87,11 @@ gulp.task('default', ['rapid-build'])
// or from the terminal type one of the 6:
gulp rapid-build
gulp rapid-build:test
gulp rapid-build:dev
gulp rapid-build:prod
gulp rapid-build:prod:server
gulp rapid-build:test
gulp rapid-build:test:prod
gulp rapid-build:prod:test
```

## Options API
@@ -68,10 +68,9 @@ module.exports = (config, options) ->
removeRbMocksModule()

angular.updateHttpBackendStatus = -> # called in update-angular-mocks-config
isDefaultOrDev = config.env.is.defaultOrDev
isDefaultOrDev = config.env.is.default or config.env.is.dev
isProd = config.env.is.prod
isTest = config.env.is.testClient
isTestProd = isProd and isTest
httpBackendDev = angular.httpBackend.dev
httpBackendProd = angular.httpBackend.prod
# the rules
@@ -14,28 +14,39 @@ module.exports = (config) ->
switch name
when 'default'
env.is.default = true
env.is.defaultOrDev = true
when 'dev'
env.is.dev = true
env.is.defaultOrDev = true
when 'prod'
env.is.prod = true
when 'test'
env.is.default = true
env.is.testClient = true
env.is.testServer = true
when 'test:prod'
env.is.prod = true
when 'test:client'
env.is.default = true
env.is.testClient = true
when 'test:server'
env.is.default = true
env.is.testServer = true
when 'test:client'
when 'dev'
env.is.dev = true
when 'dev:test'
env.is.dev = true
env.is.testClient = true
when 'test:client:prod'
env.is.prod = true
env.is.testServer = true
when 'dev:test:client'
env.is.dev = true
env.is.testClient = true
when 'test:server'
when 'dev:test:server'
env.is.dev = true
env.is.testServer = true
when 'test:server:prod'
when 'prod'
env.is.prod = true
when 'prod:test'
env.is.prod = true
env.is.testClient = true
env.is.testServer = true
when 'prod:test:client'
env.is.prod = true
env.is.testClient = true
when 'prod:test:server'
env.is.prod = true
env.is.testServer = true

# init env
@@ -47,7 +58,6 @@ module.exports = (config) ->
# ==
env.is =
default: true
defaultOrDev: true
dev: false
prod: false
testClient: false
@@ -57,14 +67,17 @@ module.exports = (config) ->
# =======
env.set = (taskSeqs) -> # called in 'set-env-config' which is called first in 'common'
switch taskSeqs[2]
when config.rb.tasks.dev then config.env.name = 'dev'
when config.rb.tasks.prod then config.env.name = 'prod'
when config.rb.tasks.test then config.env.name = 'test'
when config.rb.tasks['test:prod'] then config.env.name = 'test:prod'
when config.rb.tasks['test:client'] then config.env.name = 'test:client'
when config.rb.tasks['test:server'] then config.env.name = 'test:server'
when config.rb.tasks['test:client:prod'] then config.env.name = 'test:client:prod'
when config.rb.tasks['test:server:prod'] then config.env.name = 'test:server:prod'
when config.rb.tasks.dev then config.env.name = 'dev'
when config.rb.tasks['dev:test'] then config.env.name = 'dev:test'
when config.rb.tasks['dev:test:client'] then config.env.name = 'dev:test:client'
when config.rb.tasks['dev:test:server'] then config.env.name = 'dev:test:server'
when config.rb.tasks.prod then config.env.name = 'prod'
when config.rb.tasks['prod:test'] then config.env.name = 'prod:test'
when config.rb.tasks['prod:test:client'] then config.env.name = 'prod:test:client'
when config.rb.tasks['prod:test:server'] then config.env.name = 'prod:test:server'

setIsEnv()

@@ -14,15 +14,18 @@ module.exports = (config, rbDir) ->
# =========
rb.tasks = {}
rb.tasks.default = 'rapid-build'
rb.tasks.dev = "#{rb.tasks.default}:dev"
rb.tasks.prod = "#{rb.tasks.default}:prod"
rb.tasks['prod:server'] = "#{rb.tasks.default}:prod:server"
rb.tasks.test = "#{rb.tasks.default}:test"
rb.tasks['test:prod'] = "#{rb.tasks.default}:test:prod"
rb.tasks['test:client'] = "#{rb.tasks.default}:test:client"
rb.tasks['test:server'] = "#{rb.tasks.default}:test:server"
rb.tasks['test:client:prod'] = "#{rb.tasks.default}:test:client:prod"
rb.tasks['test:server:prod'] = "#{rb.tasks.default}:test:server:prod"
rb.tasks.dev = "#{rb.tasks.default}:dev"
rb.tasks['dev:test'] = "#{rb.tasks.default}:dev:test"
rb.tasks['dev:test:client'] = "#{rb.tasks.default}:dev:test:client"
rb.tasks['dev:test:server'] = "#{rb.tasks.default}:dev:test:server"
rb.tasks.prod = "#{rb.tasks.default}:prod"
rb.tasks['prod:server'] = "#{rb.tasks.default}:prod:server"
rb.tasks['prod:test'] = "#{rb.tasks.default}:prod:test"
rb.tasks['prod:test:client'] = "#{rb.tasks.default}:prod:test:client"
rb.tasks['prod:test:server'] = "#{rb.tasks.default}:prod:test:server"

# prefixes
# ========
@@ -53,30 +53,27 @@ module.exports = (gulp, config) ->
cb
) -> defer.resolve()

# test client
# ===========
gulp.task config.rb.tasks['test:client'], ["#{config.rb.prefix.task}common"], (cb) ->
# test default - client and server
# ================================
gulp.task config.rb.tasks['test'], ["#{config.rb.prefix.task}common"], (cb) ->
gulpSequence(
"#{config.rb.prefix.task}common-client"
"#{config.rb.prefix.task}build-spa"
"#{config.rb.prefix.task}common-test-client"
config.rb.tasks['test:client']
config.rb.tasks['test:server']
cb
) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['test']
) -> defer.resolve()

# Test client prod
# ================
gulp.task config.rb.tasks['test:client:prod'], ["#{config.rb.prefix.task}common"], (cb) ->
# test default - client
# =====================
gulp.task config.rb.tasks['test:client'], ["#{config.rb.prefix.task}common"], (cb) ->
gulpSequence(
"#{config.rb.prefix.task}common-client"
"#{config.rb.prefix.task}minify-client"
"#{config.rb.prefix.task}build-spa"
"#{config.rb.prefix.task}common-test-client"
"#{config.rb.prefix.task}clean-client-test-dist"
cb
) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['test:prod']

) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['test']

# test server
# ===========
# test default - server
# =====================
gulp.task config.rb.tasks['test:server'], ["#{config.rb.prefix.task}common"], (cb) ->
gulpSequence(
"#{config.rb.prefix.task}common-server"
@@ -85,35 +82,37 @@ module.exports = (gulp, config) ->
cb
) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['test']

# test server prod
# ================
gulp.task config.rb.tasks['test:server:prod'], ["#{config.rb.prefix.task}common"], (cb) ->
# test prod - client and server
# =============================
gulp.task config.rb.tasks['prod:test'], ["#{config.rb.prefix.task}common"], (cb) ->
gulpSequence(
"#{config.rb.prefix.task}common-server"
"#{config.rb.prefix.task}minify-server"
"#{config.rb.prefix.task}start-server"
"#{config.rb.prefix.task}common-test-server"
"#{config.rb.prefix.task}clean-server-test-dist"
config.rb.tasks['prod:test:client']
config.rb.tasks['prod:test:server']
cb
) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['test:prod']
) -> defer.resolve()

# test client and server
# ======================
gulp.task config.rb.tasks['test'], ["#{config.rb.prefix.task}common"], (cb) ->
# test prod - client
# ==================
gulp.task config.rb.tasks['prod:test:client'], ["#{config.rb.prefix.task}common"], (cb) ->
gulpSequence(
config.rb.tasks['test:client']
config.rb.tasks['test:server']
"#{config.rb.prefix.task}common-client"
"#{config.rb.prefix.task}minify-client"
"#{config.rb.prefix.task}common-test-client"
"#{config.rb.prefix.task}clean-client-test-dist"
cb
) -> defer.resolve()
) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['prod:test']

# test client and server
# ======================
gulp.task config.rb.tasks['test:prod'], ["#{config.rb.prefix.task}common"], (cb) ->
# test prod - server
# ==================
gulp.task config.rb.tasks['prod:test:server'], ["#{config.rb.prefix.task}common"], (cb) ->
gulpSequence(
config.rb.tasks['test:client:prod']
config.rb.tasks['test:server:prod']
"#{config.rb.prefix.task}common-server"
"#{config.rb.prefix.task}minify-server"
"#{config.rb.prefix.task}start-server"
"#{config.rb.prefix.task}common-test-server"
"#{config.rb.prefix.task}clean-server-test-dist"
cb
) -> defer.resolve()
) -> defer.resolve() unless task.wasCalledFrom config.rb.tasks['prod:test']

# return
# ======

0 comments on commit 8d19e4f

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