Skip to content

Commit 2226726

Browse files
committed
make cloud build an option
1 parent 900bd5c commit 2226726

3 files changed

Lines changed: 26 additions & 14 deletions

File tree

lib/checker.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ async function _setup(out: OutputModel) {
3434
out.tnsVersion = tnsVersion.trim();
3535
out.nodeVersion = process.version;
3636
out.npmVersion = npmVersion.trim();
37-
await execPromise('.', 'tns accept eula', true) as string;
38-
await execPromise('.', 'tns config apply test --apiVersion test', true) as string;
39-
await ProjectService.setup();
37+
const args = process.argv;
38+
const user = args.length > 4 ? args[4] : '';
39+
const pass = args.length > 5 ? args[5] : '';
40+
const cloudEnabled = !!(user && pass);
41+
if (cloudEnabled) {
42+
await execPromise('.', 'tns extension install nativescript-cloud', true) as string;
43+
await execPromise('.', 'tns accept eula', true) as string;
44+
await execPromise('.', 'tns config apply test --apiVersion test', true) as string;
45+
await execPromise('.', `tns dev-login ${user} ${pass}`, true) as string;
46+
}
47+
await ProjectService.setup(cloudEnabled);
4048
}
4149

4250
export async function run() {
@@ -60,7 +68,7 @@ export async function run() {
6068

6169
// Test if the plugin builds when added to an app
6270
await ProjectService.prepareProject(plugin);
63-
const actions = ['testWebpack'];//, 'testBuild', 'testSnapshot', 'testUglify', 'testAot'];
71+
const actions = ['testWebpack', 'testBuild', 'testSnapshot']; // removed for speed , 'testUglify', 'testAot'];
6472
const result: ResultsInterface = {
6573
name: plugin.name
6674
};

lib/execPromise.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function execPromise(cwd: string, command: string, returnOutput = false)
3333
});
3434
cp.stderr.on('data', function (data) {
3535
if (!hasError) {
36-
Logger.error(`error while executing ${command}:`);
36+
Logger.error(`plugin-verifier error output for ${command}:`);
3737
hasError = true;
3838
}
3939
Logger.error(data.toString());

lib/project.service.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ const testProject = 'baseNG';
1111
const testProjectOriginalSuffix = '_original';
1212

1313
export namespace ProjectService {
14-
15-
export async function setup() {
14+
export let cloudEnabled = false;
15+
export async function setup(cloud: boolean) {
16+
cloudEnabled = cloud;
1617
if (existsSync(testDirectory)) {
1718
await _removeDirectory(testDirectory);
1819
}
@@ -103,11 +104,11 @@ export namespace ProjectService {
103104
async function _buildProject(projectName: string, platform: string, options: string) {
104105
Logger.debug(`building project for ${platform} ...`);
105106
const cwd = path.join(testDirectory, projectName);
106-
if (platform === 'ios') {
107-
options += ' --provision /tns-official/CodeSign/ios/Icenium_QA_Development.mobileprovision --certificate /tns-official/CodeSign/ios/iPhone\ Developer\ Dragon\ Telerikov\ \(GNKAEXW8YQ\).p12 --certificatePassword 1';
107+
if (platform === 'ios' && cloudEnabled) {
108+
options += ' --provision /tns-official/CodeSign/ios/Icenium_QA_Development.mobileprovision --certificate /tns-official/CodeSign/ios/iPhone\\ Developer\\ Dragon\\ Telerikov\\ \\(GNKAEXW8YQ\\).p12 --certificatePassword 1';
108109
}
109-
110-
const result = await execPromise(cwd, `tns cloud build ${platform} --accountId 1 ${options}`);
110+
const command = cloudEnabled ? `tns cloud build ${platform} --accountId 1 ${options}` : `tns build ${platform} ${options}`;
111+
const result = await execPromise(cwd, command);
111112
return result;
112113
}
113114

@@ -180,9 +181,12 @@ export namespace ProjectService {
180181

181182
async function _renameTestProject() {
182183
return new Promise((resolve, reject) => {
183-
rename(path.join(testDirectory, testProject), path.join(testDirectory, testProject + testProjectOriginalSuffix), err => {
184-
return err ? reject(err) : resolve();
185-
});
184+
setTimeout(() => {
185+
rename(path.join(testDirectory, testProject), path.join(testDirectory, testProject + testProjectOriginalSuffix), err => {
186+
return err ? reject(err) : resolve();
187+
});
188+
}, 2000);
189+
186190
});
187191
}
188192

0 commit comments

Comments
 (0)