From 225aaf9a936203edaf046803b4ebfbb4e193420d Mon Sep 17 00:00:00 2001 From: Dave Aiello Date: Thu, 15 Dec 2011 18:50:05 -0500 Subject: [PATCH 1/4] README cleanup Replaced references to ALPHA and BETA with LIVE and STAGING. Clarified that invocation of the export templates script needs to be "perl tools/github_export_templates.pl...." --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 222439f..822922b 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ This plugin only provides command-line tools; it does not extend any user-facing ## Process -1. Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both ALPHA and BETA. +1. Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both LIVE and STAGING. 2. Run the export script on the LIVE instance as a backup. - perl tools/github_export_templates --output_dir=/full/path/to/output/dir + perl tools/github_export_templates.pl --output_dir=/full/path/to/output/dir 3. Check the resulting LIVE files (in that /full/path/to/output/dir path) into your favorite code repository in its own branch. From 4eb06c51c279419660c59d0f1484a62ebea535aa Mon Sep 17 00:00:00 2001 From: Dave Aiello Date: Sat, 5 May 2012 01:52:01 -0400 Subject: [PATCH 2/4] Changing the name of info.txt to templates.manifest, adding to process documentation The file containing the list of Movable Type templates exported by github_export_templates.pl was changed from "info.txt" to "templates.manifest". This is to emphasize the contents of this file and the pique the curiosity of developers using these tools in their migration processes. --- README.md | 11 ++++++----- tools/github_export_templates.pl | 8 ++++---- tools/github_import_templates.pl | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 822922b..f16740a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # SUMMARY -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. +This plugin facilitates the movement of custom template sets 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 a templates.manifest file (formerly known as info.txt) providing as the index. The export script does not modify an MT instance's templates at all; it only reads from the database. -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. - +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. @@ -19,6 +17,9 @@ This plugin only provides command-line tools; it does not extend any user-facing ## Process + +It is extremely on multi-developer projects that everyone who may commit to the Github repository understand the following workflow. If this process is adopted, all commits involving changes to template text files must be made from a complete set of directories created or updated using github_export_templates.pl. If execution of github_export_templates.pl is omitted, this may result in templates.manifest becoming out of sync with the template text files. + 1. Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both LIVE and STAGING. 2. Run the export script on the LIVE instance as a backup. diff --git a/tools/github_export_templates.pl b/tools/github_export_templates.pl index 866eaab..217ec72 100755 --- a/tools/github_export_templates.pl +++ b/tools/github_export_templates.pl @@ -36,7 +36,7 @@ $output_dir = TemplatesToGithub::Util::create_directory($output_dir); # clear info file it if exists. -unlink("$output_dir/info.txt"); +unlink("$output_dir/templates.manifest"); # for each blog, dump their templates. my $blog_iter = MT::Blog->load_iter(); @@ -46,7 +46,7 @@ $blog->id, $blog->name, $output_dir, - "info.txt")); + "templates.manifest")); } # repeat for the global templates. @@ -54,9 +54,9 @@ 0, TemplatesToGithub::Util->GLOBAL_BLOG_NAME, $output_dir, - "info.txt")); + "templates.manifest")); -#open (OUTPUTINFO, ">>$output_dir/info.txt"); +#open (OUTPUTINFO, ">>$output_dir/templates.manifest"); #print OUTPUTINFO encode_json(\@final_summary) . "\n"; #close OUTPUTINFO; diff --git a/tools/github_import_templates.pl b/tools/github_import_templates.pl index 086801c..683da32 100755 --- a/tools/github_import_templates.pl +++ b/tools/github_import_templates.pl @@ -112,7 +112,7 @@ sub import_blog_templates { my %template_change_counter = TemplatesToGithub::Util->TEMPLATE_TYPES; # suck in imported templates - open (INPUT, "< $input_dir/info.txt"); + open (INPUT, "< $input_dir/templates.manifest"); my $whole_file = ""; my $line = ; while ($line) { From 5764f31a0ce28fb17428ec2d3954f4bd1b153187 Mon Sep 17 00:00:00 2001 From: Dave Aiello Date: Sat, 5 May 2012 01:55:13 -0400 Subject: [PATCH 3/4] Minor wording changes to README.md. Further clarifying the scripts' purpose and role in a deployment workflow. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f16740a..79ceb21 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This plugin only provides command-line tools; it does not extend any user-facing ## Process -It is extremely on multi-developer projects that everyone who may commit to the Github repository understand the following workflow. If this process is adopted, all commits involving changes to template text files must be made from a complete set of directories created or updated using github_export_templates.pl. If execution of github_export_templates.pl is omitted, this may result in templates.manifest becoming out of sync with the template text files. +It is extremely important on multi-developer projects that everyone who may commit template code to the Github repository understands and uses the following workflow. If this process is adopted, all commits involving changes to template text files must be made from a complete set of directories created or updated using github_export_templates.pl. If execution of github_export_templates.pl is omitted on either the LIVE or STAGING server, this may result in templates.manifest becoming out of sync with the template text files. 1. Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both LIVE and STAGING. From a7b22f58e087d54c38dd15ce8f6221a923b39dc7 Mon Sep 17 00:00:00 2001 From: Dave Aiello Date: Wed, 15 Dec 2021 10:16:11 -0500 Subject: [PATCH 4/4] Minor Changes to the Project, Due to Recent Usage with a Client Bumped version to 1.1, added additional documentation, cleaned up code in the plugins and tools directories. --- README.md | 60 ++++++++++++++----- plugin/TemplatesToGithub/config.yaml | 4 -- plugins/TemplatesToGithub/config.yaml | 6 ++ .../lib/TemplatesToGithub/Util.pm | 2 +- tools/github_export_templates.pl | 2 +- 5 files changed, 52 insertions(+), 22 deletions(-) delete mode 100644 plugin/TemplatesToGithub/config.yaml create mode 100644 plugins/TemplatesToGithub/config.yaml rename {plugin => plugins}/TemplatesToGithub/lib/TemplatesToGithub/Util.pm (99%) diff --git a/README.md b/README.md index 79ceb21..d9ba391 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,41 @@ -# SUMMARY +# TemplatesToGithub -This plugin facilitates the movement of custom template sets in Movable Type 4 between instances with the benefit of easy insertion into a code repository system. +# Summary -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 a templates.manifest file (formerly known as info.txt) providing as the index. The export script does not modify an MT instance's templates at all; it only reads from the database. +This plugin facilitates the movement of custom template sets in Movable Type between instances with the benefit of easy insertion into a git-based code repository system. -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. +# Naming Conventions -This plugin only provides command-line tools; it does not extend any user-facing or editorial functionality of Movable Type. +## Significance of the name TemplatesToGithub +The assumption made in the naming of this plugin is that most developers using git will use use the Software-as-a-Service provider of distributed version control and source code management known as [GitHub](https://github.com), which is owned by Microsoft, as their cloud git repository. -# USAGE +But this plugin does not require use of Github. Developers could manage git repositories to which templates are contributed locally, or could manage those git repositories via a corporate or institutional git repository, or an alternative cloud service to GitHub. ## Terminology STAGING: The MT instance that has the templates you're going to export - LIVE: The MT instance where you'll import STAGING's templates - + PRODUCTION: The MT instance where you'll import STAGING's templates + +# Usage + +This plugin includes command-line tools, that are used in conjunction with the plugin itself, to implement the import and export of text files representing each template; neither the plugin nor the associated command-line tools extend any user-facing or editorial functionality within the Movable Type content management 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 a templates.manifest file (formerly known as info.txt) 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. ## Process -It is extremely important on multi-developer projects that everyone who may commit template code to the Github repository understands and uses the following workflow. If this process is adopted, all commits involving changes to template text files must be made from a complete set of directories created or updated using github_export_templates.pl. If execution of github_export_templates.pl is omitted on either the LIVE or STAGING server, this may result in templates.manifest becoming out of sync with the template text files. +It is extremely important on multi-developer projects that everyone who may commit template code to the Github repository understands and uses the following workflow. If this process is adopted, all commits involving changes to template text files must be made from a complete set of directories created or updated using github_export_templates.pl. If execution of github_export_templates.pl is omitted on either the PRODUCTION or STAGING server, this may result in templates.manifest becoming out of sync with the template text files. -1. Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both LIVE and STAGING. +1. Deploy the TemplatesToGithub plugin and the github_export_templates.pl and github_import_templates.pl tools to both PRODUCTION and STAGING. -2. Run the export script on the LIVE instance as a backup. +2. Run the export script on the PRODUCTION instance as a backup. perl tools/github_export_templates.pl --output_dir=/full/path/to/output/dir -3. Check the resulting LIVE files (in that /full/path/to/output/dir path) into your favorite code repository in its own branch. +3. Check the resulting PRODUCTION files (in that /full/path/to/output/dir path) into your favorite code repository in its own branch. 4. Run the export script on the STAGING instance. Same command as Step #2 but in the Staging environment. @@ -37,17 +45,37 @@ It is extremely important on multi-developer projects that everyone who may comm 7. When you're ready to make those staging template live, you can do any amount of branch merging or tagging; whatever suits your process. -8. TEST OUT an import of templates into the LIVE environment with the following command: +8. TEST OUT an import of templates into the PRODUCTION environment with the following command: perl tools/github_import_templates.pl --input_dir=/full/path/to/staging/templates -9. 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. +9. 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 PRODUCTION, if a blog existed on STAGING but not PRODUCTION; if a template cannot be found, etc. -10. Execute the template import into the LIVE environment: +10. Execute the template import into the PRODUCTION environment: perl tools/github_import_templates.pl --input_dir=/full/path/to/staging/templates --apply_changes -11. Revert to the LIVE templates (exported in Step 2) in case of emergency. \ No newline at end of file +11. Revert to the PRODUCTION templates (exported in Step 2) in case of emergency. + +# Support + +For technical support of this theme, contact After6 Services at support@after6services.com or customer.service@after6services.com. + +# License + +# Authorship + +The TemplatesToGithub Plugin and associated command line tools were originally developed by Natalie Podrazik. This project was adopted by After6 Services LLC, with small code and documentation changes by Dave Aiello. + +# Copyright + +Copyright © 2011, Natalie Podrazik. + +Copyright © 2012-2021, After6 Services LLC. All rights reserved. + +AMovable Type is a registered trademark of Six Apart Limited. + +Trademarks, product names, company names, or logos used in connection with this repository are the property of their respective owners and references do not imply any endorsement, sponsorship, or affiliation with After6 Services LLC unless otherwise specified. diff --git a/plugin/TemplatesToGithub/config.yaml b/plugin/TemplatesToGithub/config.yaml deleted file mode 100644 index 127f62d..0000000 --- a/plugin/TemplatesToGithub/config.yaml +++ /dev/null @@ -1,4 +0,0 @@ -id: TemplatesToGithub -name: TemplatesToGithub -description: This plugin provides supplemental library for command-line exporting and importing of MT templates to github.com repositories. -version: 1.0 diff --git a/plugins/TemplatesToGithub/config.yaml b/plugins/TemplatesToGithub/config.yaml new file mode 100644 index 0000000..2fc37a6 --- /dev/null +++ b/plugins/TemplatesToGithub/config.yaml @@ -0,0 +1,6 @@ +id: TemplatesToGithub +name: TemplatesToGithub +description: 'This plugin provides supplemental library for command-line exporting and importing of MT templates to github.com repositories.' +author_name: 'After6 Services LLC' +author_link: 'http://after6services.com' +version: 1.1 diff --git a/plugin/TemplatesToGithub/lib/TemplatesToGithub/Util.pm b/plugins/TemplatesToGithub/lib/TemplatesToGithub/Util.pm similarity index 99% rename from plugin/TemplatesToGithub/lib/TemplatesToGithub/Util.pm rename to plugins/TemplatesToGithub/lib/TemplatesToGithub/Util.pm index 307a659..9741db4 100644 --- a/plugin/TemplatesToGithub/lib/TemplatesToGithub/Util.pm +++ b/plugins/TemplatesToGithub/lib/TemplatesToGithub/Util.pm @@ -111,4 +111,4 @@ sub debug { print STDERR "$msg" if DEBUG; } -1; \ No newline at end of file +1; diff --git a/tools/github_export_templates.pl b/tools/github_export_templates.pl index 217ec72..a120eea 100755 --- a/tools/github_export_templates.pl +++ b/tools/github_export_templates.pl @@ -169,4 +169,4 @@ sub export_blog_templates { -1; \ No newline at end of file +1;