Skip to content

Commit

Permalink
Merge branch 'release/0.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ItaloYeltsin committed Mar 5, 2020
2 parents bd2c520 + 44b50fe commit c9cdb5c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 21 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "totalcross",
"displayName": "TotalCross Project Extension",
"description": "This is TotalCross plugin extension for vs code. ",
"version": "0.0.3",
"version": "0.0.4",
"publisher": "Italo",
"preview": true,
"icon": "icon.png",
Expand Down Expand Up @@ -77,8 +77,9 @@
"node-ssh": "^6.0.0",
"pom-parser": "^1.1.1",
"replace-in-file": "^4.2.0",
"request": "^2.88.0",
"totalcross-core-dev": "0.0.8",
"request": "^2.88.2",
"request-promise": "^4.2.5",
"totalcross-core-dev": "0.0.13",
"xml-js": "^1.6.11"
}
}
Empty file removed src/Util.ts
Empty file.
2 changes: 1 addition & 1 deletion src/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports.createNewProject = async function(context: vscode.ExtensionContext) {
validators.artifactId
);
if(!artifactID) {return;}
let availableVersions = await core.versions(`${context.extensionPath}/resources/maven-metadata.xml`);
let availableVersions = await core.latestVersions(`${context.extensionPath}/resources/maven-metadata.xml`);
let version = await vscode.window.showQuickPick(availableVersions, {
placeHolder: 'totalcross sdk version',
ignoreFocusOut: true
Expand Down
4 changes: 2 additions & 2 deletions src/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var node_ssh = require('node-ssh');
var validators = require('./validators/deployer');
const pomParser = require('pom-parser');
const Packager = require('./packager');
import {addToHistory} from './util';

var ssh = new node_ssh();
var folder: any;
Expand All @@ -25,8 +26,6 @@ exports.deploy = async function() {
resolve2(response.pomObject);
});
});

await Packager.package();
// ask user
if(!username) {
username = await vscode.window.showInputBox({
Expand Down Expand Up @@ -89,6 +88,7 @@ exports.deploy = async function() {
resolve(status);
if(status) {
vscode.window.showInformationMessage('TotalCross Application succesfully deployed.');
addToHistory('deploy');
}
})
.catch(function(err: any) {
Expand Down
32 changes: 17 additions & 15 deletions src/packager.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import * as vscode from 'vscode';
import {addToHistory} from './util';
var output = vscode.window.createTerminal("TotalCross Packager");

exports.package = async function () {
return new Promise((resolve, reject) => {
// Display a message box to the user
addToHistory('package');
var exec = require('child_process').exec, child;
let workspaceFolders = vscode.workspace.workspaceFolders;
if(!workspaceFolders) {
Expand All @@ -13,21 +16,20 @@ exports.package = async function () {
if(process.platform === 'win32') {
folder = "/d " + folder;
}
var output = vscode.window.createOutputChannel("TotalCross Deploy");
output.appendLine("Starting Package...");
output.show();
child = exec(`cd ${folder} && mvn package`);
child.stdout.on('data', function(data: string) {
output.append(data);
});
child.on('close', (code: number) => {
if(code === 0){
resolve(code);
}
else {
reject(code);
}
});
output.show();
output.sendText("mvn package");
// child = exec(`cd ${folder} && mvn package`);
// child.stdout.on('data', function(data: string) {
// output.sendText(`echo ${data}`, false);
// });
// child.on('close', (code: number) => {
// if(code === 0){
// resolve(code);
// }
// else {
// reject(code);
// }
// });
});
};
/**
Expand Down
19 changes: 19 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs-extra');
const homedir = require('os').homedir();
const request = require('request-promise');
const token = require(`${homedir}/TotalCross/.config.json`).token;

export async function addToHistory(activity: string) {
console.log('token: ' + token);
request({
method: 'POST',
uri: 'https://us-central1-totalcross-user-area.cloudfunctions.net/app/api/v1/history',
headers: {
'Authorization': `Bearer ${token}`
},
body: {
activity: activity
},
json: true
});
}

0 comments on commit c9cdb5c

Please sign in to comment.