Skip to content

Commit f24deab

Browse files
committed
add bash script to build documentation
1 parent 9757c8c commit f24deab

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

package/esp8266-arudino-doc.bash

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash
2+
3+
#
4+
# @file esp8266-arudino-doc.bash
5+
# @author Ivan Grokhotkov (https://github.com/igrr)
6+
# @author Pascal Gollor (https://github.com/pgollor)
7+
#
8+
#
9+
# This script build the documentation for a specific Arduino ESP8266 release version.
10+
#
11+
# Packages needed by this script:
12+
# * linux commands: ln, cp, mkdir, rm, wget
13+
# * git
14+
# * jekyll
15+
#
16+
# ruby libraries:
17+
# * redcarpet
18+
# * rb-pygments
19+
#
20+
# gem install [lib]
21+
#
22+
23+
24+
# some variable definitions
25+
arduinoESP_src=$PWD"/../"
26+
version="$(git --work-tree=$arduinoESP_src describe --tags --always)"
27+
release_date=$(date "+%b_%d,_%Y") # format for badge link
28+
build_date=$(date "+%b %d, %Y")
29+
destinaton_path="/tmp/doc"
30+
doc_template_url="https://github.com/pgollor/esp8266-arduino-docs.git"
31+
url="http://pgollor.github.io/Arduino"
32+
33+
# control output
34+
echo "Arduino ESP8266 source dir: "$arduinoESP_src
35+
echo " version: "$version
36+
echo " release date: "$release_date
37+
echo " build date: "$build_date
38+
echo " put documentation into: "$destinaton_path
39+
echo "documentatino template url: "$doc_template_url
40+
echo " url: "$url
41+
42+
# continue?
43+
read -e -p "Dou you wish to continue (y/n)? " -n 1 -i "y" decision
44+
if echo "$decision" | grep -iq "^y" ;then
45+
echo "okay"
46+
else
47+
echo "bye bye"
48+
exit
49+
fi
50+
51+
52+
# delete old doc dir
53+
rm -fR $destinaton_path
54+
55+
# create destination directories
56+
mkdir -p $destinaton_path/src
57+
mkdir -p $destinaton_path/$version
58+
59+
# copy doc files to destination soruce dir
60+
cp -R $arduinoESP_src/doc/* $destinaton_path/src
61+
62+
# download doc template
63+
git clone $doc_template_url $destinaton_path/build
64+
65+
66+
#cur_dir=$PWD
67+
#cd $destinaton_path/build
68+
pushd $destinaton_path/build
69+
70+
# link documentation source
71+
ln -s ../src doc
72+
73+
# link documentation destination
74+
ln -s ../$version _site
75+
76+
# add subtitle and basurl
77+
echo "url: \"$url\"" > _config_local.yml
78+
echo "subtitle: \"ver. $version, built on $build_date\"" >> _config_local.yml
79+
echo "baseurl: /Arduino/versions/$version" >> _config_local.yml
80+
81+
# build with jekyll
82+
jekyll build --config _config.yml,_config_local.yml
83+
84+
popd
85+
#cd $cur_dir
86+
87+
88+
# grab badge
89+
wget -q -O $destinaton_path/$version/badge.svg "https://img.shields.io/badge/updated-$release_date-blue.svg"
90+

0 commit comments

Comments
 (0)