Skip to content
Permalink
Browse files
GEODE-2507 Add gradle tasks for compile and view
Add gradle tasks to make it really simple to compile and view
the website. The gradle task relies on a docker container,
apachegeode/geode-site-build that has the build chain preinstalled.

There's also a preliminary cut at improvements for publishing the
site content.

This closes #1
  • Loading branch information
metatype committed Feb 24, 2017
1 parent 1e603d7 commit 50c6a513d8d4da405b74460f2060b226cf6dd9cf
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 158 deletions.
@@ -1,3 +1,2 @@
.gradle/
/build
/content/*
@@ -20,3 +20,58 @@ limitations under the License.
[![Build Status](https://travis-ci.org/apache/geode-site.svg?branch=master)](https://travis-ci.org/apache/geode-site) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

# Apache Geode Site

This directory contains the source files for the project [website](https://geode.apache.org). Website content is written in [Markdown](https://help.github.com/articles/markdown-basics) and the site files are generated from that source by a tool called [Pandoc](http://johnmacfarlane.net/pandoc).

Source files for the website are in `website/content`. Generated files for the website are in `build/content`.

**NOTE:** To make changes to the [Apache Geode User Guide](http://geode.apache.org/docs/), which is published to the website:

- Review [CONTRIBUTING](https://github.com/apache/geode/blob/develop/geode-docs/CONTRIBUTE.md) for information about contributing to the documentation source files.
- Follow the [README](https://github.com/apache/geode/blob/develop/geode-book/README.md) for information about building a local version of the guide and adding it to the website.

The website is updated by a "sync" tool that monitors the __asf-site__ branch
of our Git repo, so after making changes you must place your updated source
and generated files on the __asf-site__ branch and push.
The content will be published to the
[Geode website](http://geode.apache.org) after a 5-10 minute delay.

## Prerequisites

To generate the site locally, you need to install java and docker.

## How to change/update the website

### 1. Find and edit the source files you need to change

Source files for the website are in ``website/content``. When changing the content of the site, find the Markdown files that you
need to edit and make your change. If you need to change the layout or styling of the site, then you will probably need to change
an HTML, JS or CSS file.

### 2. Locally generate the site and test your changes

To generate the site content, run the `nanoc` compiler:

$ ./gradlew compile

To view the generated site, run:

$ ./gradlew view

and point your browser at `http://localhost:3000`. To make further changes, stop the build, edit files, recompile, and view again.

### 3. Publish your changes to the site

Once you are happy with your changes, commit them to the __master__ branch.
The changes also need to be propagated to the __asf-site__ branch. Run the
gradle command

$ ./gradlew publish

to checkout the __asf-site__ branch and copy the website files. You will
need to manually commit and push your changes on the __asf-site__ branch.

The site should update in 5-10 minutes. If it does not,
[file a JIRA against the INFRA project](https://issues.apache.org/jira/browse/INFRA)
or ask for advice on the Infrastructure project's HipChat room
[#asfinfra](https://www.hipchat.com/g4P84gemn).
@@ -16,10 +16,50 @@
*/

plugins {
id "org.nosphere.apache.rat" version "0.3.0"
id 'org.nosphere.apache.rat' version '0.3.0'
id 'org.ajoberstar.grgit' version '1.6.0'
}

apply plugin: "org.nosphere.apache.rat"
apply plugin: 'org.ajoberstar.grgit'

task clean << {
delete buildDir
}

def dockerCmd = "docker run -v '${projectDir}':/geode-site -p 3000:3000 -w /geode-site/website apachegeode/geode-site-build "

task compile(type:Exec, dependsOn: rat) {
inputs.dir "${projectDir}/website"
outputs.dir "${buildDir}/content"
executable 'bash'
args "-c", dockerCmd + "nanoc compile"
}

task view(type:Exec, dependsOn: compile) {
executable 'bash'
args "-c", dockerCmd + "nanoc view"
}

task publish(dependsOn: compile) {
doLast {
def branch = grgit.branch.current.name
if (branch != 'master') {
throw new GradleException("Cannot publish from branch ${branch}, only from master")
}

def status = grgit.branch.status(name: 'master')
if (status.aheadCount != 0) {
throw new GradleException("Cannot publish with $status.aheadCount unpushed changes")
}

grgit.checkout(branch: 'asf-site')
grgit.pull()
copy {
from "${buildDir}/content"
into projectDir
}
}
}

rat {
xmlOutput = false
@@ -60,6 +100,5 @@ rat {
'website/utilities/markers.txt',
'website/tmp/**',
'website/layouts/**',
'content/**'
]
}

This file was deleted.

This file was deleted.

@@ -23,7 +23,7 @@ text_extensions: [ 'coffee', 'css', 'erb', 'haml', 'handlebars', 'hb', 'htm', 'h
# The path to the directory where all generated files will be written to. This
# can be an absolute path starting with a slash, but it can also be path
# relative to the site directory.
output_dir: ../content
output_dir: ../build/content

# A list of index filenames, i.e. names of files that will be served by a web
# server when a directory is requested. Usually, index files are named
@@ -34,7 +34,7 @@ index_filenames: [ 'index.html' ]
# Whether or not to generate a diff of the compiled content when compiling a
# site. The diff will contain the differences between the compiled content
# before and after the last site compilation.
enable_output_diff: true
enable_output_diff: false

prune:
# Whether to automatically remove files not managed by nanoc from the output

This file was deleted.

0 comments on commit 50c6a51

Please sign in to comment.