Name: liveblog-addon
Owner: NPR visuals team
Description: Liveblog Google Docs AddOn Source
Created: 2017-03-06 15:14:11.0
Updated: 2017-03-21 02:20:50.0
Pushed: 2017-03-21 02:20:49.0
Homepage: null
Size: 3109
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Google Docs Add-on to add liveblog posts.
If you just want to use it there's a publicly available Google Doc Template that you can make a copy of and it will include all the necesary code to run the Add-on.
The Add-on has six functions you can run:
Each post consists of:
Even though it can be used for other purposes it was developed to be combined with NPR liveblog system. You can find more information of how to use that rig here.
Here's a screenshot of a post as displayed by our liveblog rig.
The source of the Liveblog Add-on is inside the code
folder, the rest of the repo contains development tools that will allow us to upload the google app script project using our own oAuth credentials.
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.iveblog-addon
rtualenv liveblog-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.
A flask app is used to run the project locally. It will automatically recompile templates and assets on demand.
on anno-docs-addon
app
Visit localhost:8000 in your browser.
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
We are accessing the Live Fact Check document from the server to pull out its content using credentials associated with nprappstumblr@gmail.com
we need to make sure that nprappstumblr@gmail.com
has at least read access to the document in order to avoid a 403
response to the server.
Released under the MIT open source license. See LICENSE
for details.
This repo was developed by NPR Visuals team.
See additional CONTRIBUTORS