Skip to content

Commit

Permalink
Update location of form media directory
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jun 1, 2017
1 parent cce97ba commit dc39648
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ This tool expects a project to be sctructured as follows:
my_project_form.xlsx
my_project_form.xml
my_project_form.properties.json
my_project_form/
my_project_form-media/
[extra files]
contact/
person-create.xlsx
person-create.xml
person-create/
person-create-media/
[extra files]
Expand Down
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.30",
"version": "1.0.32",
"description": "Configure Medic Mobile deployments",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/upload-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ module.exports = (project, couchUrl, subDirectory, options) => {
.filter(name => name.endsWith('.xlsx'))
.map(xls => {
const baseFileName = fs.withoutExtension(xls);
const formDir = `${formsDir}/${baseFileName}`;
const mediaDir = `${formsDir}/${baseFileName}-media`;
const xformPath = `${formsDir}/${baseFileName}.xml`;
const expectedId = (options.id_prefix || '') + baseFileName.replace(/-/g, ':');

if(!fs.exists(formDir)) info(`No form directory found corresponding to XML ${formDir}`);
if(!fs.exists(mediaDir)) info(`No media directory found at ${mediaDir} for form ${xformPath}`);

const xml = fs.read(xformPath);

Expand All @@ -47,7 +47,7 @@ module.exports = (project, couchUrl, subDirectory, options) => {
}
}

doc._attachments = fs.exists(formDir) ? attachmentsFromDir(formDir) : {};
doc._attachments = fs.exists(mediaDir) ? attachmentsFromDir(mediaDir) : {};
doc._attachments.xml = attachmentFromFile(xformPath);

return Promise.resolve()
Expand Down

0 comments on commit dc39648

Please sign in to comment.