SlideShare a Scribd company logo
CodeIgniter
Ant Scripting
Topic
• What is Ant?
• Why use Ant?
• How can we use Ant?
• How to stream development with Ant?
CodeIgniter Ant Scripting
What Is Ant?
• Ant is a Java-based build tool. In theory, it is kind
of like make, without make's wrinkles.
• Ant is different. Instead of a model where it is
extended with shell-based commands, Ant is
extended using Java classes. Instead of writing
shell commands, the configuration files are XML-
based, calling out a target tree where various
tasks get executed. Each task is run by an object
that implements a particular Task interface.
So If Ant is Java why do we want to use
it for PHP
• Well Ideally Ant was used to stream line build
and compilation with Java in response to
Make.
• With the way Ant is, it can be used in any
automation we want as long as all the
requirements used in the automation are
already installed
– We can’t use something we don’t have ;-)
Installing Ant
• Ant can be downloaded from:
http://ant.apache.org
• Most Current IDE come with Ant Pre-installed
– My Personal Preference NETBEANS IDE
– Other’s like Eclipse …. (WHY????)
• MAC OS ant is pre-installed, UBUNTU also, but
always update ;-) …
Ant Task… huh?
• Ant has a ton of task both built in and
downloadable.
• Ant Task are “actions” to be done in the Ant
Script.
Ant Task Buckets:
Archive Tasks
Audit/Coverage Tasks
Compile Tasks
Deployment Tasks
Documentation Tasks
EJB Tasks
Execution Tasks
File Tasks
Java2 Extensions Tasks
Logging Tasks
Mail Tasks
Miscellaneous Tasks
Pre-process Tasks
Property Tasks
Remote Tasks
SCM Tasks
Testing Tasks
The Ant Build File
<!-- this is an ant script to build the project and
information -->
<project name=”Demo" default="freshBuild"
basedir=".">
<description>
This is the ant script to build demo this has the
ability to clean the build, create a Code Report,
Run Unit Tests and Build Documentation
</description>
Ant Properties…
• <property name="docs" location="docs" />
• <property name="applicationDocs" location="${docs}/application"/>
• <property name="libraryDocs" location="${docs}/library" />
• <property name="reports" location="reports"/>
• <property name="sniffer" location="${reports}/sniffer" />
• <property name="applicationReports" location="${reports}/application" />
• <property name="libraryReports" location="${reports}/library" />
• <property name="build" location="build" />
• <property name="tests" location="tests" />
Ant Cleaning…
• <!-- this will create a clean working environment -->
• <target name="clean">
• <echo message="Clearing the folders"/>
• <delete dir="${applicationDocs}"/>
• <delete dir="${libraryDocs}" />
• <delete dir="${reports}" />
• <delete dir="${build}" />
• <echo message="Creating the folders" />
• <mkdir dir="${applicationDocs}" />
• <mkdir dir="${libraryDocs}" />
• <mkdir dir="${reports}" />
• <mkdir dir="${sniffer}" />
• <mkdir dir="${applicationReports}" />
• <mkdir dir="${libraryReports}" />
• <mkdir dir="${build}" />
• </target>
Ant Clean Cont….
• <target name="cleanProject">
• <echo message="Clearing the folders"/>
• <delete dir="${applicationDocs}"/>
• <delete dir="${libraryDocs}" />
• <delete dir="${reports}" />
• <delete dir="${build}" />
• </target>
Ant Code Sniffing…
• <!-- code sniffer -->
• <target name="codeSniff">
• <echo message="Started Sniffing code" />
• <echo message="Sniffing Library" />
• <exec executable="phpcs" output="${sniffer}/library.sniffer.txt">
• <arg value="${NoteLib}"/>
• <arg value="--standard=ZEND"/>
• <arg value="--report=full" />
• <arg value="-n"/>
• </exec>
• <echo message="Sniffing Application" />
• <exec executable="phpcs" output="${sniffer}/application.sniffer.txt">
• <arg value="${application}" />
• <arg value="--standard=ZEND" />
• <arg value="--report=full" />
• <arg value="-n" />
• </exec>
• <echo message="Finished Sniffing the Code" />
• </target>
Ant Documenting …
• <!-- PHP DOCUMENTATION -->
• <target name="document">
• <echo message="Started Documenting the code" />
• <echo message="Documenting the Application" />
• <exec executable="phpdoc" output="${docs}/application.doc.result.txt">
• <arg line="
• --target ${applicationDocs}
• --directory ${application}
• --title 'Note In A Bottle Application Documentation'
• --undocumentedelements on
• -i *.phtml
• --defaultpackagename 'NoteInBottleApp'
• "/>
• </exec>
Ant Documenting cont…
• <echo message="Documenting the Application's Library" />
• <exec executable="phpdoc"
output="${docs}/application.doc.result.txt">
• <arg line="
• --target ${libraryDocs}
• --directory ${NoteLib}
• --title 'Note In A Bottle Library Documentation'
• --undocumentedelements on
• --defaultpackagename 'NoteInBottle'
• "/>
• </exec>
• <echo message="Finished Documenting the code" />
• </target>
Ant Fresh Build….
• <target name="freshBuild" depends="clean,
codeSniff, unitTesting, document”>
• </target>
Ant Copy to Server…
• <target name="copyToTestServer">
• <exec executable="cp" output="${docs}/cp.result.txt">
• <arg line="
• -R
• /Users/albertrosa/Sites/Demo/
/Volumes/www/Demo/
• "/>
• </exec>
• <echo message="copied"/>
• </target>
UMMM…. Ok but how does it work…
• So you see how the ant xml file looks, you know
the buckets that are included with Ant and you
have an idea of how you want your build to go ….
SO how do you use it?
• Simple… in your Terminal / command prompt /
console navigate to the build file ohh wait I didn’t
tell you where the build file should go huh…. Well
I always place it at the root of the site so all my
paths are relative to that root.
But really now how to build it….
• Once you have navigated to the desired location
all that is left to do is run the command as follows
ant <target name>
Yep that’s all … so each target is an “task” you can
do. But recall the freshBuild target .. That had
depends as an attribute. Well those depends are
all ran when you execute “ant freshBuild”
Basic errors most commonly found
• Ant depends orders – if some targets need
something to happen first that should happen
before that task is executed
• You are using a ant task that isn’t installed
• You action is producing an error and causes
the execution to terminate
• You run out of memory :-D rare but possible
on many large scale projects.
THANKS
• Thanks go to ROKKAN for providing us with
the Conference space.
General Info
• My Email: albert@albert-rosa.com
• AIM: albertrosa2000
• Meetup: www.meetup.com/codeigniter/
• Rokkan: www.rokkan.com
Sources
• http://ant.apache.org/

More Related Content

What's hot (20)

PDF
Unit-testing and E2E testing in JS
Michael Haberman
 
PDF
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Cogapp
 
PPTX
Test automation with php codeception
buddhieash
 
PDF
Unit testing for WordPress
Harshad Mane
 
PDF
Effective testing with pytest
Hector Canto
 
PPTX
Test-Driven JavaScript Development (JavaZone 2010)
Christian Johansen
 
PDF
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Ondřej Machulda
 
PPTX
CI / CD w/ Codeception
Tudor Barbu
 
PDF
PHP-VCR behat case study
Pascal Thormeier
 
PPTX
Selenium Open Source Tool
onlinemindq
 
PDF
Testing with Codeception (Webelement #30)
Adam Štipák
 
PDF
Intro to testing Javascript with jasmine
Timothy Oxley
 
PPTX
Laravel Unit Testing
Dr. Syed Hassan Amin
 
PPTX
Jasmine with JS-Test-Driver
Devesh Chanchlani
 
PDF
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
PDF
Codeception: introduction to php testing
Engineor
 
ODP
Automated ui testing with selenium. drupal con london 2011
Yuriy Gerasimov
 
PDF
Painless JavaScript Testing with Jest
Michał Pierzchała
 
PDF
Automated Web Testing using JavaScript
Simon Guest
 
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 
Unit-testing and E2E testing in JS
Michael Haberman
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Cogapp
 
Test automation with php codeception
buddhieash
 
Unit testing for WordPress
Harshad Mane
 
Effective testing with pytest
Hector Canto
 
Test-Driven JavaScript Development (JavaZone 2010)
Christian Johansen
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Ondřej Machulda
 
CI / CD w/ Codeception
Tudor Barbu
 
PHP-VCR behat case study
Pascal Thormeier
 
Selenium Open Source Tool
onlinemindq
 
Testing with Codeception (Webelement #30)
Adam Štipák
 
Intro to testing Javascript with jasmine
Timothy Oxley
 
Laravel Unit Testing
Dr. Syed Hassan Amin
 
Jasmine with JS-Test-Driver
Devesh Chanchlani
 
Join the darkside: Selenium testing with Nightwatch.js
Seth McLaughlin
 
Codeception: introduction to php testing
Engineor
 
Automated ui testing with selenium. drupal con london 2011
Yuriy Gerasimov
 
Painless JavaScript Testing with Jest
Michał Pierzchała
 
Automated Web Testing using JavaScript
Simon Guest
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Ondřej Machulda
 

Similar to CodeIgniter Ant Scripting (20)

PPT
Intro to-ant
Manav Prasad
 
PPT
Ant
Manav Prasad
 
PPT
Apache Ant
Rajesh Kumar
 
PPTX
Apache ant
koniik
 
PPT
Using Ant To Build J2 Ee Applications
Rajesh Kumar
 
PPT
Introduction To Ant1
Rajesh Kumar
 
PPTX
Apache ant
Yuriy Galavay
 
PPT
Apache Ant
Vinod Kumar V H
 
PPT
Ant - Another Neat Tool
Kanika2885
 
PPT
Ant - Another Neat Tool
Kanika2885
 
PDF
Ant_quick_guide
ducquoc_vn
 
PDF
Ant tutorial
Ratnesh Kumar Singh
 
PDF
Java ant tutorial
Ashoka Vanjare
 
PDF
Deploy Flex with Apache Ant
dctrl — studio for creativ technology
 
PDF
Build Scripts
Ólafur Andri Ragnarsson
 
PPTX
Apache Ant
Ali Bahu
 
PPTX
Apache Ant
Ali Bahu
 
PDF
Introduction to Apache Ant
Shih-Hsiang Lin
 
Intro to-ant
Manav Prasad
 
Apache Ant
Rajesh Kumar
 
Apache ant
koniik
 
Using Ant To Build J2 Ee Applications
Rajesh Kumar
 
Introduction To Ant1
Rajesh Kumar
 
Apache ant
Yuriy Galavay
 
Apache Ant
Vinod Kumar V H
 
Ant - Another Neat Tool
Kanika2885
 
Ant - Another Neat Tool
Kanika2885
 
Ant_quick_guide
ducquoc_vn
 
Ant tutorial
Ratnesh Kumar Singh
 
Java ant tutorial
Ashoka Vanjare
 
Deploy Flex with Apache Ant
dctrl — studio for creativ technology
 
Apache Ant
Ali Bahu
 
Apache Ant
Ali Bahu
 
Introduction to Apache Ant
Shih-Hsiang Lin
 
Ad

Recently uploaded (20)

PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
infertility, types,causes, impact, and management
Ritu480198
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PPTX
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PDF
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPTX
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Council of Chalcedon Re-Examined
Smiling Lungs
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PPTX
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
PPTX
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
infertility, types,causes, impact, and management
Ritu480198
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPT-Q1-WEEK-3-SCIENCE-ERevised Matatag Grade 3.pptx
reijhongidayawan02
 
Council of Chalcedon Re-Examined
Smiling Lungs
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Introduction presentation of the patentbutler tool
MIPLM
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
epi editorial commitee meeting presentation
MIPLM
 
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
How to Send Email From Odoo 18 Website - Odoo Slides
Celine George
 
Ad

CodeIgniter Ant Scripting

  • 2. Topic • What is Ant? • Why use Ant? • How can we use Ant? • How to stream development with Ant?
  • 4. What Is Ant? • Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles. • Ant is different. Instead of a model where it is extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell commands, the configuration files are XML- based, calling out a target tree where various tasks get executed. Each task is run by an object that implements a particular Task interface.
  • 5. So If Ant is Java why do we want to use it for PHP • Well Ideally Ant was used to stream line build and compilation with Java in response to Make. • With the way Ant is, it can be used in any automation we want as long as all the requirements used in the automation are already installed – We can’t use something we don’t have ;-)
  • 6. Installing Ant • Ant can be downloaded from: http://ant.apache.org • Most Current IDE come with Ant Pre-installed – My Personal Preference NETBEANS IDE – Other’s like Eclipse …. (WHY????) • MAC OS ant is pre-installed, UBUNTU also, but always update ;-) …
  • 7. Ant Task… huh? • Ant has a ton of task both built in and downloadable. • Ant Task are “actions” to be done in the Ant Script.
  • 8. Ant Task Buckets: Archive Tasks Audit/Coverage Tasks Compile Tasks Deployment Tasks Documentation Tasks EJB Tasks Execution Tasks File Tasks Java2 Extensions Tasks Logging Tasks Mail Tasks Miscellaneous Tasks Pre-process Tasks Property Tasks Remote Tasks SCM Tasks Testing Tasks
  • 9. The Ant Build File <!-- this is an ant script to build the project and information --> <project name=”Demo" default="freshBuild" basedir="."> <description> This is the ant script to build demo this has the ability to clean the build, create a Code Report, Run Unit Tests and Build Documentation </description>
  • 10. Ant Properties… • <property name="docs" location="docs" /> • <property name="applicationDocs" location="${docs}/application"/> • <property name="libraryDocs" location="${docs}/library" /> • <property name="reports" location="reports"/> • <property name="sniffer" location="${reports}/sniffer" /> • <property name="applicationReports" location="${reports}/application" /> • <property name="libraryReports" location="${reports}/library" /> • <property name="build" location="build" /> • <property name="tests" location="tests" />
  • 11. Ant Cleaning… • <!-- this will create a clean working environment --> • <target name="clean"> • <echo message="Clearing the folders"/> • <delete dir="${applicationDocs}"/> • <delete dir="${libraryDocs}" /> • <delete dir="${reports}" /> • <delete dir="${build}" /> • <echo message="Creating the folders" /> • <mkdir dir="${applicationDocs}" /> • <mkdir dir="${libraryDocs}" /> • <mkdir dir="${reports}" /> • <mkdir dir="${sniffer}" /> • <mkdir dir="${applicationReports}" /> • <mkdir dir="${libraryReports}" /> • <mkdir dir="${build}" /> • </target>
  • 12. Ant Clean Cont…. • <target name="cleanProject"> • <echo message="Clearing the folders"/> • <delete dir="${applicationDocs}"/> • <delete dir="${libraryDocs}" /> • <delete dir="${reports}" /> • <delete dir="${build}" /> • </target>
  • 13. Ant Code Sniffing… • <!-- code sniffer --> • <target name="codeSniff"> • <echo message="Started Sniffing code" /> • <echo message="Sniffing Library" /> • <exec executable="phpcs" output="${sniffer}/library.sniffer.txt"> • <arg value="${NoteLib}"/> • <arg value="--standard=ZEND"/> • <arg value="--report=full" /> • <arg value="-n"/> • </exec> • <echo message="Sniffing Application" /> • <exec executable="phpcs" output="${sniffer}/application.sniffer.txt"> • <arg value="${application}" /> • <arg value="--standard=ZEND" /> • <arg value="--report=full" /> • <arg value="-n" /> • </exec> • <echo message="Finished Sniffing the Code" /> • </target>
  • 14. Ant Documenting … • <!-- PHP DOCUMENTATION --> • <target name="document"> • <echo message="Started Documenting the code" /> • <echo message="Documenting the Application" /> • <exec executable="phpdoc" output="${docs}/application.doc.result.txt"> • <arg line=" • --target ${applicationDocs} • --directory ${application} • --title 'Note In A Bottle Application Documentation' • --undocumentedelements on • -i *.phtml • --defaultpackagename 'NoteInBottleApp' • "/> • </exec>
  • 15. Ant Documenting cont… • <echo message="Documenting the Application's Library" /> • <exec executable="phpdoc" output="${docs}/application.doc.result.txt"> • <arg line=" • --target ${libraryDocs} • --directory ${NoteLib} • --title 'Note In A Bottle Library Documentation' • --undocumentedelements on • --defaultpackagename 'NoteInBottle' • "/> • </exec> • <echo message="Finished Documenting the code" /> • </target>
  • 16. Ant Fresh Build…. • <target name="freshBuild" depends="clean, codeSniff, unitTesting, document”> • </target>
  • 17. Ant Copy to Server… • <target name="copyToTestServer"> • <exec executable="cp" output="${docs}/cp.result.txt"> • <arg line=" • -R • /Users/albertrosa/Sites/Demo/ /Volumes/www/Demo/ • "/> • </exec> • <echo message="copied"/> • </target>
  • 18. UMMM…. Ok but how does it work… • So you see how the ant xml file looks, you know the buckets that are included with Ant and you have an idea of how you want your build to go …. SO how do you use it? • Simple… in your Terminal / command prompt / console navigate to the build file ohh wait I didn’t tell you where the build file should go huh…. Well I always place it at the root of the site so all my paths are relative to that root.
  • 19. But really now how to build it…. • Once you have navigated to the desired location all that is left to do is run the command as follows ant <target name> Yep that’s all … so each target is an “task” you can do. But recall the freshBuild target .. That had depends as an attribute. Well those depends are all ran when you execute “ant freshBuild”
  • 20. Basic errors most commonly found • Ant depends orders – if some targets need something to happen first that should happen before that task is executed • You are using a ant task that isn’t installed • You action is producing an error and causes the execution to terminate • You run out of memory :-D rare but possible on many large scale projects.
  • 21. THANKS • Thanks go to ROKKAN for providing us with the Conference space.
  • 22. General Info • My Email: [email protected] • AIM: albertrosa2000 • Meetup: www.meetup.com/codeigniter/ • Rokkan: www.rokkan.com