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 #397. #398

Closed mjordan closed 7 years ago

mjordan commented 7 years ago

Github issue: (#397)

393 is also relevant.

What does this Pull Request do?

Adds the ability to generate sample MIK configurations and input data for CSV compound, CSV books, and CVS newspaper issues.

What's new?

Just completing work started in PR #395.

How should this be tested?

This PR needs to be tested using a smoke test. There are no PHPUnit tests for this PR. To test it, for each of the content models, run generate.php from within the MIK directory and run tree on the output directory:

mik>php extras/scripts/samplecontentgenerator/generate.php -id single-test /tmp/single

/tmp/single/
├── file1.jpg
├── file2.jpg
├── file3.jpg
├── file4.jpg
├── file5.jpg
├── single-test.ini
├── single-test_mappings.csv
└── single-test_metadata.csv

mik>php extras/scripts/samplecontentgenerator/generate.php -m compound -id compound-test /tmp/compound

/tmp/compound/
├── compoundobject1
│   ├── image_01.tif
│   └── image_02.tif
├── compoundobject2
│   ├── image_01.tif
│   └── image_02.tif
├── compoundobject3
│   ├── image_01.tif
│   └── image_02.tif
├── compoundobject4
│   ├── image_01.tif
│   └── image_02.tif
├── compoundobject5
│   ├── image_01.tif
│   └── image_02.tif
├── compound-test.ini
├── compound-test_mappings.csv
└── compound-test_metadata.csv

Note that /tmp/compound/compound-test.ini contains the required compound_directory_field, child_title, metadata_filename, and child_key settings.

mik>php extras/scripts/samplecontentgenerator/generate.php -m books -id book-test /tmp/books

/tmp/books/
├── book1
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── book2
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── book3
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── book4
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── book5
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── book-test.ini
├── book-test_mappings.csv
└── book-test_metadata.csv

mik>php extras/scripts/samplecontentgenerator/generate.php -m newspapers -id newspapers-test /tmp/newspapers

/tmp/newspapers/
├── 1920-06-01
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── 1920-06-02
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── 1920-06-03
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── 1920-06-04
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── 1920-06-05
│   ├── page-01.tif
│   ├── page-02.tif
│   └── page-03.tif
├── newspapers-test.ini
├── newspapers-test_mappings.csv
└── newspapers-test_metadata.csv

Interested parties

@MarcusBarnes

MarcusBarnes commented 7 years ago

Works as described. While testing this branch, I noticed that changing https://github.com/MarcusBarnes/mik/blob/master/extras/scripts/samplecontentgenerator/generate.php#L16 to use \Commando\Commando; resolved the PHP Warning I was getting on my system (despite the script creating proper output). @mjordan Would you check if this change has any detrimental affect on your system and if not, would you roll it into this pull-request for me to merge? Thank you in advance.

MarcusBarnes commented 7 years ago

After reading this documentation http://php.net/manual/en/language.namespaces.importing.php, I believe we should be able to delete the use lines since we are not using namespace aliases elsewhere in generate.php. I've done a quick test on my machine and the script still produces the same output with no notices, warnings or errors. @mjordan If you're able, would you please confirm that the script still works as expected after commenting out lines 16 and 17 of generate.php? Note that you'll need to clear the contents of the output directory if you run the script multiple times using the same output directory.

mjordan commented 7 years ago

Thanks for the careful review @MarcusBarnes. I will test this afternoon.

mjordan commented 7 years ago

generate.php works fine wit lines 16 and 17 commented out. I'll push an update. Thanks!