Reprise build.sh Commerce Kickstart
authorFelip Manyer i Ballester <git@res-telae.cat>
Fri, 13 Dec 2013 13:14:21 +0000 (14:14 +0100)
committerFelip Manyer i Ballester <git@res-telae.cat>
Fri, 13 Dec 2013 13:14:21 +0000 (14:14 +0100)
build.sh [deleted file]
scripts/build.sh [new file with mode: 0755]

diff --git a/build.sh b/build.sh
deleted file mode 100755 (executable)
index 78f41b0..0000000
--- a/build.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-PREFIX="fonamental"
-PLATFORM=$PREFIX
-PROFILENAME=$PREFIX
-THEMENAME="${PREFIX}_theme"
-MAKEFILE="build-${PREFIX}.make"
-TRANSLATIONS="fr"
-THEMEDIR="$PLATFORM/profiles/$PROFILENAME/themes/custom/$THEMENAME"
-
-# Construction de la plateforme
-drush make --translations=$TRANSLATIONS --working-copy $MAKEFILE $PLATFORM
-mv $PLATFORM/profiles/translations $PLATFORM/profiles/$PROFILENAME
-
-# Génération des CSS
-cd $THEMEDIR
-compass clean
-compass compile
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755 (executable)
index 0000000..4356fba
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -xe
+
+PREFIX=fonamental
+BUILD_PREFIX=build
+TRANSLATIONS="fr"
+PROFILE_NAME=$PREFIX
+DESTINATION=${BUILD_PREFIX}/$PREFIX
+TEMP_NOCORE=${BUILD_PREFIX}/tmp_nocore
+TEMP_BUILD=${BUILD_PREFIX}/tmp_build
+THEME_NAME=${PREFIX}_theme
+THEME_DIR=$DESTINATION/profiles/$PROFILE_NAME/themes/custom/$THEME_NAME
+
+if which drush6; then
+    DRUSH=drush6
+else
+    DRUSH=drush
+fi
+
+if [ ! -f drupal-org.make ]; then
+  echo "[error] Run this script from the distribution base path."
+  exit 1
+fi
+
+# Clean up previous build
+rm -rf $BUILD_PREFIX
+mkdir $BUILD_PREFIX
+
+# Build the profile.
+$DRUSH make --translations=$TRANSLATIONS --no-core --contrib-destination drupal-org.make $TEMP_NOCORE
+
+# Build the distribution and copy the profile in place.
+$DRUSH make drupal-org-core.make $TEMP_BUILD
+
+# Assemble platform
+cp -r $TEMP_NOCORE $TEMP_BUILD/profiles/$PROFILE_NAME
+rm -rf $TEMP_NOCORE
+cp -r `ls -A | grep -v $BUILD_PREFIX` $TEMP_BUILD/profiles/$PROFILE_NAME
+mv $TEMP_BUILD $DESTINATION
+
+# Compile SASS stylesheets
+(cd $THEME_DIR; compass compile)
+
+echo "done"