Skip to content

Commit

Permalink
Add installation instructions if medic-xls2xform is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jun 1, 2017
1 parent 7d4a2d0 commit 5e65756
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medic-configurer-beta",
"version": "1.0.19",
"version": "1.0.20",
"description": "Configure Medic Mobile deployments",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/cli/xls2xform-installation-command.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"python -m pip install -e git+https://github.com/alxndrsn/pyxform.git@master#egg=medic-pyxform"
10 changes: 9 additions & 1 deletion src/fn/convert-forms.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const error = require('../lib/log').error;
const exec = require('../lib/exec-promise');
const fs = require('../lib/sync-fs');
const info = require('../lib/log').info;
Expand All @@ -18,7 +19,14 @@ module.exports = (project/*, couchUrl*/) => {

return Promise.resolve()
.then(() => info('Converting form', sourcePath, '…'))
.then(() => exec('medic-xls2xform', sourcePath, targetPath))
.then(() => xls2xform(sourcePath, targetPath))
.then(() => trace('Converted form', sourcePath));
}));
};

const xls2xform = (sourcePath, targetPath) =>
exec('medic-xls2xform', sourcePath, targetPath)
.catch(e => {
error('There was a problem executing xls2xform. It may not be installed. To install, run ' + require('../cli/xls2xform-installation-command'));
throw e;
});

0 comments on commit 5e65756

Please sign in to comment.