Answer the question
In order to leave comments, you need to log in
Category: assembly systems and automation. Is it possible to think that Phing is a PHP analogue of GruntJS (GulpJS)?
The team leader told me to get acquainted with the Phing build system, specifying what we would use for deployment and autotests. Before that, I had to write Gruntfile and Gulpfile, and now I write build.xml:
<project name="test" basedir="." default="server">
<target name="archive" depends="">
<echo>Архивируем проект</echo>
<zip destfile="phing.zip">
<fileset dir=".">
<patternset>
<include name="**/**"/>
<exclude name="vendor/**"/>
<exclude name="tests/**"/>
<exclude name="composer.*"/>
<exclude name="adminer-*"/>
<exclude name="codeception.*"/>
<exclude name="build.xml"/>
</patternset>
</fileset>
</zip>
</target>
<property name="uname" value="" override="false"/>
<property name="pwd" value="" override="false"/>
<property name="host" value="" override="false"/>
<property name="todir" value="" override="false"/>
<target name="build" depends="archive">
<echo>Отправляем на сервер</echo>
<scp username="${uname}" password="${pwd}" host="${host}"
fetch="false" file="phing.zip" todir="${todir}"/>
<echo>Удаляем архив с локали</echo>
<delete file="phing.zip" />
<echo>Подготавливаем директорию на сервере</echo>
<ssh username="${uname}" password="${pwd}" host="${host}"
command="rm -rf ${todir}/www"/>
<echo>Разархивируем на сервере</echo>
<ssh username="${uname}" password="${pwd}" host="${host}"
command="unzip -o -q ${todir}/phing.zip -d ${todir}/www"/>
<ssh username="${uname}" password="${pwd}" host="${host}"
command="chmod -R 777 ${todir}/www/templates/{cache,compiled}"/>
</target>
</project>
<target name="server">
<exec command="php -S localhost:8080 -t ."/>
</target>
$ php vendor/bin/phing server
$ Укажите домен и порт на котором вы хотите запустить сервер: [localhost:8080]
Answer the question
In order to leave comments, you need to log in
Phing/Grunt/Gulp etc. it's all analogous to Make. You can write make files instead of phing, it will be about the same, just with phing maybe a little more convenient. In general, it is better not to project your experience with grunt onto phing. It's kind of the same, but slightly different. The parallel with ant is more suitable here.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question