From f24deab2b58227096f657f3132ddb565ae945781 Mon Sep 17 00:00:00 2001 From: Pascal Gollor Date: Sun, 1 Nov 2015 19:54:07 +0100 Subject: [PATCH 1/3] add bash script to build documentation --- package/esp8266-arudino-doc.bash | 90 ++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 package/esp8266-arudino-doc.bash diff --git a/package/esp8266-arudino-doc.bash b/package/esp8266-arudino-doc.bash new file mode 100755 index 000000000..28bf90b68 --- /dev/null +++ b/package/esp8266-arudino-doc.bash @@ -0,0 +1,90 @@ +#!/bin/bash + +# +# @file esp8266-arudino-doc.bash +# @author Ivan Grokhotkov (https://github.com/igrr) +# @author Pascal Gollor (https://github.com/pgollor) +# +# +# This script build the documentation for a specific Arduino ESP8266 release version. +# +# Packages needed by this script: +# * linux commands: ln, cp, mkdir, rm, wget +# * git +# * jekyll +# +# ruby libraries: +# * redcarpet +# * rb-pygments +# +# gem install [lib] +# + + +# some variable definitions +arduinoESP_src=$PWD"/../" +version="$(git --work-tree=$arduinoESP_src describe --tags --always)" +release_date=$(date "+%b_%d,_%Y") # format for badge link +build_date=$(date "+%b %d, %Y") +destinaton_path="/tmp/doc" +doc_template_url="https://github.com/pgollor/esp8266-arduino-docs.git" +url="http://pgollor.github.io/Arduino" + +# control output +echo "Arduino ESP8266 source dir: "$arduinoESP_src +echo " version: "$version +echo " release date: "$release_date +echo " build date: "$build_date +echo " put documentation into: "$destinaton_path +echo "documentatino template url: "$doc_template_url +echo " url: "$url + +# continue? +read -e -p "Dou you wish to continue (y/n)? " -n 1 -i "y" decision +if echo "$decision" | grep -iq "^y" ;then + echo "okay" +else + echo "bye bye" + exit +fi + + +# delete old doc dir +rm -fR $destinaton_path + +# create destination directories +mkdir -p $destinaton_path/src +mkdir -p $destinaton_path/$version + +# copy doc files to destination soruce dir +cp -R $arduinoESP_src/doc/* $destinaton_path/src + +# download doc template +git clone $doc_template_url $destinaton_path/build + + +#cur_dir=$PWD +#cd $destinaton_path/build +pushd $destinaton_path/build + +# link documentation source +ln -s ../src doc + +# link documentation destination +ln -s ../$version _site + +# add subtitle and basurl +echo "url: \"$url\"" > _config_local.yml +echo "subtitle: \"ver. $version, built on $build_date\"" >> _config_local.yml +echo "baseurl: /Arduino/versions/$version" >> _config_local.yml + +# build with jekyll +jekyll build --config _config.yml,_config_local.yml + +popd +#cd $cur_dir + + +# grab badge +wget -q -O $destinaton_path/$version/badge.svg "https://img.shields.io/badge/updated-$release_date-blue.svg" + From e88ea3cde7e742f77f95f6596039be2bc39714f5 Mon Sep 17 00:00:00 2001 From: Pascal Gollor Date: Sun, 1 Nov 2015 22:48:11 +0100 Subject: [PATCH 2/3] read old versions --- package/esp8266-arudino-doc.bash | 49 +++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/package/esp8266-arudino-doc.bash b/package/esp8266-arudino-doc.bash index 28bf90b68..5c5de9e49 100755 --- a/package/esp8266-arudino-doc.bash +++ b/package/esp8266-arudino-doc.bash @@ -22,11 +22,12 @@ # some variable definitions -arduinoESP_src=$PWD"/../" +tmp_path=$1 +arduinoESP_src="$tmp_path/arduino" version="$(git --work-tree=$arduinoESP_src describe --tags --always)" release_date=$(date "+%b_%d,_%Y") # format for badge link build_date=$(date "+%b %d, %Y") -destinaton_path="/tmp/doc" +destination_path="$tmp_path/doc" doc_template_url="https://github.com/pgollor/esp8266-arduino-docs.git" url="http://pgollor.github.io/Arduino" @@ -35,7 +36,7 @@ echo "Arduino ESP8266 source dir: "$arduinoESP_src echo " version: "$version echo " release date: "$release_date echo " build date: "$build_date -echo " put documentation into: "$destinaton_path +echo " put documentation into: "$destination_path echo "documentatino template url: "$doc_template_url echo " url: "$url @@ -50,22 +51,45 @@ fi # delete old doc dir -rm -fR $destinaton_path +rm -fR $destination_path # create destination directories -mkdir -p $destinaton_path/src -mkdir -p $destinaton_path/$version +mkdir -p $destination_path/src +mkdir -p $destination_path/$version # copy doc files to destination soruce dir -cp -R $arduinoESP_src/doc/* $destinaton_path/src +cp -R $arduinoESP_src/doc/* $destination_path/src # download doc template -git clone $doc_template_url $destinaton_path/build +git clone $doc_template_url $destination_path/build + +# create versions.html file + +# ... read verions +pushd $arduinoESP_src +old_versions=$(git ls-tree -d --name-only remotes/origin/gh-pages versions/ | sed -e 's/versions\///g') +popd + +echo -e "\nREAD old versions:" + +found_current_version="false" +case "${old_versions[@]}" in *"$version"*) found_current_version="true" ;; esac + +if [ "$found_current_version" = "false" ]; then + old_versions=$version" "$old_versions +fi + +# ... fill versions.html +for VER in $old_versions +do + echo $VER + echo "
  • $VER
  • " >> $destination_path/build/_includes/versions.html +done +echo "" -#cur_dir=$PWD -#cd $destinaton_path/build -pushd $destinaton_path/build +# into build dir +pushd $destination_path/build # link documentation source ln -s ../src doc @@ -82,9 +106,8 @@ echo "baseurl: /Arduino/versions/$version" >> _config_local.yml jekyll build --config _config.yml,_config_local.yml popd -#cd $cur_dir # grab badge -wget -q -O $destinaton_path/$version/badge.svg "https://img.shields.io/badge/updated-$release_date-blue.svg" +wget -q -O $destination_path/$version/badge.svg "https://img.shields.io/badge/updated-$release_date-blue.svg" From d57315b27d95cc2823260f5c92efeaf31620409c Mon Sep 17 00:00:00 2001 From: Pascal Gollor Date: Mon, 2 Nov 2015 10:21:43 +0100 Subject: [PATCH 3/3] change repository links --- package/esp8266-arudino-doc.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/esp8266-arudino-doc.bash b/package/esp8266-arudino-doc.bash index 5c5de9e49..474cf66e9 100755 --- a/package/esp8266-arudino-doc.bash +++ b/package/esp8266-arudino-doc.bash @@ -28,8 +28,8 @@ version="$(git --work-tree=$arduinoESP_src describe --tags --always)" release_date=$(date "+%b_%d,_%Y") # format for badge link build_date=$(date "+%b %d, %Y") destination_path="$tmp_path/doc" -doc_template_url="https://github.com/pgollor/esp8266-arduino-docs.git" -url="http://pgollor.github.io/Arduino" +doc_template_url="https://github.com/igrr/esp8266-arduino-docs.git" +url="http://esp8266.github.io/Arduino" # control output echo "Arduino ESP8266 source dir: "$arduinoESP_src