SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
Automation Using
                            Phing
                        rajat_pandit@ipcmedia.com




Sunday, 20 June 2010
What is phing
                 • Phing Is Not Gnumake
                 • Its a project build tool
                 • Based on Apache Ant
                 • Cross Platform (Runs everywhere php
                       works)
                 • Lots of projects using it (Propel, Xinc,
                       symfony, prada)

Sunday, 20 June 2010
No compiling involved,
                       so what does it build?
                 • Automation of non-development tasks
                       • Configuring
                       • Packaging
                       • Uploading to remote servers
                       • Testing


Sunday, 20 June 2010
More automation...
                 • Run unit tests for you and publish
                       reports

                 • Build API Docs
                 • Package and / or install PEAR
                       packages
                 • Environment Setup
                 • App Configuration

Sunday, 20 June 2010
More automation...

                 • setting up permissions
                 • environment setup
                 • app config
                 • basically anywhere you can script,
                       you can use phing



Sunday, 20 June 2010
Other Alternatives
                             available
                 • Quite a few options available:
                       • ANT, Rake, NAnt
                 • Why Phing then?
                       • Dev already familiar with the language
                       • You can embed php straight in your build
                         script

                       • Custom extensions are easy to write
                       • Works across platforms, small footprint

Sunday, 20 June 2010
Phing: Basics

                 • Task: Built in custom piece of code to
                       perform a specific function

                 • Target: Grouping of tasks to perform
                       a more general function

                 • Project: Root node of build files
                       containing one or more targets



Sunday, 20 June 2010
Phing: Sample Build File
                 <project name="trustedreviews" default="main">
                   <property name="ver" value="1.0.1"
                   <property file="build.properties" />
                   <target name="main">
                     <mkdir dir="./build/${ver}">
                     <copy todir="./build/${veer}">
                       <fileset dir="." includes="*.txt" />
                     </copy>
                   </target>
                 </project>




Sunday, 20 June 2010
Phing: Selecting a bunch
                        of files
                 • <fileset> is used to represent a
                       bunch of files to do stuff with

                 • Many tasks support <fileset>
                       <fileset dir="/foo"
                       	 includes="**/*.html"
                       	 excludes="**/test-*" />

                       <fileset dir="/bla">
                       	 <includes name="img/${theme}/*.jpg" />
                       	 <includes name="js/*.js" />
                 •     </fileset>



Sunday, 20 June 2010
Phing: Fine tuning the
                              selection
                 • You might need to fine tune your file
                       selection further:
                       • Filter on date range?
                       • Filter on file size
                       • Type (File or Directory)
                       • At a particular depth

Sunday, 20 June 2010
Phing: Fine tuning the
                              selection
             <fileset dir="${htdocs.dir}">
             	 <includes name="**/*.html" />
             	 <containsregexp expression="/prodd+.php" />
             </fileset>

             <fileset dir="${dist}" includes="**">
             	 <or>
             	 	 <present targetdir="${htdocs}" />
             	 	 <date datetime="01/01/2010" when="before" />
             	 </or>
             </fileset>




Sunday, 20 June 2010
Phing: Filesystem
                           Transformation

                 • <mapper> element adds filesystem
                       transformation capabilities for tasks
                       that support it e.g. <copy>, <move> etc
                       <copy todir="/tmp">
                       	 <mapper type="glob" from="*.php" to="*.php.bak" />
                       	 <fileset dir="./app" includes="**/*.php" />
                 •     </copy>




Sunday, 20 June 2010
Phing: Filesystem
                          Transformation
                 • Other kind of mappers present:
                       • Flatten Mapper: Gets base filename
                       • Regex Mapper: Changes filenames
                         based on regular expressions
                       • Merge Mapper: change all source
                         filenames to the same name


Sunday, 20 June 2010
Phing: Data
                            Transformation
                 • <filterchain> is used to transform the
                       contents of the file. Supported by many tasks
                       like <copy>, <move> etc

                 • Can perform various actions:
                       • Strip comments from your files
                       • Replace values in your file
                       • Perform XSLT Transformations
                       • Above all your chain these transformations

Sunday, 20 June 2010
Phing: Data
                             Transformation
                       <copy todir="${build}/htdocs">
                       	 <fileset includes="*.html" />
                       	 <filterchain>
                       	 	 <replaceregexp>
                       	 	 	 <regexp pattern="rn" replace="n" />
                       	 	 </replaceregexp>
                       	 	 <tidyfilter encoding="utf8">
                       	 	 	 <config name="indent" value="true" />
                       	 	 </tidyfilter>
                       	 </filterchain>
                       </copy>




Sunday, 20 June 2010
Phing: Data
                            Transformation
                 • <headfilter> Reads only the first n lines of the file
                 • <linecontains> Filters out lines that contain a
                       specific word
                 • <linecontainsregexp> Filters out lines that
                       contain a specific regular expression

                 • <prefixlines> Adds stuff to the lines of the
                       selected files
                 • <tabtospaces> Converts tabs to spaces
                       (HURRAH!!)


Sunday, 20 June 2010
Phing: More Data
                          Transformations

                 • <StripPHPComments> Takes out php
                       comments
                 • <replaceregexp>
                 • <replacetokens> This can particularly
                       be handy for spec files



Sunday, 20 June 2010
Phing: Data
                           Transformations
                 • Consider a file that contains:
                       The current user is ##current_user##
                 • Use this build target to replace the
                       token
                       <property environment="env" />
                       <filterchain>
                       	 <replacetokens begintoken="##" endtoken="##">
                       	 	 <token key="CURRENT" value="${env.LOGNAME}" />
                       	 <replacetoken>
                       </filterchain>




Sunday, 20 June 2010
Phing: Packaging


                 • Tasks like <tar> <zip> can compress
                       and package the set of files you want
                       to compress

                 • <pearpkg> and <pearpkg2> allows you
                       to build pear package using phing




Sunday, 20 June 2010
Phing: Version Control
                          and Deployment
                 • <svn*> tasks provide support for subversion:
                       • <svncheckout>
                       • <svncommit>
                       • <svnexport>
                       • <svnlastrevision>
                 • <scp> to move files to another server
                 • Support for CSV also present

Sunday, 20 June 2010
Phing: Support for DB
                            Migration
                 • <pdosqlexec> and <creole> provides
                       execution of database statements
                 • <dbdeploy> can take care of db
                       migrations
                       http://dbdeploy.com/documentation/getting-started/rules-for-
                       using-dbdeploy/


                 • Drupal Deployment solution anyone?


Sunday, 20 June 2010
Phing: Validating Code

                 • <jslint> using an external utility jsl
                 • <xmllint> uses internal DOM support
                       for validating against given schema
                       file

                 • <phplint> just uses php -l
                 • <tidy> can be use to validate markup
                       and cleanup html


Sunday, 20 June 2010
Phing: Php API Docs

                 • Support for phpDocumentor
                       <phpdoc title="API Documentation"
                         destdir="apidocs" sourcecode="no"
                         output="HTML:Smarty:PHP">
                         <fileset dir="./classes">
                            <include name="**/*.php" />
                         </fileset>
                       </phpdoc>




Sunday, 20 June 2010
Phing: Extending
                            Functionalities
                 • Two ways to extend Phing:
                       • Embed PHP in the build file itself (not the cleanest
                          solution)

                       • Write your own class to provide any of the following
                          functioanlity:
                         • Task
                         • Type
                         • Selector
                         • Filter
                         • and more...


Sunday, 20 June 2010
Phing: Extending
                            Functionality
                 • <phpevaltask> lets you set a property
                       to the results of evaluating a PHP
                       Expression or the results by a
                       function call.
                       <php function="crypt" returnProperty="enc_passwd">
                         <param value="${auth.root_passwd}"/>
                       </php>

                       <php expression="3 + 4" returnProperty="sum"/>
                       <php expression="echo 'test';">




Sunday, 20 June 2010
Phing: Extending
                           Functionality


                 • <adhoc-task> allows you to define a
                       task within your build file.




Sunday, 20 June 2010
Phing: Extending
                           Functionality
                  <target name="main"
                          description="==>test AdhocTask ">
                  	 	
                  	 	 <adhoc-task name="foo"><![CDATA[
                  	 	 	 class FooTest extends Task {
                  	 	 	 	 private $bar;
                  	 	 	 	
                  	 	 	 	 function setBar($bar) {
                  	 	 	 	 	 $this->bar = $bar;
                  	 	 	 	 }
                  	 	 	 	
                  	 	 	 	 function main() {
                  	 	 	 	 	 $this->log("In FooTest: " . $this->bar);
                  	 	 	 	 }
                  	 	 	 }
                  	 	 ]]></adhoc-task>
                  	
                  	 	 <foo bar="B.L.I.N.G"/>
                  </target>




Sunday, 20 June 2010
Phing: Scripting & Logic
                 • Phing also supports conditional tags
                       <if>
                        <equals arg1="${foo}" arg2="bar" />
                        <then>
                          <echo message="The value of property foo is
                       'bar'" />
                        </then>
                        </elseif>
                        <else>
                          <echo message="The value of property foo is not
                       'foo' or 'bar'" />
                        </else>
                       </if>




Sunday, 20 June 2010
Phing: Writing a custom
                    task
                require_once "phing/Task.php";
                class MyEchoTask extends Task {
                     /**
                       * The message passed in the buildfile.
                       */
                     private $message = null;
                     /**
                       * The setter for the attribute "message"
                       */
                     public function setMessage($str) {
                          $this->message = $str;
                     }
                     /**
                       * The init method: Do init steps.
                       */
                     public function init() {
                        // nothing to do here
                     }
                     /**
                       * The main entry point method.
                       */
                     public function main() {
                        print($this->message);
Sunday, 20 June 2010 }
Phing: Using the
                         <myecho> task
             <?xml version="1.0" ?>
             <project name="test" basedir="." default="myecho">
                 <taskdef name="myecho"
             classname="phing.tasks.my.MyEcho" />

                 <target name="test.myecho">
                   <myecho message="Hello World" />
                 </target>
             </project>




Sunday, 20 June 2010
What Next?
                  F    P       C   I
                               P




Sunday, 20 June 2010
Questions?




Sunday, 20 June 2010

Weitere ähnliche Inhalte

Was ist angesagt?

Modern iframe programming
Modern iframe programmingModern iframe programming
Modern iframe programmingbenvinegar
 
Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Chris McEniry
 
How to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addonsHow to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addonsLeevi Graham
 
Automation with phing
Automation with phingAutomation with phing
Automation with phingJoey Rivera
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIPaul Withers
 
Web micro-framework BATTLE!
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!Richard Jones
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPressMarko Heijnen
 
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi   SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi Sencha
 

Was ist angesagt? (9)

Modern iframe programming
Modern iframe programmingModern iframe programming
Modern iframe programming
 
Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015Go for SysAdmins - LISA 2015
Go for SysAdmins - LISA 2015
 
How to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addonsHow to start developing your own ExpressionEngine addons
How to start developing your own ExpressionEngine addons
 
Epub ppt
Epub pptEpub ppt
Epub ppt
 
Automation with phing
Automation with phingAutomation with phing
Automation with phing
 
DanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino APIDanNotes 2013: OpenNTF Domino API
DanNotes 2013: OpenNTF Domino API
 
Web micro-framework BATTLE!
Web micro-framework BATTLE!Web micro-framework BATTLE!
Web micro-framework BATTLE!
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPress
 
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi   SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
SenchaCon 2016: The Modern Toolchain - Ross Gerbasi
 

Andere mochten auch

I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your testsI.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your testsNicolas Fränkel
 
Get Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsGet Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsDavey Shafik
 
Techniques d'accélération des pages web
Techniques d'accélération des pages webTechniques d'accélération des pages web
Techniques d'accélération des pages webJean-Pierre Vincent
 
Electrify your code with PHP Generators
Electrify your code with PHP GeneratorsElectrify your code with PHP Generators
Electrify your code with PHP GeneratorsMark Baker
 
The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)Matthias Noback
 
Top tips my_sql_performance
Top tips my_sql_performanceTop tips my_sql_performance
Top tips my_sql_performanceafup Paris
 
Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015Marcello Duarte
 
Why elasticsearch rocks!
Why elasticsearch rocks!Why elasticsearch rocks!
Why elasticsearch rocks!tlrx
 
Writing infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQLWriting infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQLGabriele Bartolini
 
Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Bruno Boucard
 
L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)Arnauld Loyer
 
Performance serveur et apache
Performance serveur et apachePerformance serveur et apache
Performance serveur et apacheafup Paris
 
TDD with PhpSpec - Lone Star PHP 2016
TDD with PhpSpec - Lone Star PHP 2016TDD with PhpSpec - Lone Star PHP 2016
TDD with PhpSpec - Lone Star PHP 2016CiaranMcNulty
 
The Wonderful World of Symfony Components
The Wonderful World of Symfony ComponentsThe Wonderful World of Symfony Components
The Wonderful World of Symfony ComponentsRyan Weaver
 

Andere mochten auch (20)

I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your testsI.T.A.K.E Unconference - Mutation testing to the rescue of your tests
I.T.A.K.E Unconference - Mutation testing to the rescue of your tests
 
Get Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP StreamsGet Soaked - An In Depth Look At PHP Streams
Get Soaked - An In Depth Look At PHP Streams
 
Elastic Searching With PHP
Elastic Searching With PHPElastic Searching With PHP
Elastic Searching With PHP
 
Techniques d'accélération des pages web
Techniques d'accélération des pages webTechniques d'accélération des pages web
Techniques d'accélération des pages web
 
Diving deep into twig
Diving deep into twigDiving deep into twig
Diving deep into twig
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
 
Electrify your code with PHP Generators
Electrify your code with PHP GeneratorsElectrify your code with PHP Generators
Electrify your code with PHP Generators
 
The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)The quest for global design principles (SymfonyLive Berlin 2015)
The quest for global design principles (SymfonyLive Berlin 2015)
 
Top tips my_sql_performance
Top tips my_sql_performanceTop tips my_sql_performance
Top tips my_sql_performance
 
Mocking Demystified
Mocking DemystifiedMocking Demystified
Mocking Demystified
 
Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015Understanding Craftsmanship SwanseaCon2015
Understanding Craftsmanship SwanseaCon2015
 
Why elasticsearch rocks!
Why elasticsearch rocks!Why elasticsearch rocks!
Why elasticsearch rocks!
 
Writing infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQLWriting infinite scalability web applications with PHP and PostgreSQL
Writing infinite scalability web applications with PHP and PostgreSQL
 
Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015Si le tdd est mort alors pratiquons une autopsie mix-it 2015
Si le tdd est mort alors pratiquons une autopsie mix-it 2015
 
L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)L'ABC du BDD (Behavior Driven Development)
L'ABC du BDD (Behavior Driven Development)
 
Performance serveur et apache
Performance serveur et apachePerformance serveur et apache
Performance serveur et apache
 
Caching on the Edge
Caching on the EdgeCaching on the Edge
Caching on the Edge
 
Behat 3.0 meetup (March)
Behat 3.0 meetup (March)Behat 3.0 meetup (March)
Behat 3.0 meetup (March)
 
TDD with PhpSpec - Lone Star PHP 2016
TDD with PhpSpec - Lone Star PHP 2016TDD with PhpSpec - Lone Star PHP 2016
TDD with PhpSpec - Lone Star PHP 2016
 
The Wonderful World of Symfony Components
The Wonderful World of Symfony ComponentsThe Wonderful World of Symfony Components
The Wonderful World of Symfony Components
 

Ähnlich wie Automation using-phing

Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with PhingMichiel Rook
 
Putting "Phings" together - how to automate your life
Putting "Phings" together - how to automate your lifePutting "Phings" together - how to automate your life
Putting "Phings" together - how to automate your lifeBoyan Borisov
 
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 PhingMichiel Rook
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP ApplicationsPavan Kumar N
 
Large Files without the Trials
Large Files without the TrialsLarge Files without the Trials
Large Files without the TrialsJazkarta, Inc.
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4John Ballinger
 
"How Mozilla Uses Selenium"
"How Mozilla Uses Selenium""How Mozilla Uses Selenium"
"How Mozilla Uses Selenium"Stephen Donner
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIOliver Busse
 
The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An IntroductionJeff Fox
 
Automating Web Application Deployment
Automating Web Application DeploymentAutomating Web Application Deployment
Automating Web Application DeploymentMathew Byrne
 
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...Nagios
 
アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編
アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編
アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編Hiroki Ohtsuka
 
OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...
OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...
OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...NETWAYS
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIOliver Busse
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumBen Ramsey
 
IS - section 1 - modifiedFinal information system.pptx
IS - section 1 - modifiedFinal information system.pptxIS - section 1 - modifiedFinal information system.pptx
IS - section 1 - modifiedFinal information system.pptxNaglaaAbdelhady
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011Bachkoutou Toutou
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Michael Lihs
 

Ähnlich wie Automation using-phing (20)

Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
 
Putting "Phings" together - how to automate your life
Putting "Phings" together - how to automate your lifePutting "Phings" together - how to automate your life
Putting "Phings" together - how to automate your life
 
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
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
Large Files without the Trials
Large Files without the TrialsLarge Files without the Trials
Large Files without the Trials
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
 
"How Mozilla Uses Selenium"
"How Mozilla Uses Selenium""How Mozilla Uses Selenium"
"How Mozilla Uses Selenium"
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
 
The Dojo Toolkit An Introduction
The Dojo Toolkit   An IntroductionThe Dojo Toolkit   An Introduction
The Dojo Toolkit An Introduction
 
Automating Web Application Deployment
Automating Web Application DeploymentAutomating Web Application Deployment
Automating Web Application Deployment
 
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
Nagios Conference 2014 - Mike Merideth - The Art and Zen of Managing Nagios w...
 
Railsconf 2010
Railsconf 2010Railsconf 2010
Railsconf 2010
 
アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編
アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編
アジャイルな開発をチームで やってみた(2010年版) - PHP Matsuri編
 
OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...
OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...
OSMC 2009 | Nagios Plugins: New features and future projects by Thomas Guyot-...
 
Utilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino APIUtilizing the OpenNTF Domino API
Utilizing the OpenNTF Domino API
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
 
IS - section 1 - modifiedFinal information system.pptx
IS - section 1 - modifiedFinal information system.pptxIS - section 1 - modifiedFinal information system.pptx
IS - section 1 - modifiedFinal information system.pptx
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
Oscon 2010
Oscon 2010Oscon 2010
Oscon 2010
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 

Kürzlich hochgeladen

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 

Kürzlich hochgeladen (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 

Automation using-phing

  • 1. Automation Using Phing rajat_pandit@ipcmedia.com Sunday, 20 June 2010
  • 2. What is phing • Phing Is Not Gnumake • Its a project build tool • Based on Apache Ant • Cross Platform (Runs everywhere php works) • Lots of projects using it (Propel, Xinc, symfony, prada) Sunday, 20 June 2010
  • 3. No compiling involved, so what does it build? • Automation of non-development tasks • Configuring • Packaging • Uploading to remote servers • Testing Sunday, 20 June 2010
  • 4. More automation... • Run unit tests for you and publish reports • Build API Docs • Package and / or install PEAR packages • Environment Setup • App Configuration Sunday, 20 June 2010
  • 5. More automation... • setting up permissions • environment setup • app config • basically anywhere you can script, you can use phing Sunday, 20 June 2010
  • 6. Other Alternatives available • Quite a few options available: • ANT, Rake, NAnt • Why Phing then? • Dev already familiar with the language • You can embed php straight in your build script • Custom extensions are easy to write • Works across platforms, small footprint Sunday, 20 June 2010
  • 7. Phing: Basics • Task: Built in custom piece of code to perform a specific function • Target: Grouping of tasks to perform a more general function • Project: Root node of build files containing one or more targets Sunday, 20 June 2010
  • 8. Phing: Sample Build File <project name="trustedreviews" default="main"> <property name="ver" value="1.0.1" <property file="build.properties" /> <target name="main"> <mkdir dir="./build/${ver}"> <copy todir="./build/${veer}"> <fileset dir="." includes="*.txt" /> </copy> </target> </project> Sunday, 20 June 2010
  • 9. Phing: Selecting a bunch of files • <fileset> is used to represent a bunch of files to do stuff with • Many tasks support <fileset> <fileset dir="/foo" includes="**/*.html" excludes="**/test-*" /> <fileset dir="/bla"> <includes name="img/${theme}/*.jpg" /> <includes name="js/*.js" /> • </fileset> Sunday, 20 June 2010
  • 10. Phing: Fine tuning the selection • You might need to fine tune your file selection further: • Filter on date range? • Filter on file size • Type (File or Directory) • At a particular depth Sunday, 20 June 2010
  • 11. Phing: Fine tuning the selection <fileset dir="${htdocs.dir}"> <includes name="**/*.html" /> <containsregexp expression="/prodd+.php" /> </fileset> <fileset dir="${dist}" includes="**"> <or> <present targetdir="${htdocs}" /> <date datetime="01/01/2010" when="before" /> </or> </fileset> Sunday, 20 June 2010
  • 12. Phing: Filesystem Transformation • <mapper> element adds filesystem transformation capabilities for tasks that support it e.g. <copy>, <move> etc <copy todir="/tmp"> <mapper type="glob" from="*.php" to="*.php.bak" /> <fileset dir="./app" includes="**/*.php" /> • </copy> Sunday, 20 June 2010
  • 13. Phing: Filesystem Transformation • Other kind of mappers present: • Flatten Mapper: Gets base filename • Regex Mapper: Changes filenames based on regular expressions • Merge Mapper: change all source filenames to the same name Sunday, 20 June 2010
  • 14. Phing: Data Transformation • <filterchain> is used to transform the contents of the file. Supported by many tasks like <copy>, <move> etc • Can perform various actions: • Strip comments from your files • Replace values in your file • Perform XSLT Transformations • Above all your chain these transformations Sunday, 20 June 2010
  • 15. Phing: Data Transformation <copy todir="${build}/htdocs"> <fileset includes="*.html" /> <filterchain> <replaceregexp> <regexp pattern="rn" replace="n" /> </replaceregexp> <tidyfilter encoding="utf8"> <config name="indent" value="true" /> </tidyfilter> </filterchain> </copy> Sunday, 20 June 2010
  • 16. Phing: Data Transformation • <headfilter> Reads only the first n lines of the file • <linecontains> Filters out lines that contain a specific word • <linecontainsregexp> Filters out lines that contain a specific regular expression • <prefixlines> Adds stuff to the lines of the selected files • <tabtospaces> Converts tabs to spaces (HURRAH!!) Sunday, 20 June 2010
  • 17. Phing: More Data Transformations • <StripPHPComments> Takes out php comments • <replaceregexp> • <replacetokens> This can particularly be handy for spec files Sunday, 20 June 2010
  • 18. Phing: Data Transformations • Consider a file that contains: The current user is ##current_user## • Use this build target to replace the token <property environment="env" /> <filterchain> <replacetokens begintoken="##" endtoken="##"> <token key="CURRENT" value="${env.LOGNAME}" /> <replacetoken> </filterchain> Sunday, 20 June 2010
  • 19. Phing: Packaging • Tasks like <tar> <zip> can compress and package the set of files you want to compress • <pearpkg> and <pearpkg2> allows you to build pear package using phing Sunday, 20 June 2010
  • 20. Phing: Version Control and Deployment • <svn*> tasks provide support for subversion: • <svncheckout> • <svncommit> • <svnexport> • <svnlastrevision> • <scp> to move files to another server • Support for CSV also present Sunday, 20 June 2010
  • 21. Phing: Support for DB Migration • <pdosqlexec> and <creole> provides execution of database statements • <dbdeploy> can take care of db migrations http://dbdeploy.com/documentation/getting-started/rules-for- using-dbdeploy/ • Drupal Deployment solution anyone? Sunday, 20 June 2010
  • 22. Phing: Validating Code • <jslint> using an external utility jsl • <xmllint> uses internal DOM support for validating against given schema file • <phplint> just uses php -l • <tidy> can be use to validate markup and cleanup html Sunday, 20 June 2010
  • 23. Phing: Php API Docs • Support for phpDocumentor <phpdoc title="API Documentation" destdir="apidocs" sourcecode="no" output="HTML:Smarty:PHP"> <fileset dir="./classes"> <include name="**/*.php" /> </fileset> </phpdoc> Sunday, 20 June 2010
  • 24. Phing: Extending Functionalities • Two ways to extend Phing: • Embed PHP in the build file itself (not the cleanest solution) • Write your own class to provide any of the following functioanlity: • Task • Type • Selector • Filter • and more... Sunday, 20 June 2010
  • 25. Phing: Extending Functionality • <phpevaltask> lets you set a property to the results of evaluating a PHP Expression or the results by a function call. <php function="crypt" returnProperty="enc_passwd"> <param value="${auth.root_passwd}"/> </php> <php expression="3 + 4" returnProperty="sum"/> <php expression="echo 'test';"> Sunday, 20 June 2010
  • 26. Phing: Extending Functionality • <adhoc-task> allows you to define a task within your build file. Sunday, 20 June 2010
  • 27. Phing: Extending Functionality <target name="main" description="==>test AdhocTask "> <adhoc-task name="foo"><![CDATA[ class FooTest extends Task { private $bar; function setBar($bar) { $this->bar = $bar; } function main() { $this->log("In FooTest: " . $this->bar); } } ]]></adhoc-task> <foo bar="B.L.I.N.G"/> </target> Sunday, 20 June 2010
  • 28. Phing: Scripting & Logic • Phing also supports conditional tags <if> <equals arg1="${foo}" arg2="bar" /> <then> <echo message="The value of property foo is 'bar'" /> </then> </elseif> <else> <echo message="The value of property foo is not 'foo' or 'bar'" /> </else> </if> Sunday, 20 June 2010
  • 29. Phing: Writing a custom task require_once "phing/Task.php"; class MyEchoTask extends Task { /** * The message passed in the buildfile. */ private $message = null; /** * The setter for the attribute "message" */ public function setMessage($str) { $this->message = $str; } /** * The init method: Do init steps. */ public function init() { // nothing to do here } /** * The main entry point method. */ public function main() { print($this->message); Sunday, 20 June 2010 }
  • 30. Phing: Using the <myecho> task <?xml version="1.0" ?> <project name="test" basedir="." default="myecho"> <taskdef name="myecho" classname="phing.tasks.my.MyEcho" /> <target name="test.myecho"> <myecho message="Hello World" /> </target> </project> Sunday, 20 June 2010
  • 31. What Next? F P C I P Sunday, 20 June 2010