SlideShare a Scribd company logo
1 of 23
CodeIgniter
Ant Scripting
Topic
• What is Ant?
• Why use Ant?
• How can we use Ant?
• How to stream development with Ant?
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

Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JSMichael Haberman
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Cogapp
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeceptionbuddhieash
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPressHarshad Mane
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytestHector Canto
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Christian Johansen
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Ondřej Machulda
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ CodeceptionTudor Barbu
 
Selenium Open Source Tool
Selenium Open Source ToolSelenium Open Source Tool
Selenium Open Source Toolonlinemindq
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Adam Štipák
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmineTimothy Oxley
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsSeth McLaughlin
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testingEngineor
 
Automated ui testing with selenium. drupal con london 2011
Automated ui testing with selenium. drupal con london 2011Automated ui testing with selenium. drupal con london 2011
Automated ui testing with selenium. drupal con london 2011Yuriy Gerasimov
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with JestMichał Pierzchała
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 

What's hot (20)

Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
Test automation with php codeception
Test automation with php codeceptionTest automation with php codeception
Test automation with php codeception
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPress
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytest
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
 
CI / CD w/ Codeception
CI / CD w/ CodeceptionCI / CD w/ Codeception
CI / CD w/ Codeception
 
PHP-VCR behat case study
PHP-VCR behat case studyPHP-VCR behat case study
PHP-VCR behat case study
 
Selenium Open Source Tool
Selenium Open Source ToolSelenium Open Source Tool
Selenium Open Source Tool
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)
 
Intro to testing Javascript with jasmine
Intro to testing Javascript with jasmineIntro to testing Javascript with jasmine
Intro to testing Javascript with jasmine
 
Laravel Unit Testing
Laravel Unit TestingLaravel Unit Testing
Laravel Unit Testing
 
Jasmine with JS-Test-Driver
Jasmine with JS-Test-DriverJasmine with JS-Test-Driver
Jasmine with JS-Test-Driver
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
 
Automated ui testing with selenium. drupal con london 2011
Automated ui testing with selenium. drupal con london 2011Automated ui testing with selenium. drupal con london 2011
Automated ui testing with selenium. drupal con london 2011
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 

Similar to CodeIgniter Ant Scripting

Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Miguel Zuniga
 
Apache ant
Apache antApache ant
Apache antkoniik
 
Declarative Infrastructure Tools
Declarative Infrastructure Tools Declarative Infrastructure Tools
Declarative Infrastructure Tools Yulia Shcherbachova
 
Coding for production
Coding for productionCoding for production
Coding for productionjehiah
 
Node.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.jsNode.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.jskiyanwang
 
AWS Meet-up: Logging At Scale on AWS
AWS Meet-up: Logging At Scale on AWSAWS Meet-up: Logging At Scale on AWS
AWS Meet-up: Logging At Scale on AWSChris Riddell
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesAlfresco Software
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfNCCOMMS
 
Reactive summit 2020 microsoft orleans the easy way
Reactive summit 2020   microsoft orleans the easy wayReactive summit 2020   microsoft orleans the easy way
Reactive summit 2020 microsoft orleans the easy wayJohn Azariah
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.jsChris Cowan
 
Introduction To Ant1
Introduction To  Ant1Introduction To  Ant1
Introduction To Ant1Rajesh Kumar
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)William Farrell
 

Similar to CodeIgniter Ant Scripting (20)

Apache ant
Apache antApache ant
Apache ant
 
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
Configuration Management in the Cloud - Cloud Phoenix Meetup Feb 2014
 
Apache ant
Apache antApache ant
Apache ant
 
Declarative Infrastructure Tools
Declarative Infrastructure Tools Declarative Infrastructure Tools
Declarative Infrastructure Tools
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
 
Coding for production
Coding for productionCoding for production
Coding for production
 
DevOps for database
DevOps for databaseDevOps for database
DevOps for database
 
Node.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.jsNode.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.js
 
AWS Meet-up: Logging At Scale on AWS
AWS Meet-up: Logging At Scale on AWSAWS Meet-up: Logging At Scale on AWS
AWS Meet-up: Logging At Scale on AWS
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
 
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
 
Reactive summit 2020 microsoft orleans the easy way
Reactive summit 2020   microsoft orleans the easy wayReactive summit 2020   microsoft orleans the easy way
Reactive summit 2020 microsoft orleans the easy way
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
Introduction To Ant1
Introduction To  Ant1Introduction To  Ant1
Introduction To Ant1
 
Intro to-ant
Intro to-antIntro to-ant
Intro to-ant
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)
 
Node azure
Node azureNode azure
Node azure
 
Amazon EC2 Container Service
Amazon EC2 Container ServiceAmazon EC2 Container Service
Amazon EC2 Container Service
 

Recently uploaded

Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...liera silvan
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 

Recently uploaded (20)

Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
EmpTech Lesson 18 - ICT Project for Website Traffic Statistics and Performanc...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 

CodeIgniter Ant Scripting

  • 2. Topic • What is Ant? • Why use Ant? • How can we use Ant? • How to stream development with Ant?
  • 3.
  • 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: albert@albert-rosa.com • AIM: albertrosa2000 • Meetup: www.meetup.com/codeigniter/ • Rokkan: www.rokkan.com