-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathbuild-tmp.js
More file actions
56 lines (46 loc) · 1004 Bytes
/
build-tmp.js
File metadata and controls
56 lines (46 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict';
const path = require('path');
const fs = require('fs-extra');
const tmp = require('tmp');
const {
gitInit,
commit,
postCommit
} = require('git-fixtures');
const run = require('../../src/run');
module.exports = function({
fixturesPath,
commitMessage,
dirty,
subDir = '',
npmInstall
}) {
let tmpPath;
if (process.env.AGENT_TEMPDIRECTORY) {
console.log("Detected Azure Pipelines, using agent temp dir");
tmpPath = tmp.dirSync({ dir: process.env.AGENT_TEMPDIRECTORY }).name;
} else {
console.log("Not using Azure Pipelines...");
tmpPath = tmp.dirSync().name;
}
gitInit({
cwd: tmpPath
});
let tmpSubPath = path.join(tmpPath, subDir);
fs.ensureDirSync(tmpSubPath);
fs.copySync(fixturesPath, tmpSubPath);
if (npmInstall) {
run('npm install ember-cli --no-save', {
cwd: tmpSubPath
});
}
commit({
m: commitMessage,
cwd: tmpPath
});
postCommit({
cwd: tmpPath,
dirty
});
return tmpSubPath;
};