Merge branch 'master' into ux-initial-redesign

This commit is contained in:
Wade Wegner 2017-08-10 17:55:24 -06:00
Родитель f5d114d6ff 36a2f5a92d
Коммит 367d8017a8
6 изменённых файлов: 101 добавлений и 12 удалений

20
.profile Normal file
Просмотреть файл

@ -0,0 +1,20 @@
echo "Installing JQ for JSON parsing ..."
# mkdir /app/.local/share/jq/bin
# cd /app/.local/share/jq/bin
wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
chmod +x ./jq
# echo "Updating PATH to include jq ..."
export PATH=$PATH:/app
echo "Updating PATH to include Salesforce CLI ..."
export PATH=$PATH:/app/.local/share/sfdx/cli/bin/
echo "Updating Salesforce CLI plugin ..."
sfdx update
echo "Creating local resources ..."
mkdir /app/tmp
echo "Completed!"

29
app.js
Просмотреть файл

@ -160,6 +160,18 @@ app.get('/oauth/callback', (req, res) => {
const router = express.Router();
router.get('/test', (req, res) => {
const script = `jq --help`;
commands.run('test', script, (result) => {
res.json({
message: result
});
});
});
router.post('/deploying', (req, res) => {
const command = req.body.command;
@ -173,6 +185,8 @@ router.post('/deploying', (req, res) => {
const startingDirectory = process.env.STARTINGDIRECTORY;
const directory = `${tokenName}-${timestamp}`;
// const jqDirectory = '/app/.local/share/jq/bin/';
let script;
let sfdxurl;
@ -182,7 +196,8 @@ router.post('/deploying', (req, res) => {
script = `${startingDirectory}mkdir ${directory};cd ${directory};git clone ${param} .`;
commands.run(command, script, () => {
commands.run(command, script, (result) => {
console.log('temp result', result);
res.json({
message: `Successfully cloned ${param}`
});
@ -227,6 +242,18 @@ router.post('/deploying', (req, res) => {
break;
case 'permset':
script = `${startingDirectory}cd ${directory};export FORCE_SHOW_SPINNER=;sfdx force:user:permset:assign -n ${param}`;
commands.run(command, script, (result) => {
res.json({
message: `Permset assigned:\n\t${result}`
});
});
break;
case 'test':
script = `${startingDirectory}cd ${directory};export FORCE_SHOW_SPINNER=;sfdx force:apex:test:run -r human --json | jq -r .result | jq -r .summary | jq -r .outcome`;

36
app.json Normal file
Просмотреть файл

@ -0,0 +1,36 @@
{
"name": "Deploy to Salesforce DX",
"description": "An application that will deploy an SFDX project from a public Github repo",
"repository": "https://github.com/wadewegner/deploy-to-sfdx",
"logo": "",
"keywords": ["deploy", "sfdx", "salesforcedx"],
"image": "",
"scripts": {
"postdeploy": "bin/deploy"
},
"env": {
"CALLBACKURL": {
"description": "The callback URL for your Connected App",
"value": ""
},
"CONSUMERKEY": {
"description": "The consumer key for your Connected App.",
"value": ""
},
"CONSUMERSECRET": {
"description": "The consumer secret for your Connected App.",
"value": ""
},
"STARTINGDIRECTORY": {
"description": "The base directory for the CLI",
"value": ""
}
},
"buildpacks": [{
"url": "https://github.com/wadewegner/salesforce-cli-buildpack"
},
{
"url": "heroku/nodejs"
}
]
}

2
bin/deploy Normal file
Просмотреть файл

@ -0,0 +1,2 @@
#!/usr/bin/env bash

Просмотреть файл

@ -4,6 +4,7 @@ const {
module.exports = {
run: (command, commandScript, result) => {
// console.log(command, commandScript);
exec(commandScript, (err, stdout, stderr) => {
if (stderr || err) {
console.log(`${command}:err`, err);

Просмотреть файл

@ -47,6 +47,7 @@ $(document).ready(() => {
const timestamp = new Date().getTime().toString();
const assignPermset = doc['assign-permset'];
const permsetName = doc['permset-name'];
const deleteScratchOrg = doc['delete-scratch-org'];
const runApexTests = doc['run-apex-tests'];
const scratchOrgDef = doc['scratch-org-def'];
@ -54,21 +55,29 @@ $(document).ready(() => {
update_status(`Parsed the following values from the yaml file:
\tassign-permset: ${assignPermset}
\tpermset-name: ${permsetName}
\tdelete-scratch-org: ${deleteScratchOrg}
\trun-apex-tests: ${runApexTests}
\tscratch-org-def: ${scratchOrgDef}
\tshow-scratch-org-url: ${showScratchOrgUrl}`);
return deployingApi('clone', timestamp, githubRepo)
.then(() => {
return deployingApi('auth', timestamp);
})
// .then(() => {
// return deployingApi('auth', timestamp);
// })
.then(() => {
return deployingApi('create', timestamp, scratchOrgDef);
})
.then(() => {
return deployingApi('push', timestamp);
})
.then(() => {
if (permsetName) {
return deployingApi('permset', timestamp, permsetName);
} else {
return null;
}
})
.then(() => {
return deployingApi('test', timestamp);
})
@ -98,20 +107,14 @@ $(document).ready(() => {
commandData = {};
commandData.command = 'clean';
commandData.timestamp = timestamp;
// return deployingApi('clean', timestamp).then(() => {
// };
}
}).then(() => {
return deployingApi('clean', timestamp)
.then(() => {
message = `Finished. You have deploy the app to Salesforce DX!\n\n${message}`;
$('textarea#status').val(message);
});
});
});