Skip to content

Commit

Permalink
Merge pull request #68 from adam-vessey/move-base
Browse files Browse the repository at this point in the history
Move base migration
  • Loading branch information
IAMlKeno authored Jun 7, 2021
2 parents a2dc99b + 1a304e1 commit ab42d9d
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 19 deletions.
16 changes: 8 additions & 8 deletions islandora_spreadsheet_ingest.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ type: module
package: DGI
core: 8.x
dependencies:
- migrate
- node
- media
- islandora
- migrate_plus
- migrate_tools
- dgi_migrate
- migrate_spreadsheet
# We implement a plugin making use of their base class.
- drupal:migrate
# We generate migrate_plus migration/migration_group entities.
- migrate_plus:migrate_plus
# We generate links to endpoints migrate_tools defines.
- migrate_plus:migrate_tools
# We generate migrations using migrate_spreadsheet.
- migrate_spreadsheet:migrate_spreadsheet
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ destination:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ migration_dependencies:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ migration_dependencies:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ migration_dependencies:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ migration_dependencies:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ migration_dependencies:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ destination:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ shared_configuration:
# Worksheet nonsensical but required.
worksheet: nada
track_changes: true
file: 'modules/contrib/islandora_spreadsheet_ingest/fixtures/migration_example.csv'
file: 'modules/contrib/islandora_spreadsheet_ingest/modules/islandora_spreadsheet_ingest_example/fixtures/migration_example.csv'
header_row: 1
keys:
'ID':
Expand All @@ -18,4 +18,4 @@ shared_configuration:
dependencies:
enforced:
module:
- islandora_spreadsheet_ingest
- islandora_spreadsheet_ingest_example
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

SCRIPT=$0
MODULE=islandora_spreadsheet_ingest
MODULE=islandora_spreadsheet_ingest_example
MG=isi
MIGRATIONS=($(drush migrate:status --group=$MG --field=id))
APACHE_USER=www-data
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'Islandora Spreadsheet Ingest Example'
description: "Example CSV import of Islandora content."
type: module
package: DGI
core_version_requirement: ^8 || ^9
dependencies:
- dgi_migrate:dgi_migrate
- drupal:media
- drupal:node
- islandora_spreadsheet_ingest:islandora_spreadsheet_ingest
- migrate_plus:migrate_plus
25 changes: 25 additions & 0 deletions src/Entity/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,29 @@ public function getOwner() {
return $this->owner;
}

/**
* {@inheritdoc}
*/
public function calculateDependencies() {
parent::calculateDependencies();

foreach (array_column($this->getMappings(), 'original_migration_id') as $original_migration_id) {
$this->addDependency('config', "migrate_plus.migration.{$original_migration_id}");
}
list($type, $id) = explode(':', $this->getOriginalMapping());
switch ($type) {
case 'migration_group':
$this->addDependency('config', "migrate_plus.migration_group.{$id}");
break;

default:
throw new Exception(strtr('Unknown type of original mapping: "!type"', [
'!type' => $type,
]));

}

return $this;
}

}
5 changes: 4 additions & 1 deletion src/MigrationGroupDeriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ public function create(RequestInterface $request) {
'nada'),
'file' => $this->fileStorage->load(reset($request->getSheet()['file']))->getFileUri(),
];

// Grab the original values.
$source += $config['source'];
if (isset($config['source'])) {
$source += $config['source'];
}

// Add on the rest of the defaults that may be missing.
$source += [
Expand Down

0 comments on commit ab42d9d

Please sign in to comment.