https://github.com/cgkineo/adapt-migrations/blob/master/api/commands.js
load({ cwd, cachePath, scripts })
- loads all migration taskscapture({ cwd, content, fromPlugins })
- captures current plugins and contentmigrate({ cwd, toPlugins })
- migrates content from capture to new pluginstest({ cwd })
- tests the migrations with dummy content
Functions:
describe(description, describeFunction)
Describe a migrationwhereContent(description, contentFilterFunction)
Limit when the migration runs, return true/false/throw ErrorwhereFromPlugin(description, fromPluginFilterFunction)
Limit when the migration runs, return true/false/throw ErrorwhereToPlugin(description, toPluginFilterFunction)
Limit when the migration runs, return true/false/throw ErrormutateContent(contentFunction)
Change content, return true/false/throw ErrorcheckContent(contentFunction)
Check content, return true/false/throw ErrorthrowError(description)
Throw an errortestSuccessWhere({ fromPlugins, toPlugins, content })
Supply some tests content which should end in successtestStopWhere({ fromPlugins, toPlugins, content })
Supply some tests content which should end prematurelytestErrorWhere({ fromPlugins, toPlugins, content })
Supply some tests content which will trigger an error
Arguments:
describeFunction = () => {}
Function body has a collection of migration script functionscontentFilterFunction = content => {}
Function body should return true/false/throw ErrorfromPluginFilterFunction = fromPlugins => {}
Function body should return true/false/throw ErrortoPluginFilterFunction = toPlugins => {}
Function body should return true/false/throw ErrorcontentFunction = content => { }
Function body should mutate or check the content, returning true/false/throw ErrorfromPlugins = [{ name: 'quickNav , version: '1.0.0' }]
Test data describing the original pluginstoPlugins = [{ name: 'pageNav , version: '1.0.0' }]
Test data describing the destination pluginscontent = [{ _id: 'c-05, ... }]
Test content for the course content
grunt migration:capture # captures current plugins and content
# do plugin/fw updates
grunt migration:migrate # migrates content from capture to new plugins
grunt migration:test # tests the migrations with dummy content
grunt migration:test --file=adapt-contrib-text/migrations/text.js # tests the migrations with dummy content