phing and drupal

15
Phing and Drupal First steps to contiuous integration Vladimir Melnic [email protected]

Upload: stefan-nistor

Post on 08-May-2015

2.223 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Phing and drupal

Phing and Drupal First steps to contiuous integration

Vladimir Melnic

[email protected]

Page 2: Phing and drupal

PHING

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant. You can do anything with it that you could do with a traditional build system like GNU make, and its use of simple XML build files and extensible PHP "task" classes make it an easy-to-use and highly flexible build framework.

➔ http://www.phing.info/trac/

Page 3: Phing and drupal

DRUPAL

Drupal is an open source content management platform powering millions of websites and applications. It’s built, used, and supported by an active and diverse community of people around the world.

➔ https://drupal.org/

Page 4: Phing and drupal

Requirements

✔ pear channel-discover pear.phing.info✔ pear install phing/phing✔ https://drupal.org/project/phingdrushtask✔ pear install VersionControl_Git-0.4.4

➔ http://pear.php.net/package/VersionControl_Git/download

➔ https://drupal.org/project/phingdrushtask

Page 5: Phing and drupal

Demo

[email protected]:vladimir_m/soldanesti.org_make.git➔ cd soldanesti.org/ ➔ phing

➔ https://bitbucket.org/vladimir_m/soldanesti.org_make

Page 6: Phing and drupal

Files:

● build.xml – main phing build file. ● contrib.make - Drush make file.● custom.make - Drush make file.● DrushTask.php - Phing Drush Task.● README.md – Readme file.● soldanesti.org – Cloned folder.

Page 7: Phing and drupal

File::build.xml

<?xml version="1.0" encoding="UTF-8" ?>

<project name="soldanesti.org" default="build">

<target name="build"

depends="init, drush_core, drush_contrib, drush_custom, files_directory, create_settings.php"/>

</project>

Page 8: Phing and drupal

File::build.xml(Target[init])<target name="init">

<taskdef name="drush" classname="DrushTask"/>

<php function="dirname" returnProperty="phing.dir">

<param value="${phing.file}"/>

</php>

<property name="project.basedir" value="${project.basedir}"/>

<property name="project.code.dir"

value="${project.basedir}/${phing.project.name}"/>

<property name="drupal.contrib.make.file" value="contrib.make"/>

<property name="drupal.custom.make.file" value="custom.make"/>

<property name="drupal.sites.dir"

value="${phing.project.name}/sites/all"/>

<property name="drupal.files.dir"

value="${phing.project.name}/sites/default/files"/>

<property name="drupal.settings.dir"

value="${phing.project.name}/sites/default"/>

</target>

Page 9: Phing and drupal

File::build.xml(Target[drush_core])

<!-- Download drupal core. -->

<target name="drush_core" description="Download drupal core."

depends="init">

<drush command='dl drupal' assume="yes" pipe="true">

<option name="drupal-project-rename">${phing.project.name}</option>

</drush>

</target>

Page 10: Phing and drupal

File::build.xml(Target[drush_contrib])

<!-- Execute drush make file and download contrib modules. -->

<target name="drush_contrib" description="Download drupal contrib modules."

depends="init">

<drush command="make" assume="yes" pipe="true">

<param>${drupal.contrib.make.file}</param>

<option name="contrib-destination">${drupal.sites.dir}</option>

<option name="no-core"/>

</drush>

</target>

Page 11: Phing and drupal

File::build.xml(Target[files_directory])

<!-- Make files directory. -->

<target name="files_directory"

description="Create site/default/files directory."

depends="init">

<mkdir dir="${drupal.files.dir}"/>

<chmod file="${drupal.files.dir}" mode="0777" failonerror="true"/>

</target>

Page 12: Phing and drupal

File::build.xml(Target[create_settings.php])

<!-- Manipulate settings.php file. -->

<target name="create_settings.php"

description="Copy default.settings.php file to settings.php."

depends="init">

<!--<echo msg="Copying default.settings.php file to settings.php..." />-->

<copy file="${drupal.settings.dir}/default.settings.php"

tofile="${drupal.settings.dir}/settings.php"/>

<chmod file="${drupal.settings.dir}/settings.php" mode="0777"

failonerror="true"/>

</target>

Page 13: Phing and drupal

Demo::consoleLog()Buildfile: /var/www/soldanesti.org/build.xml

soldanesti.org > init:

[php] Calling PHP function: dirname()

soldanesti.org > drush_core:

[drush] standard

[drush] node

[drush] menu

[drush] blog

[drush] overlay

soldanesti.org > drush_contrib:

[drush] >> Project admin_menu contains 3 modules: ...

[drush] >> Project devel contains 3 modules: …

[drush] >> Project ctools contains 9 modules: …

soldanesti.org > drush_custom:

soldanesti.org > build:

BUILD FINISHED

Page 14: Phing and drupal

Resources

➔ http://reload.github.io/phing-drupal-template/

➔ http://www.phing.info/docs/guide/trunk/chapters/GettingStarted.html

➔ https://drupal.org/project/phingdrushtask

➔ http://google.com

Page 15: Phing and drupal

Thank You!Thank You!

➔ Skype: melnic-v

➔ Email: [email protected]