Command line tool to deploy the SBS Motion Graphics Templates
Overview | Updating the Files | Using the CLI | How It Works
The deploy templates CLI automates the process of deploying any changes made to the SBS templates, across the various files and installers used across the business.
This consists of:
- Creating new installer apps with the new bundled templates and changelogs
- Copying the installers into the appropriate directories on the server
- Syncing the template files with the neccesary server locations
These steps are done based on the files in the folder structure, as well as user input to the command line prompts.
- Deploy Templates CLI
To create the installers, the Platypus command line interface must be installed. For more info on installing Platypus and it's CLI, see the How it works section.
Project File Structure
The CLI works on assumptions about the file structure of project, and so any changes made to the files must be done within this specific structure.
base-folder
βββ deploy-templates.sh
βββ dist
β βββ installerName.app
βββ LICENSE
βββ README.md
βββ src
β βββ template-package-name
β β βββ changelog
| | | βββ index.html
| | | βββ main.css
β β βββ icon.icns
β β βββ installer.config
β β βββ templates
β β | βββ mogrt-files
The files that are distrubuted are located in the src/
folder, with a sub folder for each package, e.g. src/news
and src/social
. All the templates and installer properties are contained within each of these package folders.
Versioning System
The installers, changelog and templates are versioned according to the Semantic Versioning System.
Creating New Packages
A new package may be added by duplicating an existing package in src/
, renaming it, and modifying the following files:
-
package-name/changelog/index.html
The changelog should be changed to reflect the version history of the new package.
-
package-name/icon.icns
The icon file for the installer.
-
package-name/installer.config
This contains the package specific configuration for the installer.
The
folderName
variable in this file should be updated to reflect the name of the subfolder the templates will be installed in, e.g.Motion Graphics Templates/SBS Radio
. -
package-name/templates/
The template files
(.mogrt)
for the new package should be placed into this folder.
The CLI loops through each of the subfolders in src/
, prompting for the deployment options of each package.
The templates files for each package are located in src/package-name/templates/
, with the directory strucure in this folder being copied over into the Essential Graphics
folder of the end user.
- To add a new template to the package, it just needs to be added to this folder
- To update an existing template, the old one can be replaced with the updated
.mogrt
with an incremented version number.
During the installation to the end users Essential Graphics
folder, old versions of the templates are deleted to match the source directory structure.
There is currently a sub folder for each aspect ratio provided, e.g. src/social/templates/1x1/1x1_Bug_1.0.1.mogrt
.
The changelog site is bundled with each installer, and is located in the src/package-name/changelog/
directory.
Any updates made to the template files should be documented in the index.html
file for the respective package changelog.
π Possible Change
The changelogs may soon be updated to source from a Markdown file hosted in this projects Github repository, rather than bundled with the installer. This file will be updated to reflect those changes if this is the case.
The following instructions are commands to be run in a mac terminal emulator, such as the macOS
Terminal.app
.
-
Change to the deploy templates folder, e.g.
'/Users/username/Desktop/mogrt-installer'
cd path/to/folder
-
Run the deploy templates script
bash ./deploy-templates.sh
-
Follow the prompts to deploy the templates
The installers that the deploy-templates.sh
script creates are macOS applications, that copy the template files into the relevant folders with a simple interface and error logging. An application called Platypus is used to create these installer apps.
Platypus is a simple app to create new macOS applications that run a script file with a selected interface and a couple of options. It can also create these application via the command line, using it's command line interface. The Platypus app and it's command line interface must be installed in order to run the deploy templates script.
-
Download and install the Platypus app
-
Install the CLI via the prefernces pane of the app:
The installer script that the app runs is a bash script that uses the rsync
command to copy the templates out of the application bundle and into the correct Essential Graphics folders. It also creates the user prompts, error logging and install notifications.
The script can be found at src/install-mogrt.bash
and is well documented with comments explaining what each step of the install process does.
The Deploy Templates CLI is another bash script, deploy-templates.sh
, that creates the installer apps using the Platypus CLI. It also copies these installers into a couple of different locations, as well as syncs the individual template files into other locations for uses not running the installer apps.
It does this based on input given as answers to a list of specified questions, such as which packages to deploy, installer version numbers, and whether to sync the individual template files.
Changes can be made by cloning this project locally, creating a new fork, and then creating a pull request to publish the changes to the master.
As this project is specific to the needs of deploying templates at SBS, many of the commands are dependant upon having various SBS specific drives and locations accesible.
β οΈ Please NoteDue to their large files size, the templates and installer apps are not included as tracked files in this repo. This means to do any testing template files must be copied from elsewhere into the correct directories.
Created by Tim Haywood and Danny Jenkins for SBS Australia
Licensed under the terms of the MIT License