• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Automation with phing
 

Automation with phing

on

  • 2,095 views

Presentation for Codeworks 2012 Atlanta. This presentation went through what Phing is, how to set it up, example, and how we implemented it with our applications.

Presentation for Codeworks 2012 Atlanta. This presentation went through what Phing is, how to set it up, example, and how we implemented it with our applications.

Statistics

Views

Total Views
2,095
Views on SlideShare
1,953
Embed Views
142

Actions

Likes
6
Downloads
18
Comments
0

6 Embeds 142

http://www.joeyrivera.com 116
https://twitter.com 22
https://si0.twimg.com 1
http://tweetedtimes.com 1
http://twitter.com 1
http://www.twylah.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Symbolizes we are not perfect.
  • No challenge in manual busy work. Less attention given.
  • At the end you get faster, more efficient processes, with less errors.
  • Branching, Tagging, and several standalone servers for their own purpose.
  • Saves you time, don’t need to reinvent the wheel
  • not build file passed defaults to build.xml in current dirno target name passed defaults to project default target in build file
  • logical grouping of tasks to achieve a goalmultiple depends with comma delimited
  • Where the real work happens.Optional are installed through dependencies.You can create your own which will be covered later.
  • Mention override=“true” to override property values.
  • Excludes allows excluding files, class, and methods.
  • ExpandProperty great to replace environment specific variablesFlatten remove directory from filename.Glob is copy/rename.RegExp replaces filename using expression.
  • Can also have elseif and else.
  • Talk about ssh keys for scp/ssh
  • Good when there isn’t a task you need - and rather not create your own.
  • Obfuscation.
  • All cron’d but Prod
  • Lean mean fighting machine.

Automation with phing Automation with phing Presentation Transcript

  • Presented by Joey Rivera
  • Introduction• Joey Rivera• Manger of Technology Development at Cengage Learning• http://www.joeyrivera.com• @joeyrivera
  • Summary• Why we need Phing• Installing and Usage• Extending• Examples• Our implementations
  • Problem http://www.seniorark.com/Humor/Double%20Takes/crooked%20line.gif
  • Problem Cont.• We make mistakes• Manual process can be time consuming• Busy work is no fun
  • Our Goals• Identify manual process at work – daily, weekly, monthly processes• Analyze amount of time spent on those• Automate them
  • Our Before
  • Our After
  • Phing is• PHing Is Not GNU make• Build tool based on Ant• XML based build files• Written in PHP5• Flexible and extendable• Platform independent
  • Why Phing• Automation• Save time• Less errors• Tons of built-in tasks and features
  • Install• http://www.phing.info• PEAR install – pear channel-discover pear.phing.info – pear install phing/phing – Get necessary dependencies• Non-PEAR Install – Download – Configure multiple env variables
  • Dependencies http://www.phing.info/docs/guide/stable/
  • Using Phing• Command line – phing -v – phing -f buildfile – phing -f buildfile targetname – phing – phing -l – phing -debug
  • Build File• XML file – Project – Targets – Tasks – Types and properties – Filters – Mappers – Conditions
  • Example Build File http://www.phing.info/docs/guide/stable/
  • Project Node• Requires one per build.xml• Requires a default target declaration• Optional attributes: – name – basedir – description
  • Targets• Grouping of tasks• Can depend on other tasks
  • Tasks• Single piece of executable code• Core: – Copy, Delete, Echo, Exec, Mo ve, Foreach, and more• Optional: – FtpDeploy, GitPush, PDOSQL Exec, Scp, Zip, and more
  • Properties• Variables• global vs. target specific• Declaration – inline – external file – input
  • Built-in Properties http://www.phing.info/docs/guide/stable/
  • Property File• Text file Example:• Good way to organize variables into one location• Useful for environment specific files
  • Types• Used within a task Example:• More complex data variables – FileSet • PatternSet • * vs. ** – Excludes
  • Filters and Mappers• Filters Transform data/file contents within a task – Tidy – ExpandProperty – StripPhpComments• Mappers are like filters for files and directories – Flatten – Glob – RegExp
  • Conditions• Used through the following two tasks: Example: – condition – if• Compare using – equals – isset – contrains – istrue – available• Can nest – or – and – not
  • Extending $PHING_HOME |-- bin |-- classes• Can extend | `-- phing | |-- filters | | `-- util – Tasks | |-- mappers – Types | | |-- parser |-- tasks – Mappers | | |-- ext | | |-- system – Ad hoc | | | `-- condition | | `-- user | `-- types |-- docs | `-- phing_guide `-- test |-- classes `-- etc
  • Custom Task http://www.phing.info/docs/guide/stable/
  • Examples• Version Control• Packaging• Unit Testing• Documentation• Deployment• DbDeploy• Exec
  • Version Control• SVN• Git
  • Packaging• Tar• Zip• PharPackage
  • Unit Testing• PhpUnit• PhpUnitReport
  • Documentation• PhpDocumentor2 – http://www.phpdoc.org/
  • Documentation Cont.
  • Deploying• Copy• Scp• FtpDeploy
  • Database Deployment• DbDeploy – Database change management tool – Creates script file based on deltas – Tracks db version – Easy to move version forward or backwards – http://dbdeploy.com/
  • DbDeploy cont.• Create changelog table http://www.phing.info/docs/guide/stable/
  • DbDeploy ExampleDeltas – each representing Deploy file after running DbDeploy a version
  • DbDeploy Delta Example
  • Other• Exec – Can run any system command – OS specific
  • Our Implementation• Restoring our DB’s• Automate SVN Exports• Automate Tagging
  • Restoring DB’s• Dev, Test, Staging, QA, Prod• Environment specific data
  • Automate SVN Exports• Trunk to Dev – Export diff between last rev and newest rev• ‘Release’ Branch to Testing – Export diff between last rev and newest rev• Tag to Staging, QA, Prod – Export diff between last tag and newest tag
  • Tagging• From branch to Tag – Diff between rev of last release and last tag of the same iteration
  • Before < After
  • Resources• http://www.phing.info/docs/guide/stable/• http://dbdeploy.com/• http://www.phpdoc.org/
  • Thanks!• http://www.joeyrivera.com• @joeyrivera• Special thanks to my wife Ashley Rivera (http://cargocollective.com/ashleyrivera ) for the graphics and template.