SlideShare a Scribd company logo
1 of 93
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
lazy
development
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Stay DRY
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
phing-the-things$ phing test
Buildfile: /Users/Omni/phing-example/build.xml
[property] Loading /Users/Omni/phing-example/build.properties
phing-example > test:
PHPUnit 3.7.13 by Sebastian Bergmann.
Configuration read from /Users/Omni/phing-example/phpunit.xml
..............................
Time: 0 seconds, Memory: 7.25Mb
OK (30 tests, 52 assertions)
BUILD FINISHED
Total time: 0.3155 seconds
Phing All The Things - Omni Adams
F.............................
Time: 0 seconds, Memory: 7.25Mb
There was 1 failure:
1) GitTest::testGetCommitInfo
LOL cats have clogged the tubes!
/Users/Omni/phing-example/tests/GitTest.php:51
FAILURES!
Tests: 30, Assertions: 51, Failures: 1.Execution of target "test" failed for the following reason:
/Users/Omni/phing-example/build.xml:102:46: Task exited with code 1
BUILD FAILED
/Users/Omni/phing-example/build.xml:102:46: Task exited with code 1
Total time: 0.5653 seconds
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
<?xml version="1.0" encoding="UTF-8"?>
<project name="phing-the-things" default="test">
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true" />
</target>
</project>
Phing All The Things - Omni Adams
F.............................
Time: 0 seconds, Memory: 7.25Mb
There was 1 failure:
1) GitTest::testGetCommitInfo
LOL cats have clogged the tubes!
/Users/Omni/phing-example/tests/GitTest.php:51
FAILURES!
Tests: 30, Assertions: 51, Failures: 1.
BUILD FINISHED
Total time: 0.5619 seconds
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
● strict
● colors
● groups
● command line flags
Phing All The Things - Omni Adams
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true">
<arg value="--exclude-group=integration" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="test">
<exec executable="phpunit" passthru="true"
checkreturn="true">
<arg value="${phpunitFlag}" />
</exec>
</target>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<property name="test" value="--group=smoke" />
<property name="outputDir" value="./docs" />
Phing All The Things - Omni Adams
phing-the-things$ phing test -DphpunitFlag=--group=smoke
Buildfile: /Users/Omni/phing-example/build.xml
[property] Loading /Users/Omni/phing-example/build.properties
phing-example > test:
PHPUnit 3.7.13 by Sebastian Bergmann.
Configuration read from /Users/Omni/phing-example/phpunit.xml
........
Time: 0 seconds, Memory: 7.25Mb
OK (8 tests, 12 assertions)
BUILD FINISHED
Total time: 0.1058 seconds
Phing All The Things - Omni Adams
composer=/opt/composer.phar
server1.user=oadams
server1.url=www.example.lan
<target name="properties-example">
<exec executable="${composer}" />
<exec executable="ssh" passthru="true">
<arg value="-t" />
<arg value="${server1.user}@${server1.url}" />
<arg value="sudo /sbin/service httpd restart" />
</exec>
</target>
Phing All The Things - Omni Adams
things
Phing All The Things - Omni Adams
author=Omni
title=Phing All The Things
<property name="author" value="Other Guy" />
<property file="build.properties" />
<property name="title" value="Phing-A-Ling" />
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<patternset id="files">
<include name="**/*.php" />
<exclude name="vendor/**" />
</patternset>
<target name="phpcs">
<phpcodesniffer standard="./coding_rules.xml"
format="full" showWarnings="true">
<fileset dir=".">
<patternset refid="files" />
</fileset>
</phpcodesniffer>
</target>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<target name="document" depends="require-doc">
<mkdir dir="${doc}/api" />
<exec executable="${doc}/api" passthru="true" />
<arg value="--directory=." />
<arg value="--ignore=vendor/*" />
<arg value="--ignore=src/*" />
<arg value="--progressbar" />
<arg value="--target=${doc}/api" />
<arg value="--title=API documentation" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="document" depends="require-doc">
<mkdir dir="${doc}/api" />
<exec executable="${doc}/api" passthru="true" />
<arg value="--directory=." />
<arg value="--ignore=vendor/*" />
<arg value="--ignore=src/*" />
<arg value="--progressbar" />
<arg value="--target=${doc}/api" />
<arg value="--title=API documentation" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="document" depends="require-doc">
<mkdir dir="${doc}/api" />
<exec executable="${doc}/api" passthru="true" />
<arg value="--directory=." />
<arg value="--ignore=vendor/*" />
<arg value="--ignore=src/*" />
<arg value="--progressbar" />
<arg value="--target=${doc}/api" />
<arg value="--title=API documentation" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="document" depends="require-doc">
<mkdir dir="${doc}/api" />
<exec executable="${doc}/api" passthru="true" />
<arg value="--directory=." />
<arg value="--ignore=vendor/*" />
<arg value="--ignore=src/*" />
<arg value="--progressbar" />
<arg value="--target=${doc}/api" />
<arg value="--title=API documentation" />
</exec>
</target>
Phing All The Things - Omni Adams
<exec executable="ps" outputProperty="ps-output">
<arg value="x" />
<arg value="|" />
<arg value="grep" />
<arg value="selenium" />
<arg value="|" />
<arg value="grep" />
<arg value="-v" />
<arg value="grep" />
...
</exec>
Phing All The Things - Omni Adams
<exec executable="ps" outputProperty="ps-output">
<arg line="x |grep selen |grep -v 'grep|phing'" />
</exec>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<target name="build" depends="test" />
<target name="coverage" depends="require-doc" />
<exec executable="phpunit" passthru="true" />
<arg value="--coverage-html=${doc}/coverage" />
<arg value="${phpunitFlag}" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="require-doc">
<if>
<not>
<isset property="doc" />
</not>
<then>
<fail name="doc isn't set in .properties file" />
</then>
</if>
</target>
Phing All The Things - Omni Adams
<property name="foo" value="not-test" />
<target name="example" depends="other-task">
<phingcall target="other-task">
<property name="foo" depends="test" />
<property name="bar" depends="test" />
</phingcall>
<phingcall target="other-task" />
</target>
<target name="other-task">
<echo message="${foo}" />
<echo message="${bar}" />
</target>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<uptodate property="css-compiled" targetfile="style.css">
<srcfiles dir="styles" includes="**/*less" />
</uptodate>
Phing All The Things - Omni Adams
<uptodate property="css-compiled" targetfile="style.css">
<srcfiles dir="styles" includes="**/*less" />
</uptodate>
Phing All The Things - Omni Adams
<uptodate property="css-compiled" targetfile="style.css">
<srcfiles dir="styles" includes="**/*less" />
</uptodate>
Phing All The Things - Omni Adams
<uptodate property="css-compiled" targetfile="style.css">
<srcfiles dir="styles" includes="**/*less" />
</uptodate>
Phing All The Things - Omni Adams
<uptodate property="css-compiled" targetfile="style.css">
<srcfiles dir="styles" includes="**/*less" />
</uptodate>
Phing All The Things - Omni Adams
<uptodate property="css-compiled" targetfile="style.css">
<srcfiles dir="styles" includes="**/*less" />
</uptodate>
<target name="compile-css" unless="css-compiled">
<exec executable="lessc" passthru="true"
checkreturn="true">
<arg value="-x" />
<arg value="styles/*less" />
<arg value="style.css" />
</exec>
</target>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<available property="composer-exists" file="composer.phar" />
<target name="get-composer" unless="composer-exists">
<exec executable="curl" output="composer.php">
<arg value="-sS" />
<arg value="https://getcomposer.org/installer" />
<arg value="|" />
<arg value="php" />
</exec>
<chmod file="composer.phar" perm="664" />
</target>
Phing All The Things - Omni Adams
<available property="composer-exists" file="composer.phar" />
<target name="get-composer" unless="composer-exists">
<exec executable="curl" output="composer.php">
<arg value="-sS" />
<arg value="https://getcomposer.org/installer" />
<arg value="|" />
<arg value="php" />
</exec>
<chmod file="composer.phar" perm="775" />
</target>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
ASSUMPTIONS
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<target name="tag" depends="require-version">
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
<gitpush repository="." tags="true" quiet="true" />
</target>
Phing All The Things - Omni Adams
phing-the-things$ phing tag
Buildfile: /Users/Omni/Sites/phing/build.xml
[property] Loading /Users/Omni/Sites/phing/build.properties
phing-the-things > require-version:
[if] Error in IfTask
Execution of target "require-version" failed for the following reason: /Users/Omni/Sites/phing/build.xml:146:12:
/Users/Omni/Sites/phing/build.xml:150:18: You must pass in a version: -Dversion=1.2.3
BUILD FAILED
/Users/Omni/Sites/phing/build.xml:146:12: /Users/Omni/Sites/phing/build.xml:150:18: You must pass in a
version: -Dversion=1.2.3
Total time: 1.5921 second
Phing All The Things - Omni Adams
phing-the-things$ phing tag-no-version
Buildfile: /Users/Omni/Sites/phing/build.xml
[property] Loading /Users/Omni/Sites/phing/build.properties
phing-the-things > tag-no-version:
[gittag] git-tag command: /usr/bin/git tag -a -m'Tagged version ${version}' '${version}'
[gittag] git-tag: tags for "." repository
[gittag] git-tag output:
BUILD FINISHED
Total time: 0.2039 seconds
phing-the-things $ git tag
${version}
Phing All The Things - Omni Adams
<target name="tag-version">
<version releasetype="${release}" file="version.txt"
property="version" />
<exec executable="git" passthru="true">
<arg line="add version.txt" />
</exec>
<exec executable="git" passthru="true">
<arg line="commit -m 'Updated version file to ${version}'" />
</exec>
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
</target>
Phing All The Things - Omni Adams
<target name="tag-version">
<version releasetype="${release}" file="version.txt"
property="version" />
<exec executable="git" passthru="true">
<arg line="add version.txt" />
</exec>
<exec executable="git" passthru="true">
<arg line="commit -m 'Updated version file to ${version}'" />
</exec>
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
</target>
Phing All The Things - Omni Adams
<target name="tag-version">
<version releasetype="${release}" file="version.txt"
property="version" />
<exec executable="git" passthru="true">
<arg line="add version.txt" />
</exec>
<exec executable="git" passthru="true">
<arg line="commit -m 'Updated version file to ${version}'" />
</exec>
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
</target>
Phing All The Things - Omni Adams
<target name="tag-version">
<version releasetype="${release}" file="version.txt"
property="version" />
<exec executable="git" passthru="true">
<arg line="add version.txt" />
</exec>
<exec executable="git" passthru="true">
<arg line="commit -m 'Updated version file to ${version}'" />
</exec>
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
</target>
Phing All The Things - Omni Adams
<target name="tag-version">
<version releasetype="${release}" file="version.txt"
property="version" />
<exec executable="git" passthru="true">
<arg line="add version.txt" />
</exec>
<exec executable="git" passthru="true">
<arg line="commit -m 'Updated version file to ${version}'" />
</exec>
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
</target>
Phing All The Things - Omni Adams
phing-the-things$ phing tag-version -Drelease=minor
Buildfile: /Users/Omni/Sites/phing/build.xml
[property] Loading /Users/Omni/Sites/phing/build.properties
phing-the-things > tag-version:
[master 4b48e9f] Updated version file to 0.1.0
1 file changed, 1 insertion(+), 1 deletion(-)
[gittag] git-tag command: /usr/bin/git tag -a -m'Tagged version 0.1.0' '0.1.0'
[gittag] git-tag: tags for "." repository
[gittag] git-tag output:
BUILD FINISHED
Total time: 0.3507 seconds
phing-the-things $ git tag
0.0.1
0.1.0
Phing All The Things - Omni Adams
<target name="release-major">
<phingcall target="tag-version">
<property name="release" value="major" />
</phingcall>
</target>
<target name="release-minor">
<phingcall target="tag-version">
<property name="release" value="minor" />
</phingcall>
</target>
Phing All The Things - Omni Adams
<target name="tag-svn">
<svncopy svnpath="${svnpath}" username="${svnuser}"
password="${svnpass}" nocache="true"
repositoryurl="svn://localhost/phing-the-things/trunk/"
todir="svn://localhost/phing-the-things/tags/${version}" />
</target>
Phing All The Things - Omni Adams
<target name="tag-version-no-file">
<exec executable="git" outputProperty="latest-version">
<arg line="tag | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -1" />
</exec>
<echo file="v.txt">${latest-version}</echo>
<version releasetype="${release}" file="v.txt"
property="version" />
<delete file="v.txt" />
<gittag annotate="true" name="${version}" repository="."
message="Tagged version ${version}" />
</target>
Phing All The Things - Omni Adams
<property name="build-url"
value="https://jenkins/job/phing/lastBuild/api/json" />
<target name="require-green-build-check">
<exec executable="curl" outputProperty="status">
<arg line='--silent ${build-url} |grep result |cut -d" -f4' />
</exec>
<if>
<not><equals arg1="${status}" arg2="SUCCESS" /></not>
<then><fail message="Jenkins build is broken" /></then>
</if>
</target>
Phing All The Things - Omni Adams
<target name="deploy">
<phingcall target="require-release" />
<phingcall target="require-green-build-check" />
<phingcall target="tag-version-no-file" />
</target>
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<target name="prepare">
<gitclone repository="git://server/phing-things.git"
targetPath="build" />
<gitcheckout repository="build"
branchname="${version}" quiet="true" />
<delete dir="build/tests" />
<delete file="build/build.xml" />
<tar destfile="build-${version}.tar.bz2" basedir="build"
includeemptydir="true" compression="bzip2" />
<delete dir="build" />
</target>
Phing All The Things - Omni Adams
<target name="deploy">
<phingcall target="require-release" />
<phingcall target="require-green-build-check" />
<phingcall target="tag-version-no-file" />
<phingcall target="prepare" />
</target>
Phing All The Things - Omni Adams
<target name="upload">
<exec executable="scp" checkreturn="true">
<arg value="build-${version}.tar.bz2" />
<arg value="${server}:/var/www/" />
</exec>
<exec executable="ssh" checkreturn="true" passthru="true">
<arg value="${server}" />
<arg value="cd /var/www;tar -xjf build-${version}.tar.bz2" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="deploy">
<phingcall target="require-release" />
<phingcall target="require-green-build-check" />
<phingcall target="tag-version-no-file" />
<phingcall target="prepare" />
<phingcall target="upload" />
</target>
Phing All The Things - Omni Adams
<target name="go-live" depends="require-version">
<exec executable="ssh" checkreturn="true"
passthru="true">
<arg value="${server}" />
<arg value="cd /var/www; ln -sf build-${version} app" />
</exec>
</target>
Phing All The Things - Omni Adams
<target name="deploy">
<phingcall target="require-release" />
<phingcall target="require-green-build-check" />
<phingcall target="tag-version-no-file" />
<phingcall target="prepare" />
<phingcall target="upload" />
<phingcall target="go-live" />
</target>
Phing All The Things - Omni Adams
Sanity
Chec
k
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
phing-the-things$ phing go-live -Dversion=1.2.3
Phing All The Things - Omni Adams
phing-the-things$ phing go-live -Dversion=1.2.3
Phing All The Things - Omni Adams
!$monitored ==
!$exist
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
<?php
require_once 'phing/Task.php';
class UpdateNewRelicTask extends Task {
public function init() {
// Runs when task is imported
}
public function main() {
// Runs when task is executed
}
}
Phing All The Things - Omni Adams
<taskdef name="newrelic"
classname="UpdateNewRelicTask" />
<target name="update-new-relic">
<newrelic />
</target>
Phing All The Things - Omni Adams
<taskdef name="newrelic"
classname="UpdateNewRelicTask" />
<target name="update-new-relic">
<newrelic />
</target>
Phing All The Things - Omni Adams
class UpdateNewRelicTask extends Task {
protected $version;
public function setVersion($version) {
$this->version = $version;
}
}
Phing All The Things - Omni Adams
<target name="update-new-relic">
<newrelic version="${version}" />
</target>
Phing All The Things - Omni Adams
public function main() {
$options = array(
CURLOPT_POSTFIELDS => array(
'deployment[application_id]' => $this->appId,
'deployment[description]' => $this->version ),
CURLOPT_HTTPHEADER => array(
'x-api-key: ' . $this->apiKey ),
CURLOPT_URL => $this->url,
);
...
}
Phing All The Things - Omni Adams
public function main() {
...
$ch = curl_init();
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
}
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
Phing All The Things - Omni Adams
• Omni Adams
• @omnicolor
• http://omni-spot.blogspot.com
• omni@digitaldarkness.com
• https://joind.in/11182

More Related Content

What's hot

Phing for power users - frOSCon8
Phing for power users - frOSCon8Phing for power users - frOSCon8
Phing for power users - frOSCon8
Stephan Hochdörfer
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
benalman
 
Socket applications
Socket applicationsSocket applications
Socket applications
João Moura
 
Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13
Stephan Hochdörfer
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
Jacob Kaplan-Moss
 

What's hot (20)

Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
 
Gaelyk: Lightweight Groovy on the Google App Engine
Gaelyk: Lightweight Groovy on the Google App EngineGaelyk: Lightweight Groovy on the Google App Engine
Gaelyk: Lightweight Groovy on the Google App Engine
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastWorkshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
 
Tobias Nyholm "Deep dive into Symfony 4 internals"
Tobias Nyholm "Deep dive into Symfony 4 internals"Tobias Nyholm "Deep dive into Symfony 4 internals"
Tobias Nyholm "Deep dive into Symfony 4 internals"
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Power shell voor developers
Power shell voor developersPower shell voor developers
Power shell voor developers
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
 
WordPress and Ajax
WordPress and AjaxWordPress and Ajax
WordPress and Ajax
 
Web-Performance
Web-PerformanceWeb-Performance
Web-Performance
 
Phing for power users - frOSCon8
Phing for power users - frOSCon8Phing for power users - frOSCon8
Phing for power users - frOSCon8
 
GAEO
GAEOGAEO
GAEO
 
Úvod do programování 5
Úvod do programování 5Úvod do programování 5
Úvod do programování 5
 
jQuery Plugin Creation
jQuery Plugin CreationjQuery Plugin Creation
jQuery Plugin Creation
 
Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12Workshop quality assurance for php projects tek12
Workshop quality assurance for php projects tek12
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)Best Practices in Plugin Development (WordCamp Seattle)
Best Practices in Plugin Development (WordCamp Seattle)
 
Hybrid Web Applications
Hybrid Web ApplicationsHybrid Web Applications
Hybrid Web Applications
 
Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13Phing for power users - dpc_uncon13
Phing for power users - dpc_uncon13
 
The Best (and Worst) of Django
The Best (and Worst) of DjangoThe Best (and Worst) of Django
The Best (and Worst) of Django
 
Up & Running with Polymer
Up & Running with PolymerUp & Running with Polymer
Up & Running with Polymer
 

Similar to Phing all the things

Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
lestrrat
 
OpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonOpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con Python
PyCon Italia
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
defrag2
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
patter
 
Scalalable Language for a Scalable Web
Scalalable Language for a Scalable WebScalalable Language for a Scalable Web
Scalalable Language for a Scalable Web
Timothy Perrett
 

Similar to Phing all the things (20)

Building com Phing - 7Masters PHP
Building com Phing - 7Masters PHPBuilding com Phing - 7Masters PHP
Building com Phing - 7Masters PHP
 
Building and Deploying PHP apps with Phing
Building and Deploying PHP apps with PhingBuilding and Deploying PHP apps with Phing
Building and Deploying PHP apps with Phing
 
Phing
PhingPhing
Phing
 
Write php deploy everywhere
Write php deploy everywhereWrite php deploy everywhere
Write php deploy everywhere
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
 
Postman On Steroids
Postman On SteroidsPostman On Steroids
Postman On Steroids
 
Breaking Limits on Mobile HTML5 - TopConf Tallinn
Breaking Limits on Mobile HTML5 - TopConf TallinnBreaking Limits on Mobile HTML5 - TopConf Tallinn
Breaking Limits on Mobile HTML5 - TopConf Tallinn
 
Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011Improving QA on PHP projects - confoo 2011
Improving QA on PHP projects - confoo 2011
 
Php Power Tools
Php Power ToolsPhp Power Tools
Php Power Tools
 
A Phing fairy tale - ConFoo13
A Phing fairy tale - ConFoo13A Phing fairy tale - ConFoo13
A Phing fairy tale - ConFoo13
 
OpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con PythonOpenERP e l'arte della gestione aziendale con Python
OpenERP e l'arte della gestione aziendale con Python
 
Write php deploy everywhere tek11
Write php deploy everywhere   tek11Write php deploy everywhere   tek11
Write php deploy everywhere tek11
 
Continous delivery with Jenkins and Chef
Continous delivery with Jenkins and ChefContinous delivery with Jenkins and Chef
Continous delivery with Jenkins and Chef
 
Perl basics for Pentesters
Perl basics for PentestersPerl basics for Pentesters
Perl basics for Pentesters
 
Metadata-driven Testing
Metadata-driven TestingMetadata-driven Testing
Metadata-driven Testing
 
Phing i Fabric - Budowanie i deployment aplikacji webowych
Phing i Fabric - Budowanie i deployment aplikacji webowychPhing i Fabric - Budowanie i deployment aplikacji webowych
Phing i Fabric - Budowanie i deployment aplikacji webowych
 
Algotitmo Moinho
Algotitmo MoinhoAlgotitmo Moinho
Algotitmo Moinho
 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
 
Scalalable Language for a Scalable Web
Scalalable Language for a Scalable WebScalalable Language for a Scalable Web
Scalalable Language for a Scalable Web
 
第1回PHP拡張勉強会
第1回PHP拡張勉強会第1回PHP拡張勉強会
第1回PHP拡張勉強会
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Phing all the things

  • 1. Phing All The Things - Omni Adams
  • 2. Phing All The Things - Omni Adams lazy development
  • 3. Phing All The Things - Omni Adams
  • 4. Phing All The Things - Omni Adams Stay DRY
  • 5. Phing All The Things - Omni Adams
  • 6. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 7. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 8. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 9. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 10. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 11. Phing All The Things - Omni Adams phing-the-things$ phing test Buildfile: /Users/Omni/phing-example/build.xml [property] Loading /Users/Omni/phing-example/build.properties phing-example > test: PHPUnit 3.7.13 by Sebastian Bergmann. Configuration read from /Users/Omni/phing-example/phpunit.xml .............................. Time: 0 seconds, Memory: 7.25Mb OK (30 tests, 52 assertions) BUILD FINISHED Total time: 0.3155 seconds
  • 12. Phing All The Things - Omni Adams F............................. Time: 0 seconds, Memory: 7.25Mb There was 1 failure: 1) GitTest::testGetCommitInfo LOL cats have clogged the tubes! /Users/Omni/phing-example/tests/GitTest.php:51 FAILURES! Tests: 30, Assertions: 51, Failures: 1.Execution of target "test" failed for the following reason: /Users/Omni/phing-example/build.xml:102:46: Task exited with code 1 BUILD FAILED /Users/Omni/phing-example/build.xml:102:46: Task exited with code 1 Total time: 0.5653 seconds
  • 13. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 14. Phing All The Things - Omni Adams <?xml version="1.0" encoding="UTF-8"?> <project name="phing-the-things" default="test"> <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true" /> </target> </project>
  • 15. Phing All The Things - Omni Adams F............................. Time: 0 seconds, Memory: 7.25Mb There was 1 failure: 1) GitTest::testGetCommitInfo LOL cats have clogged the tubes! /Users/Omni/phing-example/tests/GitTest.php:51 FAILURES! Tests: 30, Assertions: 51, Failures: 1. BUILD FINISHED Total time: 0.5619 seconds
  • 16. Phing All The Things - Omni Adams
  • 17. Phing All The Things - Omni Adams ● strict ● colors ● groups ● command line flags
  • 18. Phing All The Things - Omni Adams <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true"> <arg value="--exclude-group=integration" /> </exec> </target>
  • 19. Phing All The Things - Omni Adams <target name="test"> <exec executable="phpunit" passthru="true" checkreturn="true"> <arg value="${phpunitFlag}" /> </exec> </target>
  • 20. Phing All The Things - Omni Adams
  • 21. Phing All The Things - Omni Adams <property name="test" value="--group=smoke" /> <property name="outputDir" value="./docs" />
  • 22. Phing All The Things - Omni Adams phing-the-things$ phing test -DphpunitFlag=--group=smoke Buildfile: /Users/Omni/phing-example/build.xml [property] Loading /Users/Omni/phing-example/build.properties phing-example > test: PHPUnit 3.7.13 by Sebastian Bergmann. Configuration read from /Users/Omni/phing-example/phpunit.xml ........ Time: 0 seconds, Memory: 7.25Mb OK (8 tests, 12 assertions) BUILD FINISHED Total time: 0.1058 seconds
  • 23. Phing All The Things - Omni Adams composer=/opt/composer.phar server1.user=oadams server1.url=www.example.lan <target name="properties-example"> <exec executable="${composer}" /> <exec executable="ssh" passthru="true"> <arg value="-t" /> <arg value="${server1.user}@${server1.url}" /> <arg value="sudo /sbin/service httpd restart" /> </exec> </target>
  • 24. Phing All The Things - Omni Adams things
  • 25. Phing All The Things - Omni Adams author=Omni title=Phing All The Things <property name="author" value="Other Guy" /> <property file="build.properties" /> <property name="title" value="Phing-A-Ling" />
  • 26. Phing All The Things - Omni Adams
  • 27. Phing All The Things - Omni Adams <patternset id="files"> <include name="**/*.php" /> <exclude name="vendor/**" /> </patternset> <target name="phpcs"> <phpcodesniffer standard="./coding_rules.xml" format="full" showWarnings="true"> <fileset dir="."> <patternset refid="files" /> </fileset> </phpcodesniffer> </target>
  • 28. Phing All The Things - Omni Adams
  • 29. Phing All The Things - Omni Adams <target name="document" depends="require-doc"> <mkdir dir="${doc}/api" /> <exec executable="${doc}/api" passthru="true" /> <arg value="--directory=." /> <arg value="--ignore=vendor/*" /> <arg value="--ignore=src/*" /> <arg value="--progressbar" /> <arg value="--target=${doc}/api" /> <arg value="--title=API documentation" /> </exec> </target>
  • 30. Phing All The Things - Omni Adams <target name="document" depends="require-doc"> <mkdir dir="${doc}/api" /> <exec executable="${doc}/api" passthru="true" /> <arg value="--directory=." /> <arg value="--ignore=vendor/*" /> <arg value="--ignore=src/*" /> <arg value="--progressbar" /> <arg value="--target=${doc}/api" /> <arg value="--title=API documentation" /> </exec> </target>
  • 31. Phing All The Things - Omni Adams <target name="document" depends="require-doc"> <mkdir dir="${doc}/api" /> <exec executable="${doc}/api" passthru="true" /> <arg value="--directory=." /> <arg value="--ignore=vendor/*" /> <arg value="--ignore=src/*" /> <arg value="--progressbar" /> <arg value="--target=${doc}/api" /> <arg value="--title=API documentation" /> </exec> </target>
  • 32. Phing All The Things - Omni Adams <target name="document" depends="require-doc"> <mkdir dir="${doc}/api" /> <exec executable="${doc}/api" passthru="true" /> <arg value="--directory=." /> <arg value="--ignore=vendor/*" /> <arg value="--ignore=src/*" /> <arg value="--progressbar" /> <arg value="--target=${doc}/api" /> <arg value="--title=API documentation" /> </exec> </target>
  • 33. Phing All The Things - Omni Adams <exec executable="ps" outputProperty="ps-output"> <arg value="x" /> <arg value="|" /> <arg value="grep" /> <arg value="selenium" /> <arg value="|" /> <arg value="grep" /> <arg value="-v" /> <arg value="grep" /> ... </exec>
  • 34. Phing All The Things - Omni Adams <exec executable="ps" outputProperty="ps-output"> <arg line="x |grep selen |grep -v 'grep|phing'" /> </exec>
  • 35. Phing All The Things - Omni Adams
  • 36. Phing All The Things - Omni Adams
  • 37. Phing All The Things - Omni Adams
  • 38. Phing All The Things - Omni Adams <target name="build" depends="test" /> <target name="coverage" depends="require-doc" /> <exec executable="phpunit" passthru="true" /> <arg value="--coverage-html=${doc}/coverage" /> <arg value="${phpunitFlag}" /> </exec> </target>
  • 39. Phing All The Things - Omni Adams <target name="require-doc"> <if> <not> <isset property="doc" /> </not> <then> <fail name="doc isn't set in .properties file" /> </then> </if> </target>
  • 40. Phing All The Things - Omni Adams <property name="foo" value="not-test" /> <target name="example" depends="other-task"> <phingcall target="other-task"> <property name="foo" depends="test" /> <property name="bar" depends="test" /> </phingcall> <phingcall target="other-task" /> </target> <target name="other-task"> <echo message="${foo}" /> <echo message="${bar}" /> </target>
  • 41. Phing All The Things - Omni Adams
  • 42. Phing All The Things - Omni Adams <uptodate property="css-compiled" targetfile="style.css"> <srcfiles dir="styles" includes="**/*less" /> </uptodate>
  • 43. Phing All The Things - Omni Adams <uptodate property="css-compiled" targetfile="style.css"> <srcfiles dir="styles" includes="**/*less" /> </uptodate>
  • 44. Phing All The Things - Omni Adams <uptodate property="css-compiled" targetfile="style.css"> <srcfiles dir="styles" includes="**/*less" /> </uptodate>
  • 45. Phing All The Things - Omni Adams <uptodate property="css-compiled" targetfile="style.css"> <srcfiles dir="styles" includes="**/*less" /> </uptodate>
  • 46. Phing All The Things - Omni Adams <uptodate property="css-compiled" targetfile="style.css"> <srcfiles dir="styles" includes="**/*less" /> </uptodate>
  • 47. Phing All The Things - Omni Adams <uptodate property="css-compiled" targetfile="style.css"> <srcfiles dir="styles" includes="**/*less" /> </uptodate> <target name="compile-css" unless="css-compiled"> <exec executable="lessc" passthru="true" checkreturn="true"> <arg value="-x" /> <arg value="styles/*less" /> <arg value="style.css" /> </exec> </target>
  • 48. Phing All The Things - Omni Adams
  • 49. Phing All The Things - Omni Adams <available property="composer-exists" file="composer.phar" /> <target name="get-composer" unless="composer-exists"> <exec executable="curl" output="composer.php"> <arg value="-sS" /> <arg value="https://getcomposer.org/installer" /> <arg value="|" /> <arg value="php" /> </exec> <chmod file="composer.phar" perm="664" /> </target>
  • 50. Phing All The Things - Omni Adams <available property="composer-exists" file="composer.phar" /> <target name="get-composer" unless="composer-exists"> <exec executable="curl" output="composer.php"> <arg value="-sS" /> <arg value="https://getcomposer.org/installer" /> <arg value="|" /> <arg value="php" /> </exec> <chmod file="composer.phar" perm="775" /> </target>
  • 51. Phing All The Things - Omni Adams
  • 52. Phing All The Things - Omni Adams
  • 53. Phing All The Things - Omni Adams ASSUMPTIONS
  • 54. Phing All The Things - Omni Adams
  • 55. Phing All The Things - Omni Adams
  • 56. Phing All The Things - Omni Adams
  • 57. Phing All The Things - Omni Adams <target name="tag" depends="require-version"> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> <gitpush repository="." tags="true" quiet="true" /> </target>
  • 58. Phing All The Things - Omni Adams phing-the-things$ phing tag Buildfile: /Users/Omni/Sites/phing/build.xml [property] Loading /Users/Omni/Sites/phing/build.properties phing-the-things > require-version: [if] Error in IfTask Execution of target "require-version" failed for the following reason: /Users/Omni/Sites/phing/build.xml:146:12: /Users/Omni/Sites/phing/build.xml:150:18: You must pass in a version: -Dversion=1.2.3 BUILD FAILED /Users/Omni/Sites/phing/build.xml:146:12: /Users/Omni/Sites/phing/build.xml:150:18: You must pass in a version: -Dversion=1.2.3 Total time: 1.5921 second
  • 59. Phing All The Things - Omni Adams phing-the-things$ phing tag-no-version Buildfile: /Users/Omni/Sites/phing/build.xml [property] Loading /Users/Omni/Sites/phing/build.properties phing-the-things > tag-no-version: [gittag] git-tag command: /usr/bin/git tag -a -m'Tagged version ${version}' '${version}' [gittag] git-tag: tags for "." repository [gittag] git-tag output: BUILD FINISHED Total time: 0.2039 seconds phing-the-things $ git tag ${version}
  • 60. Phing All The Things - Omni Adams <target name="tag-version"> <version releasetype="${release}" file="version.txt" property="version" /> <exec executable="git" passthru="true"> <arg line="add version.txt" /> </exec> <exec executable="git" passthru="true"> <arg line="commit -m 'Updated version file to ${version}'" /> </exec> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> </target>
  • 61. Phing All The Things - Omni Adams <target name="tag-version"> <version releasetype="${release}" file="version.txt" property="version" /> <exec executable="git" passthru="true"> <arg line="add version.txt" /> </exec> <exec executable="git" passthru="true"> <arg line="commit -m 'Updated version file to ${version}'" /> </exec> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> </target>
  • 62. Phing All The Things - Omni Adams <target name="tag-version"> <version releasetype="${release}" file="version.txt" property="version" /> <exec executable="git" passthru="true"> <arg line="add version.txt" /> </exec> <exec executable="git" passthru="true"> <arg line="commit -m 'Updated version file to ${version}'" /> </exec> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> </target>
  • 63. Phing All The Things - Omni Adams <target name="tag-version"> <version releasetype="${release}" file="version.txt" property="version" /> <exec executable="git" passthru="true"> <arg line="add version.txt" /> </exec> <exec executable="git" passthru="true"> <arg line="commit -m 'Updated version file to ${version}'" /> </exec> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> </target>
  • 64. Phing All The Things - Omni Adams <target name="tag-version"> <version releasetype="${release}" file="version.txt" property="version" /> <exec executable="git" passthru="true"> <arg line="add version.txt" /> </exec> <exec executable="git" passthru="true"> <arg line="commit -m 'Updated version file to ${version}'" /> </exec> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> </target>
  • 65. Phing All The Things - Omni Adams phing-the-things$ phing tag-version -Drelease=minor Buildfile: /Users/Omni/Sites/phing/build.xml [property] Loading /Users/Omni/Sites/phing/build.properties phing-the-things > tag-version: [master 4b48e9f] Updated version file to 0.1.0 1 file changed, 1 insertion(+), 1 deletion(-) [gittag] git-tag command: /usr/bin/git tag -a -m'Tagged version 0.1.0' '0.1.0' [gittag] git-tag: tags for "." repository [gittag] git-tag output: BUILD FINISHED Total time: 0.3507 seconds phing-the-things $ git tag 0.0.1 0.1.0
  • 66. Phing All The Things - Omni Adams <target name="release-major"> <phingcall target="tag-version"> <property name="release" value="major" /> </phingcall> </target> <target name="release-minor"> <phingcall target="tag-version"> <property name="release" value="minor" /> </phingcall> </target>
  • 67. Phing All The Things - Omni Adams <target name="tag-svn"> <svncopy svnpath="${svnpath}" username="${svnuser}" password="${svnpass}" nocache="true" repositoryurl="svn://localhost/phing-the-things/trunk/" todir="svn://localhost/phing-the-things/tags/${version}" /> </target>
  • 68. Phing All The Things - Omni Adams <target name="tag-version-no-file"> <exec executable="git" outputProperty="latest-version"> <arg line="tag | sort -t. -k 1,1n -k 2,2n -k 3,3n | tail -1" /> </exec> <echo file="v.txt">${latest-version}</echo> <version releasetype="${release}" file="v.txt" property="version" /> <delete file="v.txt" /> <gittag annotate="true" name="${version}" repository="." message="Tagged version ${version}" /> </target>
  • 69. Phing All The Things - Omni Adams <property name="build-url" value="https://jenkins/job/phing/lastBuild/api/json" /> <target name="require-green-build-check"> <exec executable="curl" outputProperty="status"> <arg line='--silent ${build-url} |grep result |cut -d" -f4' /> </exec> <if> <not><equals arg1="${status}" arg2="SUCCESS" /></not> <then><fail message="Jenkins build is broken" /></then> </if> </target>
  • 70. Phing All The Things - Omni Adams <target name="deploy"> <phingcall target="require-release" /> <phingcall target="require-green-build-check" /> <phingcall target="tag-version-no-file" /> </target>
  • 71. Phing All The Things - Omni Adams
  • 72. Phing All The Things - Omni Adams <target name="prepare"> <gitclone repository="git://server/phing-things.git" targetPath="build" /> <gitcheckout repository="build" branchname="${version}" quiet="true" /> <delete dir="build/tests" /> <delete file="build/build.xml" /> <tar destfile="build-${version}.tar.bz2" basedir="build" includeemptydir="true" compression="bzip2" /> <delete dir="build" /> </target>
  • 73. Phing All The Things - Omni Adams <target name="deploy"> <phingcall target="require-release" /> <phingcall target="require-green-build-check" /> <phingcall target="tag-version-no-file" /> <phingcall target="prepare" /> </target>
  • 74. Phing All The Things - Omni Adams <target name="upload"> <exec executable="scp" checkreturn="true"> <arg value="build-${version}.tar.bz2" /> <arg value="${server}:/var/www/" /> </exec> <exec executable="ssh" checkreturn="true" passthru="true"> <arg value="${server}" /> <arg value="cd /var/www;tar -xjf build-${version}.tar.bz2" /> </exec> </target>
  • 75. Phing All The Things - Omni Adams <target name="deploy"> <phingcall target="require-release" /> <phingcall target="require-green-build-check" /> <phingcall target="tag-version-no-file" /> <phingcall target="prepare" /> <phingcall target="upload" /> </target>
  • 76. Phing All The Things - Omni Adams <target name="go-live" depends="require-version"> <exec executable="ssh" checkreturn="true" passthru="true"> <arg value="${server}" /> <arg value="cd /var/www; ln -sf build-${version} app" /> </exec> </target>
  • 77. Phing All The Things - Omni Adams <target name="deploy"> <phingcall target="require-release" /> <phingcall target="require-green-build-check" /> <phingcall target="tag-version-no-file" /> <phingcall target="prepare" /> <phingcall target="upload" /> <phingcall target="go-live" /> </target>
  • 78. Phing All The Things - Omni Adams Sanity Chec k
  • 79. Phing All The Things - Omni Adams
  • 80. Phing All The Things - Omni Adams phing-the-things$ phing go-live -Dversion=1.2.3
  • 81. Phing All The Things - Omni Adams phing-the-things$ phing go-live -Dversion=1.2.3
  • 82. Phing All The Things - Omni Adams !$monitored == !$exist
  • 83. Phing All The Things - Omni Adams
  • 84. Phing All The Things - Omni Adams <?php require_once 'phing/Task.php'; class UpdateNewRelicTask extends Task { public function init() { // Runs when task is imported } public function main() { // Runs when task is executed } }
  • 85. Phing All The Things - Omni Adams <taskdef name="newrelic" classname="UpdateNewRelicTask" /> <target name="update-new-relic"> <newrelic /> </target>
  • 86. Phing All The Things - Omni Adams <taskdef name="newrelic" classname="UpdateNewRelicTask" /> <target name="update-new-relic"> <newrelic /> </target>
  • 87. Phing All The Things - Omni Adams class UpdateNewRelicTask extends Task { protected $version; public function setVersion($version) { $this->version = $version; } }
  • 88. Phing All The Things - Omni Adams <target name="update-new-relic"> <newrelic version="${version}" /> </target>
  • 89. Phing All The Things - Omni Adams public function main() { $options = array( CURLOPT_POSTFIELDS => array( 'deployment[application_id]' => $this->appId, 'deployment[description]' => $this->version ), CURLOPT_HTTPHEADER => array( 'x-api-key: ' . $this->apiKey ), CURLOPT_URL => $this->url, ); ... }
  • 90. Phing All The Things - Omni Adams public function main() { ... $ch = curl_init(); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch); }
  • 91. Phing All The Things - Omni Adams
  • 92. Phing All The Things - Omni Adams
  • 93. Phing All The Things - Omni Adams • Omni Adams • @omnicolor • http://omni-spot.blogspot.com • omni@digitaldarkness.com • https://joind.in/11182