Skip to content

Commit 9ecd001

Browse files
committed
download headers tarball for ~0.12.10 || ~0.10.42
1 parent 07371e5 commit 9ecd001

File tree

2 files changed

+83
-11
lines changed

2 files changed

+83
-11
lines changed

lib/process-release.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ var semver = require('semver')
22
, url = require('url')
33
, path = require('path')
44

5+
// versions where -headers.tar.gz started shipping
6+
, headersTarballRange = '>= 3.0.0 || ~0.12.10 || ~0.10.42'
57
, bitsre = /\/win-(x86|x64)\//
68
, bitsreV3 = /\/win-(x86|ia32|x64)\// // io.js v3.x.x shipped with "ia32" but should
79
// have been "x86"
@@ -93,7 +95,7 @@ function processRelease (argv, gyp, defaultVersion, defaultRelease) {
9395
// making the bold assumption that anything with a version number >3.0.0 will
9496
// have a *-headers.tar.gz file in its dist location, even some frankenstein
9597
// custom version
96-
tarballUrl = url.resolve(baseUrl, name + '-v' + version + (versionSemver.major >= 3 ? '-headers' : '') + '.tar.gz')
98+
tarballUrl = url.resolve(baseUrl, name + '-v' + version + (semver.satisfies(versionSemver, headersTarballRange) ? '-headers' : '') + '.tar.gz')
9799

98100
return {
99101
version: version,

test/test-process-release.js

+80-10
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,93 @@ test('test process release - process.version = 0.10.21', function (t) {
4545
})
4646
})
4747

48-
test('test process release - process.version = 0.12.22', function (t) {
48+
// prior to -headers.tar.gz
49+
test('test process release - process.version = 0.12.9', function (t) {
4950
t.plan(2)
5051

51-
var release = processRelease([], { opts: {} }, 'v0.12.22', null)
52+
var release = processRelease([], { opts: {} }, 'v0.12.9', null)
5253

53-
t.equal(release.semver.version, '0.12.22')
54+
t.equal(release.semver.version, '0.12.9')
5455
delete release.semver
5556

5657
t.deepEqual(release, {
57-
version: '0.12.22',
58+
version: '0.12.9',
5859
name: 'node',
59-
baseUrl: 'https://nodejs.org/dist/v0.12.22/',
60-
tarballUrl: 'https://nodejs.org/dist/v0.12.22/node-v0.12.22.tar.gz',
61-
shasumsUrl: 'https://nodejs.org/dist/v0.12.22/SHASUMS256.txt',
62-
versionDir: '0.12.22',
63-
libUrl32: 'https://nodejs.org/dist/v0.12.22/node.lib',
64-
libUrl64: 'https://nodejs.org/dist/v0.12.22/x64/node.lib',
60+
baseUrl: 'https://nodejs.org/dist/v0.12.9/',
61+
tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz',
62+
shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt',
63+
versionDir: '0.12.9',
64+
libUrl32: 'https://nodejs.org/dist/v0.12.9/node.lib',
65+
libUrl64: 'https://nodejs.org/dist/v0.12.9/x64/node.lib',
66+
libPath32: 'node.lib',
67+
libPath64: 'x64/node.lib'
68+
})
69+
})
70+
71+
// prior to -headers.tar.gz
72+
test('test process release - process.version = 0.10.41', function (t) {
73+
t.plan(2)
74+
75+
var release = processRelease([], { opts: {} }, 'v0.10.41', null)
76+
77+
t.equal(release.semver.version, '0.10.41')
78+
delete release.semver
79+
80+
t.deepEqual(release, {
81+
version: '0.10.41',
82+
name: 'node',
83+
baseUrl: 'https://nodejs.org/dist/v0.10.41/',
84+
tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz',
85+
shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt',
86+
versionDir: '0.10.41',
87+
libUrl32: 'https://nodejs.org/dist/v0.10.41/node.lib',
88+
libUrl64: 'https://nodejs.org/dist/v0.10.41/x64/node.lib',
89+
libPath32: 'node.lib',
90+
libPath64: 'x64/node.lib'
91+
})
92+
})
93+
94+
// has -headers.tar.gz
95+
test('test process release - process.release ~ [email protected]', function (t) {
96+
t.plan(2)
97+
98+
var release = processRelease([], { opts: {} }, 'v0.10.42', null)
99+
100+
t.equal(release.semver.version, '0.10.42')
101+
delete release.semver
102+
103+
t.deepEqual(release, {
104+
version: '0.10.42',
105+
name: 'node',
106+
baseUrl: 'https://nodejs.org/dist/v0.10.42/',
107+
tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz',
108+
shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt',
109+
versionDir: '0.10.42',
110+
libUrl32: 'https://nodejs.org/dist/v0.10.42/node.lib',
111+
libUrl64: 'https://nodejs.org/dist/v0.10.42/x64/node.lib',
112+
libPath32: 'node.lib',
113+
libPath64: 'x64/node.lib'
114+
})
115+
})
116+
117+
// has -headers.tar.gz
118+
test('test process release - process.release ~ [email protected]', function (t) {
119+
t.plan(2)
120+
121+
var release = processRelease([], { opts: {} }, 'v0.12.10', null)
122+
123+
t.equal(release.semver.version, '0.12.10')
124+
delete release.semver
125+
126+
t.deepEqual(release, {
127+
version: '0.12.10',
128+
name: 'node',
129+
baseUrl: 'https://nodejs.org/dist/v0.12.10/',
130+
tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz',
131+
shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt',
132+
versionDir: '0.12.10',
133+
libUrl32: 'https://nodejs.org/dist/v0.12.10/node.lib',
134+
libUrl64: 'https://nodejs.org/dist/v0.12.10/x64/node.lib',
65135
libPath32: 'node.lib',
66136
libPath64: 'x64/node.lib'
67137
})

0 commit comments

Comments
 (0)