nprapps/liveblog-addon

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

liveblog-addon

What is this?

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.

Copy

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.

factcheck

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.

Assumptions

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.

What's in here?

The project contains the following folders and important files:

Bootstrap the project
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.

Hide project secrets

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.

Run the project

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.

Google Apps Scripts Development

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.

List projects
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
Create project

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
 Test as an Add-On

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.

Test as an Add-On

 Upsert project

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

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.

License and credits

Released under the MIT open source license. See LICENSE for details.

Contributors

This repo was developed by NPR Visuals team.

See additional CONTRIBUTORS


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.