MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

Work on #393. #395

Closed mjordan closed 7 years ago

mjordan commented 7 years ago

Github issue: (#393)

What does this Pull Request do?

Adds a utility script that generates sample input for MIK. Useful for contributors who need to supply sample configuration and data as part of pull requests, etc., or possibly even end users who want a set of configuration and data files to base their production files on.

Note that currently only sample data consistent with single-file content models (specifically, .jpg files) is generated. Code to generate sample data for compound, book, and newspapers content models need to be completed. This PR is intended to get consensus around the approach generate.php takes. If the approach is satisfactory, we can complete the work necessary to generate output for the other content models.

What's new?

This PR adds the following files:

extras/scripts/samplecontentgenerator/
├── generate.php
├── ini.twig
├── mappings.csv
└── metadata.twig

In addition to the generate.php script, a sample mappings file and two templates (one for the .ini file and one for the metadata CSV file) allow users to customize the sample input to their needs.

How should this be tested?

There are no PHPUnit tests for this new tool, so it requires a smoke test:

  1. Check out the issue-393 branch.
  2. In the MIK directory, run the following command: php extras/scripts/samplecontentgenerator/generate.php -id issue393 /tmp/miksampletest
  3. In /tmp/miksampletest you should see the following:
├── file1.jpg
├── file2.jpg
├── file3.jpg
├── file4.jpg
├── file5.jpg
├── issue393.ini
├── issue393_mappings.csv
└── issue393_metadata.csv

The .ini file should contain values that can be used with the sample files in the /tmp/miksampletest directory.

Run php extras/scripts/samplecontentgenerator/generate.php --help to see additional command-line options (e.g., using a custom .ini or metadata template).

Additional Notes

Note that the sample "JPG" files are really text files. MIK doesn't care whether the files are valid JPEG or other binary files. If we want to generate real JPGs, we can borrow the approach the Islandora Sample Content Generator takes to generate valid JPG and other image files.

Interested parties

@MarcusBarnes, @jpeak5, @bondjimbond and any other current contributors

MarcusBarnes commented 7 years ago

@mjordan I really like this concept as it may help reduce the burden on contributors when creating pull-requests that require smoke-testing.

MarcusBarnes commented 7 years ago

@mjordan I'm OK with merging this as it's an extra to help those contributing to MIK.

mjordan commented 7 years ago

@MarcusBarnes excellent! Want me to flesh out the compound, book, and newspaper sample file functions before you merge?

MarcusBarnes commented 7 years ago

I'm OK with merging this and then adding the compound, book, and newspaper sample file functions as they come together.

mjordan commented 7 years ago

OK, sure!

mjordan commented 7 years ago

Thanks, I'll document this script on the "Information for Developers" page.

mjordan commented 7 years ago

@MarcusBarnes I just pushed a fix directly to master to fix a significant typo we missed in this PR. Hope that's OK. See 3e5466e8aa700cbee334a777a5349535c03af08f for diff.