From 34a98fb209c886807937d16c324d5b024e72e72b Mon Sep 17 00:00:00 2001 From: Matt Hernandez Date: Wed, 26 Oct 2016 12:31:29 -0400 Subject: [PATCH] Add --server option for overriding default. Changed the default to localhost:3000 and added an option to change the server to a custom URL. --- bin/demeteorizer | 4 ++++ lib/build.js | 4 ++-- test/build.js | 30 +++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/bin/demeteorizer b/bin/demeteorizer index ec688d3..290f587 100755 --- a/bin/demeteorizer +++ b/bin/demeteorizer @@ -25,6 +25,9 @@ Program .option( '-v, --verbose', 'Output extra build information') + .option( + '-s, --server', + 'Remote DDP Server location [localhost:3000]') .option( '--node-version ', 'Node version set in generated package.json') @@ -53,6 +56,7 @@ var options = { json: Program.json, architecture: Program.architecture, verbose: Boolean(Program.verbose), + server: Program.server, npmVersion: Program.npmVersion, nodeVersion: Program.nodeVersion }; diff --git a/lib/build.js b/lib/build.js index 63a2361..5751b51 100644 --- a/lib/build.js +++ b/lib/build.js @@ -4,13 +4,13 @@ const Util = require('util') const Exec = require('./exec') const defaults = { - server: 'localhost', + server: 'localhost:3000', directory: '.demeteorized' } // // Options include: -// server - URL of the server (defaults to localhost). +// server - URL of the server (defaults to localhost:3000). // directory - The output directory (defaults to .demeteorized). // architecture - Architecture build target. // diff --git a/test/build.js b/test/build.js index dc32c61..10946da 100644 --- a/test/build.js +++ b/test/build.js @@ -36,7 +36,7 @@ describe('build', () => { expect(cpStub.spawn.calledWith('meteor', [ 'build', '--server', - 'localhost', + 'localhost:3000', '--directory', '.demeteorized' ])).to.be.true() @@ -52,7 +52,7 @@ describe('build', () => { expect(cpStub.spawn.calledWith('meteor', [ 'build', '--server', - 'localhost', + 'localhost:3000', '--directory', '.demeteorized', '--architecture', @@ -70,7 +70,7 @@ describe('build', () => { expect(cpStub.spawn.calledWith('meteor', [ 'build', '--server', - 'localhost', + 'localhost:3000', '--directory', '.demeteorized', '--debug' @@ -87,7 +87,7 @@ describe('build', () => { expect(cpStub.spawn.calledWith('meteor', [ 'build', '--server', - 'localhost', + 'localhost:3000', '--directory', '.demeteorized', '--server-only' @@ -99,12 +99,12 @@ describe('build', () => { emitter.emit('close', 0) }) - it('includes verbose when provided', function (done) { - Build({ verbose: true }, function () { + it('includes verbose when provided', (done) => { + Build({ verbose: true }, () => { expect(cpStub.spawn.calledWith('meteor', [ 'build', '--server', - 'localhost', + 'localhost:3000', '--directory', '.demeteorized', '--verbose' @@ -116,6 +116,22 @@ describe('build', () => { emitter.emit('close', 0) }) + it('overrides server when provided', (done) => { + Build({ server: 'http://example.com' }, () => { + expect(cpStub.spawn.calledWith('meteor', [ + 'build', + '--server', + 'http://example.com', + '--directory', + '.demeteorized' + ])).to.be.true() + + done() + }) + + emitter.emit('close', 0) + }) + it('returns an error on failed exit', (done) => { Build({}, (err) => { expect(err.message).to.equal('Conversion failed.')