alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Play Framework/Scala example source code file (deployApiDocs)

This example Play Framework source code file (deployApiDocs) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Play Framework (and Scala) source code examples by using tags.

All credit for the original source code belongs to Play Framework; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Play Framework tags/keywords

api, branch, copyright, if, inc, no, playversion, tag, will, you

The deployApiDocs Play Framework example source code

#! /bin/bash

# Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>

# Usage: deployApiDocs <branch> [ <tag> ]
#
# If you have checked out a tag, then you must supply the branch to deploy the docs to.
#
# If you want the repo tagged, then supply a tag argument

set -e

BRANCH=$1
TAG=$2

if [ -z "$BRANCH" ]
then
    echo You must specify a branch
fi 

PLAYVERSION=""
if [ -n "$TAG" ]
then
    echo Will tag version $TAG
    PLAYVERSION=-Dplay.version=$TAG
fi

# build the docs
./build $PLAYVERSION -Dgit.branch=$BRANCH api-docs

mkdir -p target 
cd target
# clone the git repo if it's not already there
if [ -d play-generated-docs ]
then
    cd play-generated-docs
    git fetch
else
    git clone git@github.com:playframework/play-generated-docs.git
    cd play-generated-docs
fi

# Create the branch if it doesn't already exist
if git branch -a | grep -q $BRANCH
then
    git checkout $BRANCH
    git merge origin/$BRANCH
else
    git checkout -b $BRANCH
fi

rm -r *
mv ../../src/play-docs/target/scala-2.10/apidocs api
if ! git diff -w --quiet
then
    git add --all
    # Commit changes
    echo "Docs have changed, committing and pushing..."
    if [ -z "$TAG" ]
    then
        git commit -m "Api docs changed"
    else
        git commit -m "Update for $TAG"
    fi
    git push origin $BRANCH
else
    echo "No changes in docs"
fi

if [ -n "$TAG" ]
then
    echo "Tagging docs..."
    git tag -a -m $TAG $TAG
    git push --tags
fi


Other Play Framework source code examples

Here is a short list of links related to this Play Framework deployApiDocs source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.