More Related Content
Similar to Building com Phing - 7Masters PHP (20)
Building com Phing - 7Masters PHP
- 2. Build em PHP?
● Build = automação de processos
– Testes e artefatos de QA
– Deployment
– Atualização
– Distribuição
– Verificação
- 3. Phing
●
PHing Is Not Gnumake
●
http://phing.info
● Sintaxe do Apache Ant
– Buildfile com XML
● Lógica
● Tarefas Core
● Tarefas Opcionais
- 5. Copiando o projeto...
<target name=”le_deploy”>
<copy todir=”/var/www”>
<fileset dir=".">
<exclude name=".git" />
</fileset>
</copy>
</target>
- 6. PHPUnit...
<target name=”phpunit”>
<phpunit bootstrap="src/autoload.php"
codecoverage="true"
haltonfailure="true"
haltonerror="true">
<formatter type="plain" usefile="false"/>
<batchtest>
<fileset dir="tests">
<include name="**/*Test*.php"/>
</fileset>
</batchtest>
</phpunit>
</target>
- 7. Checando dependencias
<target name=”check_dep”>
<composer command=”update”/>
</target>
●
composer.json
{
require:{
“php”:”>5.4.0”,
“ext-imagick”:”*”,
“monolog/monolog”:”0.8.*”
}
}
- 8. Variáveis
●
build.properties
app.version=13.04
path.log=/var/log/myapps/app.log
path.webroot=/var/www
●
build.xml
<properties file=”build.properties”/>
<echo msg=”App ver. ${app.version}”/>
<copy todir=”${path.webroot}”>
...
- 9. Combinando tarefas
<target name=”phpunit”>
…
<target name=”pdepend”>
…
<target name=”phpcpd”>
…
<target name=”qa”
depends=”phpcpd,pdepend,phpunit”>
- 10. Organizando
<target name=”qa”>
<phing
phingfile="qa.xml"
inheritRefs="true"
target="qa-tests" />
</target>
<target name=”deploy”>
<phing
phingfile="deploy.xml"
inheritRefs="true"
target="install" />
</target>
- 11. Executando...
● # phing
● # phing -f appbuild.xml
● # phing nossotarget
- 12. Instalando...
● pear
# pear channel-discover
pear.phing.info
# pear install -a phing/phing
● composer
phing/phing