geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [1/2] geode-site git commit: GEODE-2507 Add gradle tasks for compile and view
Date Fri, 24 Feb 2017 23:56:30 GMT
Repository: geode-site
Updated Branches:
  refs/heads/master 1e603d7ad -> 1b85823bd


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


Project: http://git-wip-us.apache.org/repos/asf/geode-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-site/commit/50c6a513
Tree: http://git-wip-us.apache.org/repos/asf/geode-site/tree/50c6a513
Diff: http://git-wip-us.apache.org/repos/asf/geode-site/diff/50c6a513

Branch: refs/heads/master
Commit: 50c6a513d8d4da405b74460f2060b226cf6dd9cf
Parents: 1e603d7
Author: Anthony Baker <abaker@apache.org>
Authored: Fri Feb 24 06:59:07 2017 -0800
Committer: Anthony Baker <abaker@apache.org>
Committed: Fri Feb 24 15:52:58 2017 -0800

----------------------------------------------------------------------
 .gitignore         |   1 -
 README.md          |  55 +++++++++++++++++++++++
 build.gradle       |  45 +++++++++++++++++--
 website/README.md  | 116 ------------------------------------------------
 website/build.sh   |  18 --------
 website/nanoc.yaml |   4 +-
 website/run.sh     |  18 --------
 7 files changed, 99 insertions(+), 158 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index f554eff..18389a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
 .gradle/
 /build
-/content/*

http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index b5820d8..8f19334 100644
--- a/README.md
+++ b/README.md
@@ -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).

http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index acca3ee..a38a6b5 100644
--- a/build.gradle
+++ b/build.gradle
@@ -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/**'
   ]
 }

http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/website/README.md
----------------------------------------------------------------------
diff --git a/website/README.md b/website/README.md
deleted file mode 100644
index f67709b..0000000
--- a/website/README.md
+++ /dev/null
@@ -1,116 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-     http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-# Apache Geode Website
-
-This directory contains the source files for the project website. 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 `${geode-project-dir}/geode-site/website/content`.
-
-Generated files for the website are in `${geode-project-dir}/geode-site/content`.
-
-**NOTE:** To make changes to the [Apache Geode User Guide](http://geode.apache.org/docs/),
which is published to the website:
-
-- See `${geode-project-dir}/geode-docs/CONTRIBUTE.md` for information about contributing
to the documentation source files.
-- See `${geode-project-dir}/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-20 minute delay.
-
-## Prerequisites
-
-To generate the site locally, you need Ruby, Python, Pandoc and a couple of Ruby Gems.
-
-Install Pandoc (Haskell-based markup format converter):
-
-    http://johnmacfarlane.net/pandoc/installing.html
-
-Install Pygments (Python-based syntax coloring library):
-
-    $ sudo easy_install Pygments
-
-Install Nanoc and other Ruby Gems needed:
-
-    $ sudo gem install nanoc -v 4.2.0
-    $ sudo gem install pygments.rb htmlentities pandoc-ruby nokogiri rack mime-types adsf
-
-## How to change/update the website
-
-### 1. Find and edit the source files you need to change
-
-Source files for the website are in
-``${geode-project-dir}/geode-site/website/content``.
-When changing the actual content of the site, find the Markdown files that you
-need to edit under the `${geode-project-dir}/geode-site/website/content/`
-directory 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 
-within the ``${geode-project-dir}/geode-site/website/content`` directory.
-
-**NOTE:** The [Apache Geode User Guide](http://geode.apache.org/docs/guide/About_Geode.html)
source files are in `${geode-project-dir}/geode-docs/`. See `${geode-project-dir}/geode-docs/CONTRIBUTE.md`
for more information.
-
-### 2. Locally generate the site and test your changes
-
-Run the nanoc compiler to generate the site.
-Nanoc is configured by the
-``${geode-project-dir}/geode-site/website/nanoc.yaml``
-file to place the locally built website into the
-``${geode-project-dir}/geode-site/content`` directory.
-With a cwd of ``${geode-project-dir}/geode-site/website``:
-
-    $ nanoc compile
-Run ``git status`` and you should see your changes plus any updated files
-under the ``${geode-project-dir}/content`` directory.
-
-To view your changes locally, use the view command to start a local web server. Check the
website at [http://0.0.0.0:3000](http://0.0.0.0:3000)
-
-    $ nanoc view
-
-To make further changes, stop the web server, edit files, recompile, and view again.
-
-### 3. Publish your changes to the site    
-
-Once you are happy with your changes, commit them to the __develop__ branch.
-The changes also need to be propagated to the __asf-site__ branch.
-However, the file structure of the __asf-site__ branch is unusual, so a
-git merge will not do the right thing.
-
-The compiled ``${geode-project-dir}/geode-site/content`` directory 
-from the __develop__ branch will need to be placed at the 
-top level, ``${geode-project-dir}``, of the __asf-site__ branch.
-Here is one way to accomplish this:
-
-1. On the __develop__ branch
-
-        $ cd geode-site/website
-        $ nanoc compile
-        $ cd ../content
-        $ tar cvf new-website-content.tar .
-        $ mv new-website-content.tar ~/Desktop/
-
-2. Expand the TAR file at the top level of the __asf-site__ branch. Set your working directory
to ${geode-project-dir}, checkout the __asf-site__ branch, and run a `git clean -xdf` command
before unpacking your tar file:
-
-        $ git checkout asf-site
-        $ git clean -xdf
-        $ tar xvf ~/Desktop/new-website-content.tar
-
-3. Commit and push 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).

http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/website/build.sh
----------------------------------------------------------------------
diff --git a/website/build.sh b/website/build.sh
deleted file mode 100755
index 00a9ed0..0000000
--- a/website/build.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-nanoc compile

http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/website/nanoc.yaml
----------------------------------------------------------------------
diff --git a/website/nanoc.yaml b/website/nanoc.yaml
index 5fcc351..49f4da5 100644
--- a/website/nanoc.yaml
+++ b/website/nanoc.yaml
@@ -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

http://git-wip-us.apache.org/repos/asf/geode-site/blob/50c6a513/website/run.sh
----------------------------------------------------------------------
diff --git a/website/run.sh b/website/run.sh
deleted file mode 100755
index cecf19e..0000000
--- a/website/run.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-nanoc autocompile


Mime
View raw message