This plugin facilitates the movement of custom templatesets in Movable Type 4 between instances with the benefit of easy insertion into a code repository system.
The export script exports the instance's full set of templates, including the Global Templates, into a directory of text files, organized per blog per template type, with an info.txt file providing as the index. The export script does not modify an MT instance's templates at all; it only reads from the database.
The import script only modifies live content with the --apply_changes flag. Without that flag, the script prints status messages and any potential errors with the intended import. The import script does not preserve template_id's between environments; it keys off of blog name, template name, and output file.
This plugin only provides command-line tools; it does not extend any user-facing or editorial functionality of Movable Type.
STAGING: The MT instance that has the templates you're going to export
LIVE: The MT instance where you'll import STAGING's templates
-
Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both ALPHA and BETA.
-
Run the export script on the LIVE instance as a backup.
perl tools/github_export_templates --output_dir=/full/path/to/output/dir
-
Check the resulting LIVE files (in that /full/path/to/output/dir path) into your favorite code repository in its own branch.
-
Run the export script on the STAGING instance. Same command as Step #2 but in the Staging environment.
-
Check the resulting STAGING files into your favorite code repository in a different branch than Step #3.
-
If you want to do some diff'ing, use your favorite file-diffing or repo-diffing tools.
-
When you're ready to make those staging template live, you can do any amount of branch merging or tagging; whatever suits your process.
-
TEST OUT an import of templates into the LIVE environment with the following command:
perl tools/github_import_templates.pl --input_dir=/full/path/to/staging/templates
-
Resolve any errors that happen in Step 8; repeat Step 8 until the script finishes successfully. Errors will be displayed if a template archive existed on STAGING but not LIVE, if a blog existed on STAGING but not LIVE; if a template cannot be found, etc.
-
Execute the template import into the LIVE environment:
perl tools/github_import_templates.pl --input_dir=/full/path/to/staging/templates --apply_changes
-
Revert to the LIVE templates (exported in Step 2) in case of emergency.