Moved compression script to xCAT-UI.spec

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8945 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-03-01 15:09:46 +00:00
parent c6f5ccac96
commit 1e6eeb6d3e

View File

@ -29,6 +29,28 @@ Provides a browser-based interface for xCAT (Extreme Cloud Administration Toolki
%setup -q -n xCAT-UI
%build
# Minify Javascript files using Google Compiler
JAVA='/opt/ibm/java-ppc64-60/jre/bin/java'
COMPILER_JAR='/xcat2/build/tools/compiler.jar'
UI_JS="js/"
declare -a FILES
IFS='
'
# Find all Javascript files
FILES=(`find ${UI_JS} -name '*.js'`)
for i in ${FILES[*]}; do
# Ignore Javascripts that are already minified
if [[ ! $i =~ '.*\.min\.js$' ]]; then
`${JAVA} -jar ${COMPILER_JAR} --warning_level=QUIET --js=$i --js_output_file=$i.min`
# Remove old Javascript and replace it with minified version
rm -rf $i
mv $i.min $i
fi
done
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/ui