Skip to content
Snippets Groups Projects
Commit 52d11cb8 authored by Demian Katz's avatar Demian Katz
Browse files

Added phing configuration.

parent e64cb17a
No related merge requests found
build.xml 0 → 100644
<?xml version="1.0" encoding="UTF-8"?>
<project name="vufind2" basedir="." default="main">
<property name="tmp" value="/tmp" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="${project.basedir}" override="true" />
<property name="apacheconfdir" value="/etc/apache2/conf.d" />
<property name="apachectl" value="/etc/init.d/apache2" />
<property name="vufindurl" value="http://localhost/vufind" />
<property name="vufinddb" value="vufind_test" />
<property name="vufinddbuser" value="vufindtest" />
<property name="vufinddbpass" value="vufindtestpass" />
<property name="dbtype" value="mysql" /><!-- use pgsql for PostgreSQL -->
<property name="mysqlhost" value="localhost" />
<property name="mysqlrootuser" value="root" />
<property name="mysqlrootpass" value="password" />
<property name="pgsqlhost" value="localhost" />
<property name="pgsqlrootuser" value="postgres" />
<property name="version" value="2.0beta" />
<!-- Main Target -->
<target name="main" description="main target">
<!-- Create dirs -->
<mkdir dir="${builddir}/reports"/>
<mkdir dir="${builddir}/reports/coverage"/>
<!-- PHP API Documentation -->
<phpdoc title="API Documentation"
destdir="${builddir}/apidocs"
sourcecode="yes"
defaultpackagename="VuFind"
output="HTML:Smarty:PHP">
<fileset dir=".">
<include name="application/**/*.php" />
<include name="library/VF/**/*.php" />
</fileset>
</phpdoc>
<!-- PHP CodeSniffer -->
<exec command="phpcs --standard=PEAR --extensions=php --report=checkstyle ${srcdir}/application ${srcdir}/library/VF &gt; ${builddir}/reports/checkstyle.xml" escape="false" />
<!-- PHPUnit -->
<exec dir="${srcdir}/tests" command="phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/" outputProperty="PHPUNITOUTPUT" />
<echo message="${PHPUNITOUTPUT}" />
</target>
<!-- Install and Activate VuFind -->
<target name="startup" description="install and activate demo">
<!-- set up appropriate read/write permissions for Apache -->
<exec command="chmod -R a+w ${srcdir}/local/cache" />
<!-- activate Apache -->
<exec command="php ${srcdir}/install.php --use-defaults" />
<copy file="${srcdir}/local/httpd-vufind.conf" tofile="${apacheconfdir}/vufindtest" />
<exec command="${apachectl} restart" />
<!-- build and configure the requested database type -->
<if>
<equals arg1="${dbtype}" arg2="pgsql" />
<then>
<!-- build database -->
<exec command="sudo su -c &quot;psql -c \&quot;DROP DATABASE ${vufinddb};\&quot;&quot; ${pgsqlrootuser}" />
<exec command="sudo su -c &quot;psql -c \&quot;DROP USER ${vufinddbuser};\&quot;&quot; ${pgsqlrootuser}" />
<exec command="sudo su -c &quot;psql -c \&quot;CREATE DATABASE ${vufinddb};\&quot;&quot; ${pgsqlrootuser}" checkreturn="true" />
<exec command="sudo su -c &quot;psql -c \&quot;CREATE USER ${vufinddbuser} PASSWORD '${vufinddbpass}';\&quot;&quot; ${pgsqlrootuser}" checkreturn="true" />
<exec command="sudo su -c &quot;psql -c \&quot;GRANT ALL ON DATABASE ${vufinddb} TO ${vufinddbuser};\&quot;&quot; ${pgsqlrootuser}" checkreturn="true" />
<!--<exec command="sudo su -c &quot;psql -c \&quot;select 'grant SELECT,INSERT,UPDATE,DELETE on '||schemaname||'.'||tablename||' to ${vufinddbuser};' from pg_tables where schemaname in ('${vufinddb}') order by schemaname, tablename;\&quot;&quot; ${pgsqlrootuser}" checkreturn="true" />-->
<exec command="PGPASSWORD=${vufinddbpass} psql -U ${vufinddbuser} -f ${srcdir}/module/VuFind/sql/postgres.sql ${vufinddb}" checkreturn="true" />
<!-- configure VuFind -->
<exec command="sed -e &quot;s!mysql://root@localhost/vufind!pgsql://${vufinddbuser}:${vufinddbpass}@${pgsqlhost}/${vufinddb}!&quot; ${srcdir}/config/vufind/config.ini &gt; ${srcdir}/local/config/vufind/config.ini" />
</then>
<else>
<!-- build database -->
<exec command="mysqladmin -f -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} drop ${vufinddb}" />
<exec command="mysqladmin -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} create ${vufinddb}" checkreturn="true" />
<exec command="mysql -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} -e &quot;GRANT SELECT,INSERT,UPDATE,DELETE ON ${vufinddb}.* TO '${vufinddbuser}'@'${mysqlhost}' IDENTIFIED BY '${vufinddbpass}' WITH GRANT OPTION&quot;" checkreturn="true" />
<exec command="mysql -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} -e &quot;FLUSH PRIVILEGES&quot;" checkreturn="true" />
<exec command="mysql -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} -D ${vufinddb} &lt; ${srcdir}/module/VuFind/sql/mysql.sql" checkreturn="true" />
<!-- configure VuFind -->
<exec command="sed -e &quot;s!mysql://root@localhost/vufind!mysql://${vufinddbuser}:${vufinddbpass}@${mysqlhost}/${vufinddb}!&quot; ${srcdir}/config/vufind/config.ini &gt; ${srcdir}/local/config/vufind/config.ini" />
</else>
</if>
<!-- import marc test records into vufind index (note: the marc test records have prefix "testsample#") -->
<exec command="find ${srcdir}/tests/data -name *.mrc -printf %p," outputProperty="buglist" />
<foreach list="${buglist}" param="filename" delimiter="," target="importrec" />
<!-- start Solr (use restart in case of old PID files) -->
<exec command="VUFIND_HOME=${srcdir} VUFIND_LOCAL_DIR=${srcdir}/local JETTY_PID=${tmp}/vufindtest.pid JETTY_CONSOLE=/dev/null ${srcdir}/vufind.sh restart" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
</target>
<!-- Uninstall and Deactivate VuFind -->
<target name="shutdown" description="deactivate and uninstall demo">
<!-- remove Apache settings -->
<exec command="rm ${apacheconfdir}/vufindtest" />
<exec command="${apachectl} restart" />
<!-- drop database -->
<if>
<equals arg1="${dbtype}" arg2="pgsql" />
<then>
<exec command="sudo su -c &quot;psql -c \&quot;DROP DATABASE ${vufinddb};\&quot;&quot; ${pgsqlrootuser}" checkreturn="true" />
<exec command="sudo su -c &quot;psql -c \&quot;DROP USER ${vufinddbuser};\&quot;&quot; ${pgsqlrootuser}" checkreturn="true" />
</then>
<else>
<exec command="mysqladmin -f -h ${mysqlhost} -u ${mysqlrootuser} -p${mysqlrootpass} drop ${vufinddb}" />
</else>
</if>
<!-- stop Solr -->
<exec command="VUFIND_HOME=${srcdir} VUFIND_LOCAL_DIR=${srcdir}/local JETTY_PID=${tmp}/vufindtest.pid ${srcdir}/vufind.sh stop" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
<!-- delete the configuration, sample index, logs and cache data -->
<delete dir="${srcdir}/solr/stats/index" includeemptydirs="true" failonerror="true" />
<delete dir="${srcdir}/solr/authority/index" includeemptydirs="true" failonerror="true" />
<delete dir="${srcdir}/solr/biblio/index" includeemptydirs="true" failonerror="true" />
<delete dir="${srcdir}/solr/biblio/spellchecker" includeemptydirs="true" failonerror="true" />
<delete dir="${srcdir}/solr/biblio/spellShingle" includeemptydirs="true" failonerror="true" />
<delete>
<fileset dir="${srcdir}/solr/jetty/logs">
<include name="*.log" />
</fileset>
</delete>
<delete dir="${srcdir}/local/cache" includeemptydirs="true" failonerror="true" />
<mkdir dir="${srcdir}/local/cache" />
<delete file="${srcdir}/local/config/vufind/config.ini" />
</target>
<!-- Prepare VuFind for distribution -->
<target name="package" description="build VuFind packages for distribution">
<!-- make sure the work area is empty, then rebuild it -->
<delete dir="${builddir}/packages" includeemptydirs="true" failonerror="true" />
<mkdir dir="${builddir}/packages" />
<!-- build the standard tar.gz archive -->
<exec command="git archive master --format=tar --prefix=vufind-${version}/ -o ${builddir}/packages/vufind-${version}.tar" />
<exec command="gzip ${builddir}/packages/vufind-${version}.tar" />
<!-- report success -->
<echo message="Packages successfully generated in ${builddir}/packages" />
</target>
<target name="importrec" description="import each of the bug marc test record">
<if>
<istrue value="${filename}"/> <!-- To ignore the last token, as find command output list has ',' after last filename -->
<then>
<exec command="basename ${filename}" outputProperty="BASENAME" />
<!-- create custom import configurations to load the MARC filename into the building facet to help
test cases to limit searches to within specific collections of test records. -->
<exec command="echo building=\&quot;${BASENAME}\&quot; &gt; ${srcdir}/import/marc-${BASENAME}.properties" />
<exec command="sed -e &quot;s!marc_local.properties!marc-${BASENAME}.properties!&quot; ${srcdir}/local/import/import.properties &gt; ${srcdir}/local/import/import-${BASENAME}.properties" />
<!-- perform the import -->
<exec command="VUFIND_HOME=${srcdir} VUFIND_LOCAL_DIR=${srcdir}/local ${srcdir}/import-marc.sh -p ${srcdir}/local/import/import-${BASENAME}.properties ${filename}" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
<!-- clean up temp files -->
<delete file="${srcdir}/import/marc-${BASENAME}.properties" />
<delete file="${srcdir}/import/import-${BASENAME}.properties" />
</then>
</if>
</target>
</project>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment