63
votes

I am confused about the best way to manage shared development of Google App Scripts. The thing is that editing google app scripts is done through an online editor with its own version control in place, but that's not shared with other developers as far as I can tell.

So is the suggested practice that we copy and paste from that editing space into local hard files and then push into the version control system of our choice, and then when we want to test things we copy and paste things back into the online editor? Seems messy and error prone.

I see some people are putting their Google App Scripts in places like Github:

https://github.com/peterneubauer/neo4j-google-apps-script

Would be great it we could push directly from git to deploy on Google App Scripts the same way we do with Heroku. Would really like to be able to run a battery of unit tests against my App Scripts ...

5
would be nice if people would comment and say why posts are inappropriate rather than just hitting posts with a minus one. I thought this was a reasonable question according to the guidelines ...Sam Joseph
I am of course aware of the collaboration portion of the GAS docs: developers.google.com/apps-script/collaborating but this seems to be for sharing finished scripts with other developers, rather than collaborating with other developers on the development of a script, which is what something like github supports really well ...Sam Joseph
I totally support this. I currently have two main issues with Google Apps script: Missing unit testing support (*) and missing git support.luebken
luebken: totally agreed - although there are some testing frameworks: code.google.com/p/gasunit what I'd really like to see is good support for BDD, behavior driven design, so I could hit a google app script with something like cucumber - at the moment I can't work out how to handle the google login part, but maybe it is doable ...Sam Joseph
Voting to re-open this in view that this is no more opinion-based. There's a definitive and officially supported method now with clasp.TheMaster

5 Answers

40
votes

You can star issue 217 and issue 1959 if that is important to you.

Update: Take a look at Advanced Development Process with Apps Script

9
votes

Here is how I did. I used the command line tool, gdcmdtools, to import and export my GAS project.
And stored the exported project in github.
Example:

  • gdget.py FILE_ID -f json # down files associated with GAS project with id FIELD_ID, you will get PROJECT_NAME.json and the source files.

  • store the files to version control, like: github.

  • gdput.py -t gas PROJECT_NAME.json # update GAS project with project file 'PROJECT_NAME.json'

For more information, check Manage-Google-Apps-Script(GAS)-with-gdcmdtools

6
votes

I just published an npm module for import/export. It's a simpler version of gdcmdtools linked above. Example usage:

  • gaps init
  • gaps download <fileId> clones complete project in current working directory
  • cd into project folder and run gaps upload to push it back up to Google

Run npm install -g node-google-apps-script or check it out here: https://github.com/danthareja/node-google-apps-script. In the next version I'm planning to add a "sync with github" feature.

0
votes

You can use Gulp to make it easier.

My source comprises several files and folders, which then get combined into a single file on every save.

Then I copy and paste the build to the script editor to test.

A little easier. I think it would be pretty straightforward to add a function to the Gulp watch task that will automatically update the Google App Script Editor as well

0
votes

I have not used this, however while reading up on the current state of this request, there was a reference to an Eclipse plugin.

https://developers.google.com/eclipse/docs/apps_script

I'm not sure how I feel about this. I am somewhat enamoured with the fact that the entire development environment is online. Moving part of my build process to my desktop kind of ruins that. Having said that... this may allow for some git/gas integration.