CLASPALL – Update Multiple Apps Script Projects From a Single Source

CLASPALL for Google Apps Script

CLASPALL is a command line app that runs with CLASP, allowing you to update multiple Google Apps Script projects from a single core project file.

When developing for clients I typically have 3 separate projects:

  • Development
  • Testing
  • Production

CLASPALL allows me to update my Testing and Production projects from my Development project with a single command in my terminal: CLASPALL.

 

Requirements

CLASP -A tool that helps you develop Google Apps Script files locally. You can learn how to install CLASP here.

Features

  • Updates multiple projects from a source project with a single command.
  • Add multiple projects to the update list.
  • Edit projects in the update list.
  • Delete projects from the update list.
  • List projects in the update list.
Hire me for our next Google Workspace project.

Installation

You can download the latest version here:

https://github.com/Yagisanatode/claspall/releases/latest

Linux or Mac

Download the binary

You can download the binary for your system from here:

CLASPALL releases

To determine which Linux or Mac download you need, you can use the terminal command:

uname -m

To download via your terminal use:

 

For example:

 

Extracting the file

Navigate to your downloads folder or the location where you downloaded the file.

In the command line, use:

tar -xf <your_selected_claspall_binary>.gz

For example,

tar -xf claspall_Linux_x86_64.tar.gz

This will extract the claspall executable.

Set to path

You can choose to set the file to path so you can use it on any project by doing the following.

  1. mkdir -p ~/bin
    This will create a local bin folder if one does not yet exist.
  2. mv claspall ~/bin
    This moves the claspall executable to the bin folder.
    Note that this will overwrite any previous claspall downloads.

If you have already set your path to the bin folder then you are good to go, you can run claspall -v to get the current version to check if everything is running successfully.

🐐You can support me for free by using this Amazon affiliate link in your next tech purchase :Computers & Stuff! 🐐

If you haven’t set up the path:

  1. ~/bin/claspall -v
    This will display the current version if everything is successful

This will check if your system has a ~/.profile bash file and then append the bin file to the path in the file. If it doesn’t it will check for a ~/bash_profile file and do the same. If neither exists, it will create the ~/.profile bash file and add the bin to path.

Windows

Download the binary

You can download the binary for your system from here:

CLASPALL releases

To determine which Windows download you need, you can use the Windows command line:

echo %PROCESSOR_ARCHITECTURE%

You can download the zip file from the command line with:

For example:

 

Extracting the file

Head to your downloads folder and extract the zip file.

From the file manager, you can double-click on the zip file and copy and paste in the claspall.exe file into the parent file.

From the command line, you can:

<your_selected_claspall_binary>.zip

For example:

tar -xf claspall_Windows_x86_64.zip

Set to path

If you already have a directory for your local or system path copy and paste the claspall.exe file to this location.

If not, create a Path folder.

    1. mkdir -p C:\Path
      This will create a Path folder in C-drive.
    2. move claspall.exe C:\Path
      This will move your unzipped file to your Path folder. Make sure you are in the same directory (e.g. your downloads folder) as your extracted claspall.exe file.

    3. Optional. Ensure your Path folder is set to your local path. If it isn’t add it to your local path.
    4. claspall -v
      Test your claspall app. This should show the current version number.

Go

You can also build and install the Golang project.

 

How  to use CLASPALL

Cloning an Apps Script Project Locally

If you haven’t already cloned a project to your local drive, do so with:

clasp clone "your Google Apps Script project ID"

Alternatively, you can create a project from scratch locally with:

clasp create 

Then follow the prompts to create a project.

Both approaches will generate a .clasp.json file containing your main project ID.

This will be the primary project that you will edit and update.

Add all the projects you want to update

Next, we need to add all projects that you want to update automatically from your main project.

You can do this with the following tag:

claspall -add "title:Apps-Script-File-Id"

Between quotation marks add a name or title then a colon (:) and the file ID. Close quotation marks.

For example:

claspall -add "Prod:1_hg5Lj-lOXbZMm60FizXSEZBmYN27-ozK-JOX4fRmEWntroxQ"

You can edit, delete and list your current projects too. Check out the Tags section for more information.

Run CLASPALL

Once all of your projects have been added all you need to do is run:

CLASPALL

… in your project folder.

That’s it. Watch the magic unfold.

CLASPALL Tags

-add string

Add a new Apps Script file location:
[how] Between quotation marks add a name or title then
a colon (:) and the file id. Close quotation marks.
[syntax] claspall -add "title:Apps-Script-File-Id"
[example]
claspall -add "Prod:1_hg5Lj-lOXbZMm60FizXSEZBmYN27-ozK-JOX4fRmEWntroxQ"
[more]
— You might consider having a “Test” project and a “Production” project AppsScirpt file
— You can find the project id in the ‘Project Settings’ > ‘IDs’ section.
— Don’t include the current project you are working in. This will be your ‘Dev’ file.

-del int

Delete an Apps Script file location:
– [how] Select a Apps Script file reference to delete by number from the -list.
– [syntax] claspall -del Number
– [example]
claspall -del 1
[more]
— You can use the -list flag to get the selected file location to remove
— This will not delete the file. It will stop the delete file from being updated from the core file.

-edit string

Edit existing Apps Script file location information:
[how] Select an Apps Script file reference from the list and update the title and/or file ID.
[syntax] claspall -edit id:title:Apps-Script-File-Id
[example]
claspall -edit "1:Prod:1_hg5Lj-lOXbZMm60FizXSEZBmYN27-ozK-JOX4fRmEWntroxQ
[more]
— to edit just the Title: “1:New Title:”
— Leave out the id after the first colon.
— To edit just the Apps Script File ID:
"1::1_hg5Lj-lOXbZMm60FizXSEZBmYN27-ozK-JOX4fRmEWntroxQ"
— Leave out the name between the ID and the Apps Script File ID colon separators.

-list  or -ls

Lists all connected file locations

Create and Publish Google Workspace Add-ons with Apps Script Course 300px

CLASPALL project list

-version or -v

The project version.

For example. 0.1.0.

-help or -h

The help flag lists all of the other flags and provides usage instructions.

CLASPALL project help

About The Project

This project was a small starter project to learn some Golang and a handy tool to use in my own projects.

You can check out the repo on Github here:

https://github.com/Yagisanatode/claspall

~Yagi

2 thoughts on “CLASPALL – Update Multiple Apps Script Projects From a Single Source”

  1. Looks very nice. I haven’t tried it yet, but looks nice. Thanks for sharing your code. It really helps others learn. 👍🏼

Leave a Reply