@impleta/gas-turbine
v0.1.3
Published
REPL and testing framework for Google Application Scripts
Readme
gas-turbine
REPL and testing framework for Google Application Scripts
Usage
> gas-turbine
Logged in as <email>
> const folders = await GT.drive.getMyDriveContents();
> const Installation
npm i -g @impleta/gas-turbine
Set up authentication
This is a one-time setup
- Visit https://console.cloud.google.com/cloud-resource-manager and create a new project named
gas-turbinewith IDgas-turbine.
Option 1: OAuth2
This option allows scripts executed by Gas Turbine the same access as your primary Google account over all of Google drive. Any folders or files created will be owned by your user account.
- Visit https://console.cloud.google.com/apis/credentials/consent?project=gas-turbine
- Select External if you are not a Google Workspace User, or Internal if you are and you want to limit access to your organization only.
- Fill in the
App name,User support email, andDeveloper contact Informationrequired fields. ClickSAVE AND CONTINUE. - On the
Scopespage, clickSAVE AND CONTINUE. - Optionally add any users on the
Test userspage, then clickSAVE AND CONTINUE. - Click on
Credentialson the left (or visit https://console.cloud.google.com/apis/credentials?project=gas-turbine - Click
CREATE CREDENTIALSat the top and selectOAuth client ID. - For
Application type, selectWeb application - For
Name, enterGasTurbine Web Client. - Select Create.
- On the OAuth client created click
DOWNLOAD JSON. Save the file to a safe location. Do not share this or commit this file to source control.
Option 2: Service Account
This option can be used to restrict access only to certain shared folders and documents on your Google drive. Any folders or files created will be owned by the Service Account, though your main account will have write access.
- Visit https://console.cloud.google.com/iam-admin/serviceaccounts?project=gas-turbine
- Click on
CREATE SERVICE ACCOUNTat the top. - Set the
Service account nametogas-turbine-service-account, and clickCREATE AND CONTINUE - Set the Role as
OwnerunderGrant this service account access to project - Back on the
Service account for project "Gas Turbine"page, click on the email address. - Click on
KEYSon the top, thenADD KEY>Create new key - Select
JSONon the dialog that pops up, thenCREATE - A JSON file will be downloaded to the downloads folder of your browser. Move this to a safe location on your computer. Do not share this or commit this file to source control.
- Note: You will not be able to download this file again in the future, but you can create a new key should this file be lost.
Usage
> gas-turbine --credential <path-to-oauth2-or-service-account-keys.json>
Logged in as <email-address>
> const folders = await GT.drive.getMyDriveContents()If authenticated via OAuth2, You will be prompted to select the User, and
