-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in MOPLAT-168-cname-support (pull request #15)
build: add cname support Approved-by: Deepak Thukral <iapain@yahoo.com>
- Loading branch information
Showing
8 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs-extra') | ||
const requests = require('../helpers/requests') | ||
const path = require('path') | ||
const chalk = require('chalk') | ||
|
||
|
||
module.exports = async (options) => { | ||
const packageFile = path.resolve(options.file || 'mo-app.json') | ||
const json = await fs.readJSON(packageFile) | ||
const appName = options.name || json.name | ||
const cmd = options.argv.remain[1] | ||
const cname = options.argv.remain[2] | ||
let response = {} | ||
switch(cmd) { | ||
case 'list': | ||
response = await requests.cnameList(appName, options) | ||
break; | ||
case 'create': | ||
response = await requests.cnameCreate(appName, cname, options) | ||
break; | ||
case 'delete': | ||
response = await requests.cnameDelete(appName, cname, options) | ||
break; | ||
default: | ||
response = chalk.red(`Invalid command '${cmd}'`) | ||
} | ||
console.log(response) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
const expect = require('chai').expect; | ||
const nixt = require('nixt'), | ||
childProcess = require('child_process'); | ||
|
||
describe('MoApp', function() { | ||
describe('cname', function () { | ||
|
||
describe('list', function() { | ||
it('should list cnames for given app', function (done) { | ||
nixt() | ||
.run('moapp cname list --name test-app --file=test/fixtures/app/test-package.json --configFile=test/fixtures/tmp_config_file.json') | ||
.stdout(/cnames/gi) | ||
.end(done) | ||
}) | ||
}) | ||
|
||
describe('create', function() { | ||
it('should create cname for given app', function (done) { | ||
nixt() | ||
.run('moapp cname create test-app.com --name test-app --file=test/fixtures/app/test-package.json --configFile=test/fixtures/tmp_config_file.json') | ||
.stdout(/created/gi) | ||
.end(done) | ||
}) | ||
}) | ||
|
||
describe('delete', function() { | ||
it('should delete cname for given app', function (done) { | ||
nixt() | ||
.run('moapp cname delete test-app.com --name test-app --file=test/fixtures/app/test-package.json --configFile=test/fixtures/tmp_config_file.json') | ||
.stdout(/deleted/gi) | ||
.end(done) | ||
}) | ||
}) | ||
|
||
describe('invalid', function() { | ||
it('should raise error', function (done) { | ||
nixt() | ||
.run('moapp cname invalid test-app.com --name test-app --file=test/fixtures/app/test-package.json --configFile=test/fixtures/tmp_config_file.json') | ||
.stdout(/invalid/gi) | ||
.end(done) | ||
}) | ||
}) | ||
|
||
}); | ||
}); |