Skip to main content

Source Control for Google App Scripts

[update 30 May 2019: This post has been outdated.
Google has released clasp which allows the development of app script locally]

Google App Script (GAS) is a very versatile tool for writing scripts to control many of the GSuites and Google Cloud services. One can build many small applications using GAS and hosts it seamlessly on Google Drive for free. It has a built-in editor, debugging tool and logging of logs to StackDriver. The main drawback I had with GAS is the difficulty to create save the scripts to source control like Github.

Fortunately, danthareja shared his tools to read/write app script into GDrive seamlessly, but the script has a limitation, it can only handle a single project. This is because it is writing the OAuth information into %UserProfile%\.gapp.

I wrote a simple wrapper script pull.bat and push.bat that synchronous the App Script.

 pull.bat
       
copy .gapps %UserProfile%\.gapps 
gapps init [REPLACE YOU PROJECTID] -o

Copy the local version of the ".gapps" to the %UserProfile% directory and overwrite the local copy of the script file.

push.bat
       
copy .gapps %UserProfile%\.gapps 
gapps push

Copy the local version of the ".gapps" to the %UserProfile% directory and push to Google Drive.

Together with danthareja script, I can easily use Github to perform my version control for my many app script projects.

Comments

Popular posts from this blog

Xiaomi Mi Flora Chinese and International version comparison

Xiaomi Miflora sensor allows monitoring of the surrounding environment of the plant. It can monitor temperature, soil moisture, conductivity (acidity of the soil), ambience light. There are 2 versions of the sensor, international and Chinese version. Realistically, I cannot see the difference between the 2 versions. The left-hand side is the Chinese version and the right is the international version. Other than the packaging, the main difference is the price of the sensor. The International version cost 2x more. In other forums, there are discussions that the Chinese version cannot connect to the MiHome App. I have set my MiHome app to connect to China server and it is able to register the sensor correctly. For my usage, I will be connecting to Openhab to monitor the plants andusing  Thomas Dietrich MiFlora mqtt daemon  as the bridge between Openhab and the sensor. The International version is detected as Flower care and the firmware version is 3.1.9 wh...

Using ESP-Link transparent bridge (ESP-01 and Arduino Pro Mini)

Recently stumbled across an interesting open source project ESP-Link . Its main purpose is to network-enable a non-network microcontroller (MCU) such as Arduino Uno, Pro mini or Nano using ESP8266. The author termed it as "Transparent Bridge". The ESP and MCU  communicate via the serial link and there is a companion Arduino library EL-Client  for the MCU to connect up the network using MQTT, REST, TCP and UDP. Setup I have put together an ESP-01 and an Arduino Pro Mini for this experiment. I have chosen a 3.3 version Pro mini so that I do not need to do any voltage level shifting between the I/O pins. In order to have a stable voltage source, the ESP8266 is powered by Pro Mini and the Pro Mini "RAW" pin is connected to a 5v USB power source. The RAW pin can take voltage up to 12V. The reset pin of Pro Mini is connected to GPIO 0 of ESP-01. This enables the ESP-01 to reset the Pro Mini.   I have linked up an APDS 9960 sensor to it and periodically se...