Skip to content

Commit 37c8b61

Browse files
authored
Merge pull request #40 from nodkz/fix-server-kill
Fix server kill, add mint support
2 parents 84aa1b9 + 0b6ea5c commit 37c8b61

File tree

7 files changed

+1427
-852
lines changed

7 files changed

+1427
-852
lines changed

.flowconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@
4040
[options]
4141
esproposal.class_instance_fields=enable
4242
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
43-
unsafe.enable_getters_and_setters=true

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ cache:
88
notifications:
99
email: true
1010
node_js:
11+
- "9"
1112
- "8"
1213
- "6"
1314
before_install: yarn global add greenkeeper-lockfile@1

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,33 @@
2424
"homepage": "https://github.com/nodkz/mongodb-memory-server",
2525
"devDependencies": {
2626
"babel-cli": "^6.26.0",
27-
"babel-eslint": "^8.0.2",
28-
"babel-jest": "^21.2.0",
27+
"babel-eslint": "^8.2.1",
28+
"babel-jest": "^22.0.6",
2929
"babel-plugin-transform-class-properties": "^6.24.1",
3030
"babel-plugin-transform-flow-strip-types": "^6.22.0",
3131
"babel-plugin-transform-object-rest-spread": "^6.26.0",
3232
"babel-plugin-transform-runtime": "^6.23.0",
3333
"babel-preset-env": "^1.6.1",
3434
"cz-conventional-changelog": "^2.1.0",
35-
"eslint": "^4.10.0",
35+
"eslint": "^4.15.0",
3636
"eslint-config-airbnb-base": "^12.1.0",
37-
"eslint-config-prettier": "^2.7.0",
38-
"eslint-plugin-flowtype": "^2.39.1",
37+
"eslint-config-prettier": "^2.9.0",
38+
"eslint-plugin-flowtype": "^2.41.0",
3939
"eslint-plugin-import": "^2.8.0",
40-
"eslint-plugin-prettier": "^2.3.1",
41-
"flow-bin": "^0.58.0",
42-
"jest": "^21.2.1",
40+
"eslint-plugin-prettier": "^2.4.0",
41+
"flow-bin": "^0.63.1",
42+
"jest": "^22.0.6",
4343
"mongodb": "^2.2.33",
44-
"npm-run-all": "^4.1.1",
45-
"prettier": "^1.8.0",
44+
"npm-run-all": "^4.1.2",
45+
"prettier": "^1.10.2",
4646
"rimraf": "^2.6.2",
47-
"semantic-release": "^8.2.0"
47+
"semantic-release": "^11.0.2"
4848
},
4949
"dependencies": {
5050
"babel-runtime": "^6.26.0",
5151
"debug": "^3.1.0",
5252
"decompress": "^4.2.0",
53-
"fs-extra": "^4.0.2",
53+
"fs-extra": "^5.0.0",
5454
"get-port": "^3.2.0",
5555
"getos": "^3.1.0",
5656
"lockfile": "^1.0.3",

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* @flow */
2+
13
import MongoMemoryServer from './MongoMemoryServer';
24
import MongoInstance from './util/MongoInstance';
35
import MongoBinary from './util/MongoBinary';

src/util/MongoBinaryDownloadUrl.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import getos from 'getos';
55

66
type OS = {
7-
release: string,
87
dist: string,
8+
release?: string,
99
};
1010

1111
const DOWNLOAD_URI = 'https://downloads.mongodb.org';
@@ -79,6 +79,8 @@ export default class MongoBinaryDownloadUrl {
7979
return this.getFedoraVersionString(os);
8080
} else if (/debian/i.test(os.dist)) {
8181
return this.getDebianVersionString(os);
82+
} else if (/mint/i.test(os.dist)) {
83+
return this.getMintVersionString(os);
8284
}
8385
throw new Error(`Cannot determine version string for ${JSON.stringify(os)}`);
8486
}
@@ -109,12 +111,15 @@ export default class MongoBinaryDownloadUrl {
109111

110112
getRhelVersionString(os: OS): string {
111113
let name: string = 'rhel';
112-
if (/^7/.test(os.release)) {
113-
name += '70';
114-
} else if (/^6/.test(os.release)) {
115-
name += '62';
116-
} else if (/^5/.test(os.release)) {
117-
name += '55';
114+
const { release } = os;
115+
if (release) {
116+
if (/^7/.test(release)) {
117+
name += '70';
118+
} else if (/^6/.test(release)) {
119+
name += '62';
120+
} else if (/^5/.test(release)) {
121+
name += '55';
122+
}
118123
}
119124
return name;
120125
}
@@ -124,6 +129,12 @@ export default class MongoBinaryDownloadUrl {
124129
return 'ubuntu1404';
125130
}
126131

132+
// eslint-disable-next-line no-unused-vars
133+
getMintVersionString(os: OS): string {
134+
// unfortunately getos doesn't return version for Mint
135+
return 'ubuntu1404';
136+
}
137+
127138
getSuseVersionString(os: any): string {
128139
const [release]: [string | null] = os.release.match(/(^11|^12)/) || [null];
129140

src/util/__tests__/MongoBinaryDownloadUrl-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,16 @@ describe('MongoBinaryDownloadUrl', () => {
142142
).toBe('debian81');
143143
});
144144
});
145+
146+
describe('getMintVersionString', () => {
147+
const downloadUrl = new MongoBinaryDownloadUrl({
148+
platform: 'linux',
149+
arch: 'x64',
150+
version: '3.4.4',
151+
});
152+
153+
it('should return an archive name for Linux Mint', () => {
154+
expect(downloadUrl.getMintVersionString({ dist: 'Linux Mint' })).toBe('ubuntu1404');
155+
});
156+
});
145157
});

0 commit comments

Comments
 (0)