Author: dr Date: Tue Nov 27 16:10:16 2007 New Revision: 6834 Log: - Fixed building downloadable docs.
Modified: scripts/build-downloadable-docs.sh Modified: scripts/build-downloadable-docs.sh ============================================================================== --- scripts/build-downloadable-docs.sh [iso-8859-1] (original) +++ scripts/build-downloadable-docs.sh [iso-8859-1] Tue Nov 27 16:10:16 2007 @@ -1,8 +1,15 @@ #!/bin/sh +if test $# -lt 1; then + echo "Usage: scripts/build-docs.sh <version> ..." + exit 0; +fi + +release=$1 + BASE_OUTPUT_DIR=/home/httpd/html/components -DOC_OUTPUT_DIR=${BASE_OUTPUT_DIR}/phpdoc_gen/ezcomponents -HTTP_ROOT_DIR=/components/phpdoc_gen/ezcomponents +DOC_OUTPUT_DIR=${BASE_OUTPUT_DIR}/phpdoc_gen/ezcomponents-$release +HTTP_ROOT_DIR=/components/phpdoc_gen/ezcomponents-$release wd=`pwd` @@ -15,23 +22,6 @@ cp docs/overview.tpl ${DOC_OUTPUT_DIR} || exit 12 echo "Preparing top left_menu_comp.tpl" -cat > ${DOC_OUTPUT_DIR}/left_menu_comp.tpl << EOF -<div class="attribute-heading"> -<h2 class="bullet">eZ Components</h2> -</div> - -<div class="boxcontent"> -<div id="quicklinks"> -{let \$indexDir = ezsys( 'indexdir' )} -<h2>Getting Started</h2> -<ul> -<li><a href="http://ez.no/community/articles/an_introduction_to_ez_components">Installation</a></li> -<li><a href="{concat(\$indexDir, '/components/view/latest/(file)/tutorials.html')}">Tutorials</a></li> -</ul> - -<h2>Versions</h2> -<ul> -EOF cat > ${DOC_OUTPUT_DIR}/left_menu_comp.html << EOF <div class="attribute-heading"> <h2 class="bullet">eZ Components</h2> @@ -41,24 +31,19 @@ <div id="quicklinks"> <h2>Getting Started</h2> <ul> -<li><a href="http://ez.no/community/articles/an_introduction_to_ez_components">Installation</a></li> -<li><a href="${HTTP_ROOT_DIR}/latest/tutorials.html">Tutorials</a></li> +<li><a href="http://ezcomponents.org/docs/install">Installation Guide</a></li> +<li><a href="${HTTP_ROOT_DIR}/tutorials.html">Tutorials</a></li> </ul> <h2>Versions</h2> <ul> EOF -for release in latest; do - -mkdir -p ${DOC_OUTPUT_DIR}/$release +mkdir -p ${DOC_OUTPUT_DIR} echo "Update main index file" -cat >> ${DOC_OUTPUT_DIR}/left_menu_comp.tpl << EOF -<li><a href="{concat(\$indexDir, '/components/view/$release/(file)/')}">eZ components $release</a></li> -EOF cat >> ${DOC_OUTPUT_DIR}/left_menu_comp.html << EOF -<li><a href="${HTTP_ROOT_DIR}/$release/">eZ Components $release</a></li> +<li><a href="${HTTP_ROOT_DIR}/">eZ Components $release</a></li> EOF echo "Writing config file for $release" @@ -70,7 +55,7 @@ cd /home/httpd || exit 2 cd ezcomponents || exit 4 -mkdir -p ${DOC_OUTPUT_DIR}/$release || exit 8 +mkdir -p ${DOC_OUTPUT_DIR} || exit 8 echo "Copying overview for $release" cp docs/overview_$release.tpl ${DOC_OUTPUT_DIR} @@ -80,34 +65,17 @@ ./scripts/setup-env.sh echo "Writing left_menu_comp_$release.tpl" -cat > ${DOC_OUTPUT_DIR}/left_menu_comp_$release.tpl << EOF +cat > ${DOC_OUTPUT_DIR}/left_menu_comp.html << EOF <div class="attribute-heading"> -<h2 class="bullet">eZ Components</h2> -</div> - -<div class="boxcontent"> -<div id="quicklinks"> -{let \$indexDir = ezsys( 'indexdir' )} -<h2>Getting Started</h2> -<ul> -<li><a href="http://ez.no/community/articles/an_introduction_to_ez_components">Installation</a></li> -<li><a href="{concat(\$indexDir, '/components/view/$release/(file)/tutorials.html')}">Tutorials</a></li> -</ul> - -<h2>Components</h2> -<ul> -EOF -cat > ${DOC_OUTPUT_DIR}/left_menu_comp_$release.html << EOF -<div class="attribute-heading"> -<h2 class="bullet">eZ Components</h2> +<h2 class="bullet">eZ Components $release</h2> </div> <div class="boxcontent"> <div id="quicklinks"> <h2>Getting Started</h2> <ul> -<li><a href="http://ez.no/community/articles/an_introduction_to_ez_components">Installation</a></li> -<li><a href="${HTTP_ROOT_DIR}/$release/tutorials.html">Tutorials</a></li> +<li><a href="http://ezcomponents.org/docs/install">Installation Guide</a></li> +<li><a href="${HTTP_ROOT_DIR}/tutorials.html">Tutorials</a></li> </ul> <h2>Components</h2> @@ -115,7 +83,7 @@ EOF -cat > ${DOC_OUTPUT_DIR}/$release/index.php << EOF +cat > ${DOC_OUTPUT_DIR}/index.php << EOF <?php include '../overview_$release.tpl'; ?> @@ -125,30 +93,30 @@ echo "Generating Tutorials for $release:" echo "* Tutorials overview page start" -cat >> ${DOC_OUTPUT_DIR}/$release/tutorials.tpl <<EOF +cat >> ${DOC_OUTPUT_DIR}/tutorials.tpl <<EOF <div class="attribute-heading"><h1>Tutorials</h1></div> <ul> EOF -cp ${DOC_OUTPUT_DIR}/$release/tutorials.tpl ${DOC_OUTPUT_DIR}/$release/tutorials.html +cp ${DOC_OUTPUT_DIR}/tutorials.tpl ${DOC_OUTPUT_DIR}/tutorials.html for i in $j; do comp=`echo $i | cut -d / -f 2` version=`echo "$i" | sed "s/\/$comp//" | sed "s/releases\///"` if test -f $i/docs/tutorial.txt; then echo "* $comp ($version)" - php scripts/render-tutorial.php -c $comp -t ${DOC_OUTPUT_DIR}/$release -v $version - - cat >> ${DOC_OUTPUT_DIR}/$release/tutorials.tpl << EOF -<li><a href="introduction_$comp.html')}">$comp</a></li> -EOF - cat >> ${DOC_OUTPUT_DIR}/$release/tutorials.html << EOF + php scripts/render-tutorial.php -c $comp -t ${DOC_OUTPUT_DIR} -v $version + + cp ${DOC_OUTPUT_DIR}/introduction_$comp.html /tmp/file4.html + php -r "echo preg_replace( '@/docs/api/(.*?)/@', '', file_get_contents( '/tmp/file4.html' ) ); " > ${DOC_OUTPUT_DIR}/introduction_$comp.html + + cat >> ${DOC_OUTPUT_DIR}/tutorials.html << EOF <li><a href="introduction_$comp.html">$comp</a></li> EOF # Add changelog - php scripts/render-rst-file.php -v $release -c $comp -t "${DOC_OUTPUT_DIR}/$release" -f $i/ChangeLog -o "changelog_$comp.html" - php scripts/render-rst-file.php -v $release -c $comp -t "${DOC_OUTPUT_DIR}/$release" -f $i/CREDITS -o "credits_$comp.html" + php scripts/render-rst-file.php -v $release -c $comp -t "${DOC_OUTPUT_DIR}" -f $i/ChangeLog -o "changelog_$comp.html" + php scripts/render-rst-file.php -v $release -c $comp -t "${DOC_OUTPUT_DIR}" -f $i/CREDITS -o "credits_$comp.html" # Add extra docs for tutorials extra1="" @@ -157,8 +125,8 @@ output_name=`echo $t | cut -d / -f 5 | sed 's/.txt/.html/'`; if test $output_name != "tutorial.html"; then if test $output_name != "docs"; then - echo -n " - Rendering extra doc '$output_name' to $release/${comp}_${output_name}" - php scripts/render-rst-file.php -v $release -c $comp -t "${DOC_OUTPUT_DIR}/$release" -f $t + echo -n " - Rendering extra doc '$output_name' to ${comp}_${output_name}" + php scripts/render-rst-file.php -v $release -c $comp -t "${DOC_OUTPUT_DIR}" -f $t short_name=`echo $output_name | sed 's/.html//'` short_name=`php -r "echo ucfirst( '$short_name' );"` extra1="$extra1 <b>[ <a href='../${comp}_${output_name}'>$short_name</a> ]</b>" @@ -166,58 +134,44 @@ fi fi done + if test "$extra1" != ""; then - for w in ${DOC_OUTPUT_DIR}/$release/$comp/*.html; do + for w in ${DOC_OUTPUT_DIR}/$comp/*.html; do echo "- Postprocessing $w" - cp $w /tmp/file.html - php -r "echo str_replace( '<!-- EXTRA DOCS GO HERE! -->', \"$extra1\", file_get_contents( '/tmp/file.html' ) ); " > $w + cp $w /tmp/file2.html + php -r "echo preg_replace( '@/docs/api/(.*?)/@', '', file_get_contents( '/tmp/file2.html' ) ); " > /tmp/file3.html + php -r "echo str_replace( '<!-- EXTRA DOCS GO HERE! -->', \"$extra1\", file_get_contents( '/tmp/file3.html' ) ); " > $w done - for w in ${DOC_OUTPUT_DIR}/$release/${comp}_*.html ${DOC_OUTPUT_DIR}/$release/*_${comp}.html; do + for w in ${DOC_OUTPUT_DIR}/${comp}_*.html ${DOC_OUTPUT_DIR}/*_${comp}.html; do echo "- Postprocessing $w" - cp $w /tmp/file.html - php -r "echo str_replace( '<!-- EXTRA DOCS GO HERE! -->', \"$extra2\", file_get_contents( '/tmp/file.html' ) ); " > $w + cp $w /tmp/file2.html + php -r "echo preg_replace( '@/docs/api/(.*?)/@', '', file_get_contents( '/tmp/file2.html' ) ); " > /tmp/file3.html + php -r "echo str_replace( '<!-- EXTRA DOCS GO HERE! -->', \"$extra2\", file_get_contents( '/tmp/file3.html' ) ); " > $w done fi else - echo '<div class="attribute-heading"><h1>'$comp'</h1></div>' > ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html - echo '<b>[ <a href="introduction_'$comp'.html" class="menu">Tutorial</a> ]</b>' >> ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html - echo '<b>[ <a href="classtrees_'$comp'.html" class="menu">Class tree</a> ]</b>' >> ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html - echo '<b>[ <a href="elementindex_'$comp'.html" class="menu">Element index</a> ]</b>' >> ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html - echo '<b>[ <a href="changelog_'$comp'.html" class="menu">ChangeLog</a> ]</b>' >> ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html - echo '<b>[ <a href="credits_'$comp'.html" class="menu">Credits</a> ]</b>' >> ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html - echo "<h1>No introduction available for $comp</h1>" >> ${DOC_OUTPUT_DIR}/$release/introduction_$comp.html + echo '<div class="attribute-heading"><h1>'$comp'</h1></div>' > ${DOC_OUTPUT_DIR}/introduction_$comp.html + echo '<b>[ <a href="introduction_'$comp'.html" class="menu">Tutorial</a> ]</b>' >> ${DOC_OUTPUT_DIR}/introduction_$comp.html + echo '<b>[ <a href="classtrees_'$comp'.html" class="menu">Class tree</a> ]</b>' >> ${DOC_OUTPUT_DIR}/introduction_$comp.html + echo '<b>[ <a href="elementindex_'$comp'.html" class="menu">Element index</a> ]</b>' >> ${DOC_OUTPUT_DIR}/introduction_$comp.html + echo '<b>[ <a href="changelog_'$comp'.html" class="menu">ChangeLog</a> ]</b>' >> ${DOC_OUTPUT_DIR}/introduction_$comp.html + echo '<b>[ <a href="credits_'$comp'.html" class="menu">Credits</a> ]</b>' >> ${DOC_OUTPUT_DIR}/introduction_$comp.html + echo "<h1>No introduction available for $comp</h1>" >> ${DOC_OUTPUT_DIR}/introduction_$comp.html fi - cat >> ${DOC_OUTPUT_DIR}/left_menu_comp_$release.tpl << EOF -<li><a href="{concat(\$indexDir, '/components/view/$release/(file)/classtrees_$comp.html')}">$comp</a> ($version)</li> -EOF - cat >> ${DOC_OUTPUT_DIR}/left_menu_comp_$release.html << EOF -<li><a href="${HTTP_ROOT_DIR}/$release/classtrees_$comp.html">$comp</a> ($version)</li> + cat >> ${DOC_OUTPUT_DIR}/left_menu_comp.html << EOF +<li><a href="${HTTP_ROOT_DIR}/classtrees_$comp.html">$comp</a> ($version)</li> EOF done -cat >> ${DOC_OUTPUT_DIR}/left_menu_comp_$release.tpl << EOF +cat >> ${DOC_OUTPUT_DIR}/left_menu_comp.html << EOF </ul> <hr/> <ul> -<li><a href="{concat(\$indexDir, '/components/view/$release/(file)/allclassesindex.html')}">All Classes</a></li> -<li><a href="{concat(\$indexDir, '/components/view/$release/(file)/elementindex.html')}">All Elements</a></li> -</ul> -{/let} - -</div> -</div> -EOF - -cat >> ${DOC_OUTPUT_DIR}/left_menu_comp_$release.html << EOF -</ul> -<hr/> - -<ul> -<li><a href="${HTTP_ROOT_DIR}/$release/allclassesindex.html">All Classes</a></li> -<li><a href="${HTTP_ROOT_DIR}/$release/elementindex.html">All Elements</a></li> +<li><a href="${HTTP_ROOT_DIR}/allclassesindex.html">All Classes</a></li> +<li><a href="${HTTP_ROOT_DIR}/elementindex.html">All Elements</a></li> </ul> </div> @@ -226,27 +180,10 @@ echo "* Tutorials overview page end" -cat >> ${DOC_OUTPUT_DIR}/$release/tutorials.tpl << EOF -</ul> -EOF -cat >> ${DOC_OUTPUT_DIR}/$release/tutorials.html << EOF -</ul> -EOF - -done - -echo "Wrapping up index files" -cat >> ${DOC_OUTPUT_DIR}/left_menu_comp.tpl << EOF -</ul> -</div> -</div> -EOF - -cat >> ${DOC_OUTPUT_DIR}/left_menu_comp.html << EOF -</ul> -</div> -</div> -EOF +cat >> ${DOC_OUTPUT_DIR}/tutorials.html << EOF +</ul> +EOF + cat > ${DOC_OUTPUT_DIR}/index.php << EOF <?php @@ -255,10 +192,10 @@ EOF cd /tmp -wget -nH -m -p -np -k http://tequila/components/phpdoc_gen/ezcomponents/ -cd components/phpdoc_gen/ezcomponents +wget -nH -m -p -np -k http://tequila/components/phpdoc_gen/ezcomponents-$release/ +cd components/phpdoc_gen/ezcomponents-$release ln -s /home/httpd/html/components/design . cd .. -tar -chzf /tmp/ezcomponents-docs.tar.gz ezcomponents +tar -chzf /tmp/ezcomponents-$release-docs.tar.gz ezcomponents-$release cd ../.. rm -rf components -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components