Building com Phing - 7Masters PHP

2,284 views

Published on

Apresentação de Anderson Duodraco, no 7Masters - Encontro iMasters de Especialistas em PHP - Janeiro/2013

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,284
On SlideShare
0
From Embeds
0
Number of Embeds
358
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Building com Phing - 7Masters PHP

  1. 1. Building com Phing (em 7 minutos) Duodraco PHPSP Arizona
  2. 2. Build em PHP?● Build = automação de processos – Testes e artefatos de QA – Deployment – Atualização – Distribuição – Verificação
  3. 3. Phing● PHing Is Not Gnumake● http://phing.info● Sintaxe do Apache Ant – Buildfile com XML● Lógica● Tarefas Core● Tarefas Opcionais
  4. 4. Estrutura <project default=””> <target name=””> <task_a param=””/> <task_b param=””> <aux name=”” value=””/> </task_b> </target> </project
  5. 5. Copiando o projeto... <target name=”le_deploy”> <copy todir=”/var/www”> <fileset dir="."> <exclude name=".git" /> </fileset> </copy> </target>
  6. 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. 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. 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. 9. Combinando tarefas <target name=”phpunit”> … <target name=”pdepend”> … <target name=”phpcpd”> … <target name=”qa” depends=”phpcpd,pdepend,phpunit”>
  10. 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. 11. Executando...● # phing● # phing -f appbuild.xml● # phing nossotarget
  12. 12. Instalando...● pear # pear channel-discover pear.phing.info # pear install -a phing/phing● composer phing/phing
  13. 13. Obrigadohttp://duodra.co

×