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 back support for passing additional cmdline args #723

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion lib/process-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var semver = require('semver')
// file names. Inputs come from command-line switches (--target, --dist-url),
// `process.version` and `process.release` where it exists.
function processRelease (argv, gyp, defaultVersion, defaultRelease) {
var version = argv[0] || gyp.opts.target || defaultVersion
var version = (semver.valid(argv[0]) && argv[0]) || gyp.opts.target || defaultVersion
, versionSemver = semver.parse(version)
, overrideDistUrl = gyp.opts['dist-url'] || gyp.opts.disturl
, isDefaultVersion
Expand Down
28 changes: 28 additions & 0 deletions test/test-process-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,3 +421,31 @@ test('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]
})
})


test('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function (t) {
t.plan(2)

// additional arguments can be passed in on the commandline that should be ignored if they
// are not specifying a valid version @ position 0
var release = processRelease([ 'this is no version!' ], { opts: {} }, 'v4.0.0-rc.4', {
name: 'node',
headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
})

t.equal(release.semver.version, '4.0.0-rc.4')
delete release.semver

t.deepEqual(release, {
version: '4.0.0-rc.4',
name: 'node',
baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
versionDir: '4.0.0-rc.4',
libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})