Determine build environment through command line parameter
the build was successful

This commit is contained in:
2019-05-28 13:05:11 +02:00
parent c0d73263af
commit 7026808184
6 changed files with 53 additions and 51 deletions
+10
View File
@@ -58,3 +58,13 @@ OPTIONS
information will be written to stdout. The directory will also be used
to store some temporary files, which would otherwise be set up in the
system wide temp directory.
--build-env "selection"
Indicate the current build environment. "selection" can be one of:
* "fsfe.org": building https://fsfe.org on the production server
* "test.fsfe.org": building https://test.fsfe.org on the production server
* "development" (default): local development build
In a local development build, code to dynamically compile the less files into
CSS will be included in the HTML output, while in the other environments, the
precompiles fsfe.min.css (or valentine.min.css) will be referenced from the
generated web pages.
+3
View File
@@ -23,6 +23,9 @@ if [ -z "$inc_arguments" ]; then
-d|--dest|--destination)
[ "$#" -gt 0 ] && shift 1 && target="$1"
;;
--build-env)
[ "$#" -gt 0 ] && shift 1 && build_env="$1"
;;
-h|--help)
command="help"
;;
+1 -1
View File
@@ -17,7 +17,7 @@ process_file(){
set -o pipefail
build_xmlstream "$shortname" "$lang" \
| xsltproc "$processor" - \
| xsltproc --stringparam "build-env" "${build_env:-development}" "$processor" - \
| sed -r ':X; N; $!bX;
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href="(https?:)?//'"$domain"'/([^"]*)";<\1\2 href="/\4";gI
s;<[\r\n\t ]*(a|link)([\r\n\t ][^>]*)?[\r\n\t ]href='\''(https?:)?//'"$domain"'/([^'\'']*)'\'';<\1\2 href='\''/\4'\'';gI
+1 -3
View File
@@ -2,13 +2,11 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../config.xsl" />
<xsl:template name="body_scripts">
<script src="{$urlprefix}/scripts/bootstrap-3.0.3.custom.js"></script>
<script src="{$urlprefix}/scripts/placeholder.js"></script>
<xsl:if test="$css-mode = 'browser'">
<xsl:if test="$build-env = 'development'">
<xsl:element name="script">
<xsl:attribute name="src"><xsl:value-of select="$urlprefix"/>/scripts/less.min.js</xsl:attribute>
</xsl:element>
+38 -32
View File
@@ -2,8 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="../../config.xsl" />
<xsl:variable name="mode">
<!-- here you can set the mode to switch between normal and IloveFS style -->
<xsl:value-of select="'normal'" /> <!-- can be either 'normal' or 'valentine' -->
@@ -34,37 +32,45 @@
</xsl:element>
<xsl:choose>
<xsl:when test="$css-mode = 'browser' and $mode = 'normal'">
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet/less</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.less</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
<xsl:when test="$build-env = 'development'">
<xsl:choose>
<xsl:when test="$mode = 'valentine'">
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet/less</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/valentine.less</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise><!-- not valentine -->
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet/less</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.less</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$css-mode = 'browser' and $mode = 'valentine'">
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet/less</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/valentine.less</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:when test="$css-mode = 'compiled' and $mode = 'valentine'">
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/valentine.min.css</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.min.css</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
<xsl:otherwise><!-- not development -->
<xsl:choose>
<xsl:when test="$mode = 'valentine'">
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/valentine.min.css</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise><!-- not valentine -->
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl:attribute>
<xsl:attribute name="media">all</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.min.css</xsl:attribute>
<xsl:attribute name="type">text/css</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
"css-mode" controls the type of style processing.
It can have the following values:
- "browser" for local development.
Styles are compiled live in the browser using the JavaScript less compiler.
- "compiled" The website includes the "fsfe.min.css" file
that has to be compiled by the build script.
For fsfe.org itself the value is replaced server side before build.
-->
<xsl:variable name="css-mode" select="'browser'" />
</xsl:stylesheet>