https://github.com/zigomir/middle_drive
Google Drive Middleman integration
https://github.com/zigomir/middle_drive
Last synced: about 1 year ago
JSON representation
Google Drive Middleman integration
- Host: GitHub
- URL: https://github.com/zigomir/middle_drive
- Owner: zigomir
- License: mit
- Created: 2013-08-11T03:01:38.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2014-09-16T03:33:08.000Z (over 11 years ago)
- Last Synced: 2025-04-05T04:39:00.203Z (about 1 year ago)
- Language: Ruby
- Size: 219 KB
- Stars: 6
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# MiddleDrive
## Quick start
```bash
gem install middleman
middleman init new_site
```
To `Gemfile` in `new_site` add `middle_drive`
```
gem 'middle_drive'
```
Then run
```bash
cd new_site
bundle
middle_drive init
```
## Manual install
```bash
gem install middle_drive
```
## Setup
### Middleman setup
```bash
middle_drive init
```
### Google drive setup conventions
- create a new collection in your google drive. Name it the same like in `middle_drive.yml`'s `site.collection` value.
- create google spreadsheet named `pages` inside this `site.collection`
- each tab in this spreadsheet represents a page
- value in first row and first column represents a template which will be used by middleman

- create google spreadsheet named `data_:language` inside `site.collection`
- each tab in this spreadsheet represents different list
- first data cell represents template and data type (template:data_type). Supported data types are `array`, `hash` and `list`.

- use protected ranges to prevent customer changing the structure of pages: https://support.google.com/drive/answer/63175
## Quick helpers
### Hash
```erb
<%= d(locals).title %>
<%= d(locals).content %>
<%= image_tag d(locals).image %>
```
### List
```erb
<% d(locals).each do |post| %>
<%= post.title %>
<%= post.content %>
<%= post.date %>
<% end %>
```
## Usage
```bash
middle_drive
```
This command will sync images and page information from your Google Drive collection which was set in
`middle_drive.yml` file.
```bash
middle_drive update
```
Will search for update spreadsheet inside collection. If first A1 column will include `please update` value it will
sync all other data and clear up update flag. This is useful for circular checking if there are new updates to be
fetched.
## TODO
- tests!
- when building from scratch it would be better to start building `pages.yml`, `data.yml`, `en.yml` files locally
and then run init to build structure on google drive
- http://tvaughan.github.io/middleman-deploy/ + https://github.com/javan/whenever to run middle_drive update