K
K
krll-k2014-08-18 11:41:59
linux
krll-k, 2014-08-18 11:41:59

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>

In your opinion, is it acceptable to write build.xml in the same vein as Gruntfile or Gulpfile? That is, in another way - Is it possible to think that Phing is a PHP analogue of GruntJS (GulpJS)? There's an answer?
After all, if this is true ( Phing is a tax ), then Phing should be able to accept values ​​from the command line into its tasks. For example, if I want Phing to run a development server for me on localhost with port 8080, I could write a task in build.xml:
<target name="server">
    <exec command="php -S localhost:8080 -t ."/>
  </target>

But there is one thing, but if I start, and port 8080 is busy, Phing will not tell me about it. Next, think about the method of preventing such situations. One such method would be to specify the domain and port at startup, something like this:
$ php vendor/bin/phing server
$ Укажите домен и порт на котором вы хотите запустить сервер: [localhost:8080]

I want to ask: is Phing able to match these GruntJS and GulpJS build systems?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-08-18
Protko @Fesor

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 question

Ask a Question

731 491 924 answers to any question