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
.
Table of Contents
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.
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:
To determine which Linux or Mac download you need, you can use the terminal command:
uname -m
To download via your terminal use:
1 |
wget "https://github.com/Yagisanatode/claspall/releases/download/v0.1.0/<your_selected_claspall_binary>" |
For example:
1 |
wget "https://github.com/Yagisanatode/claspall/releases/download/v0.1.0/claspall_Linux_x86_64.tar.gz" |
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.
mkdir -p ~/bin
This will create a localbin
folder if one does not yet exist.mv claspall ~/bin
This moves theclaspall
executable to thebin
folder.
Note that this will overwrite any previousclaspall
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.
If you haven’t set up the path:
~/bin/claspall -v
This will display the current version if everything is successful
1 2 3 4 5 6 7 8 9 10 |
if [[ -f ~/.profile ]]; then echo "Appending to ~/.profile" echo "export PATH=~/bin:$PATH" >> ~/.profile elif [[ -f ~/.bash_profile ]]; then echo "Appending to ~/.bash_profile" echo "export PATH=~/bin:$PATH" >> ~/.bash_profile else echo "Creating ~/.profile" echo "export PATH=~/bin:$PATH" > ~/.profile fi |
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:
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:
1 |
curl -O "https://github.com/Yagisanatode/claspall/releases/download/v0.1.0/<your_selected_claspall_binary>.zip" |
For example:
1 |
curl -O "https://github.com/Yagisanatode/claspall/releases/download/v0.1.0/claspall_Windows_x86_64.zip" |
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.
-
mkdir -p C:\Path
This will create aPath
folder in C-drive.move claspall.exe C:\Path
This will move your unzipped file to yourPath
folder. Make sure you are in the same directory (e.g. your downloads folder) as your extractedclaspall.exe
file.-
1echo ;%PATH%; | find /C /I ";C:\Path;" > nul && echo Path already exists || (setx PATH "%PATH%;C:\Path" && echo Path added)
Optional. Ensure yourPath
folder is set to your local path. If it isn’t add it to your local path. claspall -v
Test your claspall app. This should show the current version number.
Go
You can also build and install the Golang project.
1 2 3 |
git clone https://github.com/Yagisanatode/claspall.git cd claspall go install |
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
-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.
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
Looks very nice. I haven’t tried it yet, but looks nice. Thanks for sharing your code. It really helps others learn. 👍🏼