File: push-javadoc.sh

package info (click to toggle)
libfailsafe-java 3.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,416 kB
  • sloc: java: 11,566; xml: 459; sh: 53; makefile: 2
file content (67 lines) | stat: -rwxr-xr-x 1,662 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# run from top level dir

ORG=failsafe-lib
REPO=failsafe.dev

pwd=`pwd`

build () {
  echo "Building Javadocs for $1"
  cd $pwd
  if [ "$1" != "core" ]; then
    cd modules
  fi
  cd $1
  mvn javadoc:javadoc -Djv=$apiVersion
  rm -rf target/docs
  git clone git@github.com:$ORG/$REPO.git target/docs
  cd target/docs
  git rm -rf javadoc/$1
  mkdir -p javadoc/$1
  mv -v ../site/apidocs/* javadoc/$1

  patchFavIcon "javadoc" "../assets/images/favicon.png"
  commit && echo "Published Javadocs for $1"
}

patchFavIcon () {
  echo "Patching favicons"
  for f in $1/*.html ; do
    if [ -f "$f" ]; then     # if no .html files exist, f is literal "*.html"
      tmpfile=`mktemp patch_favicon_XXXXX`
      # This creates tmpfile, with the same permissions as $f.
      # The next command will overwrite it but preserve the permissions.
      # Hat tip to http://superuser.com/questions/170226/standard-way-to-duplicate-a-files-permissions for this trick.
      \cp -p $f $tmpfile
      sed -e " s%<head>\$%<head><link rel=\"icon\" href=\"$2\" type=\"image/png\"/>%" $f > $tmpfile
      DIFF=$(diff $f $tmpfile) 
      if [ "$DIFF" != "" ] 
      then
          echo "$f modified with favicon"
      fi
      mv -f $tmpfile $f
    fi;
  done ;
  for d in $1/* ; do
    if [ -d $d ]; then echo "descending to "$d ; patchFavIcon $d ../$2 ; fi ;
  done
}

commit() {
  echo "Committing javadocs"
  git add -A -f javadoc
  git commit -m "Updated JavaDocs"
  git push -fq > /dev/null
}

# Install parent and core
echo "Installing parent and core artifacts"
mvn install -N
cd core
mvn install -DskipTests=true
cd ../

build "core"
build "okhttp"
build "retrofit"