Skip to content

Commit

Permalink
Merge pull request #242 from onmodulus/feature/server-option
Browse files Browse the repository at this point in the history
Add --server option for overriding default.
  • Loading branch information
fiveisprime authored Oct 26, 2016
2 parents b34fba6 + 34a98fb commit 29155be
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions bin/demeteorizer
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Program
.option(
'-v, --verbose',
'Output extra build information')
.option(
'-s, --server',
'Remote DDP Server location [localhost:3000]')
.option(
'--node-version <version>',
'Node version set in generated package.json')
Expand Down Expand Up @@ -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
};
Expand Down
4 changes: 2 additions & 2 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
30 changes: 23 additions & 7 deletions test/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('build', () => {
expect(cpStub.spawn.calledWith('meteor', [
'build',
'--server',
'localhost',
'localhost:3000',
'--directory',
'.demeteorized'
])).to.be.true()
Expand All @@ -52,7 +52,7 @@ describe('build', () => {
expect(cpStub.spawn.calledWith('meteor', [
'build',
'--server',
'localhost',
'localhost:3000',
'--directory',
'.demeteorized',
'--architecture',
Expand All @@ -70,7 +70,7 @@ describe('build', () => {
expect(cpStub.spawn.calledWith('meteor', [
'build',
'--server',
'localhost',
'localhost:3000',
'--directory',
'.demeteorized',
'--debug'
Expand All @@ -87,7 +87,7 @@ describe('build', () => {
expect(cpStub.spawn.calledWith('meteor', [
'build',
'--server',
'localhost',
'localhost:3000',
'--directory',
'.demeteorized',
'--server-only'
Expand All @@ -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'
Expand All @@ -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.')
Expand Down

0 comments on commit 29155be

Please sign in to comment.