Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --server option for overriding default. #242

Merged
merged 1 commit into from
Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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