Name: anno-docs-publish-addon
Owner: NPR visuals team
Description: Source files for the anno-docs publish Add-on
Created: 2017-02-28 15:14:15.0
Updated: 2017-03-02 16:00:13.0
Pushed: 2017-03-02 16:00:12.0
Homepage: null
Size: 311
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Google Docs Add-on to publish a non-live factcheck.
This functionality is useful to allow for a more autonomous way of producing non-live events from the editorial perspective.
The Add-on has two functions you can run:
slug
and publishes the contents of the preview staging to that slug
in production.So the overall workflow for publishing a new non-live factcheck would be:
Set Authors Spreadsheet
addon function to link to the authors that will do the annotations.Publish Non-Live Preview
as many times as needed to check the results of your work.Publish
function to publish the results and make them publicly available.Since this will create a publicly available resource the document that will host this addon is kept private for NPR, but you can use this repo to create your own publish workflow.
The following things are assumed to be true in this documentation.
For more details on the technology stack used with the app-template, see our development environment blog post.
The project contains the following folders and important files:
code
– Google Apps Script Add-On source filesfabfile
– Fabric commands for automating setup, deployment, data processing, etc.templates
– HTML (Jinja2) templates, to be compiled locally.app.py
– A Flask app for rendering the project locally.app_config.py
– Global project configuration for scripts, deployment, etc.render_utils.py
– Code supporting template rendering.requirements.txt
– Python requirements.nno-docs-publish-addon
rtualenv anno-docs-publish-addon
install -r requirements.txt
Problems installing requirements? You may need to run the pip command as ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install -r requirements.txt
to work around an issue with OSX.
Project secrets should never be stored in app_config.py
or anywhere else in the repository. They will be leaked to the client if you do. Instead, always store passwords, keys, etc. in environment variables and document that they are needed here in the README.
Any environment variable that starts with $PROJECT_SLUG_
will be automatically loaded when app_config.get_secrets()
is called.
There's an auxiliary flask app on the repo used only to create/refresh google drive credentials in case there¡s a need to do it.
The project is meant to be deployed to google drive and executed from there.
We use our codebase stored on github as the master for the Google Apps Scripts code. We have created a series of Fabric commands to ease the workflow of updating the actual code run inside google drive.
gs.list_projects
It will return a complete list of Google Apps Script projects. It accepts and optional owner parameter to filter out the results to a given owner. for example the following command will return only the projects that you have created:
gs.list_projects:me
If you want to create the project on your own drive, first inside app_config.py
update DRIVE_PARENT_FOLDER_ID
to reflect one existing folder where you want the standalone script to live in. Then you can run:
[ENVIRONMENT] gs.create
This will create a new google apps script project on a subfolder that will depend on the ÈNVIRONMENT used development
or production
.
Imagine your root folder on drive is called scripts
. The fabric tasks expect the following folder structure:
pts
velopment
oduction
While you are developing changes to the google apps script, we strongly recommend that you use the Publish -> Test as add-on
option on the project until you are happy with the results.
If you want to update local changes to a Google Apps Script Project you can run:
[ENVIRONMENT] gs.upsert
Where ENVIRONMENT
can be: development
or production
. Depending on the environment passed the command will update the appropriate Google App Script Project using app_config
properties. For development it would be:
development gs.upsert
Google document permissions are restricted to the editors that will use the functionality to publish non-live factchecks
Released under the MIT open source license. See LICENSE
for details.
This repo was developed by NPR Visuals team.
See additional CONTRIBUTORS