Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Commit

Permalink
fix: Mike's Review
Browse files Browse the repository at this point in the history
  • Loading branch information
EnriqueL8 committed Nov 8, 2017
1 parent e2b541f commit 134ebd1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
18 changes: 9 additions & 9 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ module.exports = Generator.extend({
})
},

_isTrue: function (value) {
return (value === true || value === 'true')
},

initializing: {
ensureNotInProject: actions.ensureNotInProject,

initSpec: function () {
function isTrue (value) {
return (value === true || value === 'true')
}

if (this.options.bluemix) {
this.skipPrompting = true

var appName = this.options.bluemix.name
var metrics = this._isTrue(this.options.metrics) || undefined
var docker = this._isTrue(this.options.docker) || undefined
var metrics = isTrue(this.options.metrics) || undefined
var docker = isTrue(this.options.docker) || undefined

var web = (this.appType === 'web' || this.appType === 'bff' || undefined)
var hostSwagger = (this.appType === 'bff' || undefined)
Expand Down Expand Up @@ -532,7 +532,7 @@ module.exports = Generator.extend({
// NOTE(tunniclm): no need to do anything for memory it is the default
// if no crudservice is passed to the refresh generator
if (answer.store === 'Cloudant') {
this._addService('cloudant', 'crudDataStore', true)
this._addService('cloudant', 'crudDataStore')
this.crudservice = 'crudDataStore'
}
})
Expand Down Expand Up @@ -651,8 +651,6 @@ module.exports = Generator.extend({
})
},

// TODO: and so on (be careful about whether each service is a
// 1-element array or just stored directly)
promptConfigureRedis: function () {
if (this.skipPrompting) return
if (!this.servicesToConfigure) return
Expand Down Expand Up @@ -783,6 +781,8 @@ module.exports = Generator.extend({
if (this.skipPrompting) return
if (!this.servicesToConfigure) return
if (!this.servicesToConfigure.conversation) return

this.log()
this.log('Configure Watson Conversation')
var prompts = [
{ name: 'watsonConversationName', message: 'Enter name (blank for default):' },
Expand Down
5 changes: 1 addition & 4 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,7 @@ exports.resourceNameFromPath = function (thepath) {
}

exports.isThisServiceAnArray = function (serviceType) {
if (serviceType === 'cloudant' || serviceType === 'objectStorage') {
return true
}
return false
return (serviceType === 'cloudant' || serviceType === 'objectStorage')
}

exports.validateServiceFields = function (serviceType, service) {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ describe('Unit tests for swiftserver:app', function () {
appType: 'scaffold',
appName: applicationName,
capabilities: [],
services: { objectStorage: {} }
services: { objectStorage: [{ serviceInfo: {label: 'Object-Storage'} }] }
}))
})

Expand Down Expand Up @@ -1420,7 +1420,7 @@ describe('Unit tests for swiftserver:app', function () {
appType: 'scaffold',
appName: applicationName,
capabilities: [],
services: { conversation: {} }
services: { conversation: { serviceInfo: {label: 'conversation'} } }
}))
})

Expand Down Expand Up @@ -1494,7 +1494,7 @@ describe('Unit tests for swiftserver:app', function () {
appType: 'scaffold',
appName: applicationName,
capabilities: [],
services: { alertNotification: {} }
services: { alertNotification: { serviceInfo: {label: 'AlertNotification'} } }
}))
})

Expand Down
3 changes: 1 addition & 2 deletions test/unit/refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Unit tests for swiftserver:refresh', function () {
appName: 'myapp',
bluemix: {
backendPlatform: 'SWIFT',
objectStorage: [{ serviceInfo: {} }]
objectStorage: [{ serviceInfo: {label: 'Object-Storage'} }]
}
}
})
Expand Down Expand Up @@ -361,7 +361,6 @@ describe('Unit tests for swiftserver:refresh', function () {
models: [ todoModel ],
docker: true,
bluemix: {
// TODO change this to serviceInfo format!
backendPlatform: 'SWIFT',
auth: { serviceInfo: { name: 'myAppIDService' } },
cloudant: [{ serviceInfo: { name: 'myCloudantService' } }],
Expand Down

0 comments on commit 134ebd1

Please sign in to comment.