Script Repository Setup

Script Directory Structure

To help organize your JavaScript files in a source code repository, Accela recommends the following directory structure:

Event Script File Naming Convention

To easily manage and and allow EMSE to locate event scripts, use the following naming convention for the JavaScript filenames:
Where (use capital letters):
  • AAAA = Event Prefix (see EMSE_VARIABLE_BRANCH_PREFIX standard choice, examples are WTUA, CRCA, ASA)

  • B = Module (e.g., LICENSES)

  • C = Application Type, or tilde (~) for wildcard

  • D = Sub-type, or tilde (~) for wildcard

For example:

When the script files are deployed from your local repository into Civic Platform using the EMSE tool, the script filenames are converted into script names that show variable branching. For example:

Custom Function Files in the INCLUDES_CUSTOM folder

Instead of storing multiple custom functions in one INCLUDES_CUSTOM file, Master Scripts 3.0 allows you to easily create and manage custom functions in individual JavaScript files. The only requirement is that you store the JavaScript files in a folder named INCLUDES_CUSTOM. Use the custom JavaScript function name as the filename. For example:

When the custom function files are ready for deployment into Civic Platform, use the EMSE Tool to build them into the INCLUDES_CUSTOM script and upload it into Civic Platform. See Deploying Custom Functions.

Managed Code Repository

After you have created JavaScript files in your local file structure, Accela recommends that you upload the file structure into a managed code repository to help you manage and share the scripts across your team or across environments (for example, Development to Production environments). Open-source cloud code repository systems are available such as Github or Assembla. You can also use traditional source code control systems such as Subversion SVN.

The following procedure summarizes how you would setup your scripts in a code repository:
  • Create a repository in an online or enterprise code repository system such as Github or SVN.
  • Synchronize the repository with your local folder.
  • If not done yet, populate the folder with the script file structure, as described in Script Directory Structure.
  • Commit or check-in the initial revision into the repository.