SlideShare una empresa de Scribd logo
1 de 41
Descargar para leer sin conexión
Using Grunt 
to Manage Drupal Build and Testing Tools 
BAD Camp 2014 
11/9/2014
Joe Turgeon 
Director of Engineering 
Drupal.org/GitHub/Twitter: @arithmetric
Why Build and Test 
Drupal?
Why build Drupal? 
• (or: How I Learned to Love Drush Make) 
• End anti-pattern of committing core/contrib code 
• Improve transparency through declarative build process 
• Simplify use of external libraries and resources 
• Enforce reproducibility
Why test Drupal? 
• Beyond QA and “clicking around” 
• Empower devs to produce quality code 
• Improve objectivity of requirements 
• Collect and track metrics
Why Grunt? 
• Community-supported, widely-adopted, flexible 
• Requires only Node.js 
• Declarative configuration 
• 3,000+ contributed plugins
Drupal, Grunt, 
Oh My?
Introducing Grunt Drupal Tasks 
• Started as R&D project in January 
• Since March, used on 6 client projects 
• Becoming integrated in our distributions 
• Released on GitHub in September
Best Practices 
• Enforces consistent practice across team and CI env 
• Including Drush make, Behat, code style checks 
• Manages tool dependencies for projects 
• Tools are ready to use and discoverable
Dev Tool Orchestration
Let’s Do This!
Follow Along 
• https://github.com/phase2/grunt-drupal-tasks 
• Requires: 
• npm (included with Node.js) 
• Grunt CLI (npm install -g grunt-cli) 
• Recommended: Composer (global install)
Setting Up a Project
Project Set Up 
• Initialize a new project with: 
npm install grunt grunt-drupal-tasks 
cp -rf node_modules/grunt-drupal-tasks/example/* . 
• See: grunt-drupal-tasks / CONFIG.md
Drupal Scaffolding 
• Scaffolding accommodates custom 
project code and supporting tools 
• This structure is committed as the 
initial project code base
Add Project Code 
• src/modules: Custom modules 
• src/profiles: Custom install profiles 
• src/project.make: Drush make file 
• src/sites: Single- or multi-site config 
• src/static: Static file replacements 
• src/themes: Custom themes
Building the Project
Project Build 
• Build the project with: 
grunt
Build Results 
• build/html: Fully-assembled Drupal site 
• build/html/profiles/mysite: Symlink to 
src/profiles/mysite
Build Results 
• build/html/sites/all/modules/contrib: 
Contrib modules from make file 
• build/html/sites/all/modules/custom: 
Symlink to src/modules 
• build/html/sites/all/themes/contrib: 
Contrib themes from make file 
• build/html/sites/all/themes/custom: 
Symlink to src/modules
Symlinks, really? 
• Yes, really! 
• Relative links within the scaffold structure are portable 
• The build process ensures the links are set up correctly 
• You do not need to re-build after each change to a source 
file 
• XDebug/IDEs work for both core/contrib and custom code
Validating Code
Validating Code Quality 
• Run PHP Lint and PHP Code Sniffer (with Drupal coding 
standards) with: 
grunt validate
Validating Code Quality 
• PHP Lint verifies syntax and more
Validating Code Quality 
• PHP Code Sniffer verifies Drupal’s code standards
Validating Code Quality 
• Encourage devs to validate code before committing 
• Focus peer code review on architecture 
• Fail integration builds or reject pull requests at certain 
thresholds
Testing Drupal
Testing Drupal Functionality 
• Provides Behat, the Drupal Extension, other dependencies 
• Testing with Behat requires an installed Drupal site 
accessible by URL 
• Currently, this requires manual set up of a local env 
• Future feature: Using “drush runserver” for a test env
Testing Drupal Functionality 
• Run Behat for any included test features with: 
grunt behat
Getting Help
Getting Help 
• See a list of available commands with: 
grunt help
Taking It Further
Extending 
• Overriding the steps in the default build process 
• Defining new steps or replacing existing ones
Future Development 
• Drupal 8 support 
• Compatibility with other testing tools 
• Configurable deployment steps
How to Help 
• Try implementing Grunt Drupal Tasks on your next project 
• File issues on GitHub to share how it could work better 
• Patches welcome! (Submit pull requests on GitHub.)
Thanks! Questions? Suggestions? 
• Slides: 
http://www.slideshare.net/arithmetric/using-grunt-with-drupal 
• GitHub repo: 
https://github.com/phase2/grunt-drupal-tasks
PHASE2TECHNOLOGY.COM

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gates
 
Devops For Drupal
Devops  For DrupalDevops  For Drupal
Devops For Drupal
 
Version Control, Writers, and Workflows
Version Control, Writers, and WorkflowsVersion Control, Writers, and Workflows
Version Control, Writers, and Workflows
 
Zend Framwork presentation
Zend Framwork presentationZend Framwork presentation
Zend Framwork presentation
 
Gradle
GradleGradle
Gradle
 
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
Best Practices for Development Deployment & Distributions: Capital Camp + Gov...
 
The Art & Zen of Managing Nagios with Puppet
The Art & Zen of Managing Nagios with PuppetThe Art & Zen of Managing Nagios with Puppet
The Art & Zen of Managing Nagios with Puppet
 
Resources for Navigating Drupal Upgrades: Versions 6 Through 8 And What It Me...
Resources for Navigating Drupal Upgrades: Versions 6 Through 8 And What It Me...Resources for Navigating Drupal Upgrades: Versions 6 Through 8 And What It Me...
Resources for Navigating Drupal Upgrades: Versions 6 Through 8 And What It Me...
 
Drupal, git and sanity
Drupal, git and sanityDrupal, git and sanity
Drupal, git and sanity
 
CI/CD with Azure DevOps and Azure Databricks
CI/CD with Azure DevOps and Azure DatabricksCI/CD with Azure DevOps and Azure Databricks
CI/CD with Azure DevOps and Azure Databricks
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
The Art and Zen of Managing Nagios With Puppet
The Art and Zen of Managing Nagios With PuppetThe Art and Zen of Managing Nagios With Puppet
The Art and Zen of Managing Nagios With Puppet
 
Geb Best Practices
Geb Best PracticesGeb Best Practices
Geb Best Practices
 
Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12
 
Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...
 
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas VochtenO365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
 
Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development
 
Intro to Ratpack (CDJDN 2015-01-22)
Intro to Ratpack (CDJDN 2015-01-22)Intro to Ratpack (CDJDN 2015-01-22)
Intro to Ratpack (CDJDN 2015-01-22)
 
OpenStack Documentation Projects and Processes
OpenStack Documentation Projects and ProcessesOpenStack Documentation Projects and Processes
OpenStack Documentation Projects and Processes
 

Destacado (6)

Automated Testing with Agile
Automated Testing with AgileAutomated Testing with Agile
Automated Testing with Agile
 
Agile Requirements Exploration: How Testers Add Value
Agile Requirements Exploration: How Testers Add ValueAgile Requirements Exploration: How Testers Add Value
Agile Requirements Exploration: How Testers Add Value
 
Smoke Testing
Smoke TestingSmoke Testing
Smoke Testing
 
Agile testing to build the right thing
Agile testing to build the right thingAgile testing to build the right thing
Agile testing to build the right thing
 
Regression testing
Regression testingRegression testing
Regression testing
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile Tester
 

Similar a Using Grunt with Drupal

Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
Swain Loda
 
Freelancer Weapons of mass productivity
Freelancer Weapons of mass productivityFreelancer Weapons of mass productivity
Freelancer Weapons of mass productivity
Gregg Coppen
 

Similar a Using Grunt with Drupal (20)

Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
 
Build your android app with gradle
Build your android app with gradleBuild your android app with gradle
Build your android app with gradle
 
Mastering azure devOps - Dot Net Tricks
Mastering azure devOps - Dot Net TricksMastering azure devOps - Dot Net Tricks
Mastering azure devOps - Dot Net Tricks
 
Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.Gradle 2.breaking stereotypes.
Gradle 2.breaking stereotypes.
 
Working in Harmony: Manchester - Optimize development and content workflows
Working in Harmony: Manchester - Optimize development and content workflowsWorking in Harmony: Manchester - Optimize development and content workflows
Working in Harmony: Manchester - Optimize development and content workflows
 
Puppet Camp Portland: Nagios Management With Puppet (Beginner)
Puppet Camp Portland: Nagios Management With Puppet (Beginner)Puppet Camp Portland: Nagios Management With Puppet (Beginner)
Puppet Camp Portland: Nagios Management With Puppet (Beginner)
 
Devops
DevopsDevops
Devops
 
Gradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhereGradle 2.Write once, builde everywhere
Gradle 2.Write once, builde everywhere
 
Creating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - WebinarCreating a Reusable Drupal Website for Higher Education - Webinar
Creating a Reusable Drupal Website for Higher Education - Webinar
 
Week6 office-hours
Week6 office-hoursWeek6 office-hours
Week6 office-hours
 
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
Code the docs-yu liu
Code the docs-yu liuCode the docs-yu liu
Code the docs-yu liu
 
Gradle - Build System
Gradle - Build SystemGradle - Build System
Gradle - Build System
 
Phase2 Large Drupal Multisites (gta case study)
Phase2   Large Drupal Multisites (gta case study)Phase2   Large Drupal Multisites (gta case study)
Phase2 Large Drupal Multisites (gta case study)
 
Docker based-Pipelines with Codefresh
Docker based-Pipelines with CodefreshDocker based-Pipelines with Codefresh
Docker based-Pipelines with Codefresh
 
Freelancer Weapons of mass productivity
Freelancer Weapons of mass productivityFreelancer Weapons of mass productivity
Freelancer Weapons of mass productivity
 
ASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and ToolingASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and Tooling
 
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
 
Puppet Camp Denver 2015: Nagios Management With Puppet
Puppet Camp Denver 2015: Nagios Management With PuppetPuppet Camp Denver 2015: Nagios Management With Puppet
Puppet Camp Denver 2015: Nagios Management With Puppet
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Using Grunt with Drupal

  • 1. Using Grunt to Manage Drupal Build and Testing Tools BAD Camp 2014 11/9/2014
  • 2. Joe Turgeon Director of Engineering Drupal.org/GitHub/Twitter: @arithmetric
  • 3. Why Build and Test Drupal?
  • 4. Why build Drupal? • (or: How I Learned to Love Drush Make) • End anti-pattern of committing core/contrib code • Improve transparency through declarative build process • Simplify use of external libraries and resources • Enforce reproducibility
  • 5. Why test Drupal? • Beyond QA and “clicking around” • Empower devs to produce quality code • Improve objectivity of requirements • Collect and track metrics
  • 6. Why Grunt? • Community-supported, widely-adopted, flexible • Requires only Node.js • Declarative configuration • 3,000+ contributed plugins
  • 8. Introducing Grunt Drupal Tasks • Started as R&D project in January • Since March, used on 6 client projects • Becoming integrated in our distributions • Released on GitHub in September
  • 9. Best Practices • Enforces consistent practice across team and CI env • Including Drush make, Behat, code style checks • Manages tool dependencies for projects • Tools are ready to use and discoverable
  • 12. Follow Along • https://github.com/phase2/grunt-drupal-tasks • Requires: • npm (included with Node.js) • Grunt CLI (npm install -g grunt-cli) • Recommended: Composer (global install)
  • 13. Setting Up a Project
  • 14. Project Set Up • Initialize a new project with: npm install grunt grunt-drupal-tasks cp -rf node_modules/grunt-drupal-tasks/example/* . • See: grunt-drupal-tasks / CONFIG.md
  • 15.
  • 16. Drupal Scaffolding • Scaffolding accommodates custom project code and supporting tools • This structure is committed as the initial project code base
  • 17. Add Project Code • src/modules: Custom modules • src/profiles: Custom install profiles • src/project.make: Drush make file • src/sites: Single- or multi-site config • src/static: Static file replacements • src/themes: Custom themes
  • 19. Project Build • Build the project with: grunt
  • 20.
  • 21. Build Results • build/html: Fully-assembled Drupal site • build/html/profiles/mysite: Symlink to src/profiles/mysite
  • 22. Build Results • build/html/sites/all/modules/contrib: Contrib modules from make file • build/html/sites/all/modules/custom: Symlink to src/modules • build/html/sites/all/themes/contrib: Contrib themes from make file • build/html/sites/all/themes/custom: Symlink to src/modules
  • 23. Symlinks, really? • Yes, really! • Relative links within the scaffold structure are portable • The build process ensures the links are set up correctly • You do not need to re-build after each change to a source file • XDebug/IDEs work for both core/contrib and custom code
  • 25. Validating Code Quality • Run PHP Lint and PHP Code Sniffer (with Drupal coding standards) with: grunt validate
  • 26. Validating Code Quality • PHP Lint verifies syntax and more
  • 27. Validating Code Quality • PHP Code Sniffer verifies Drupal’s code standards
  • 28. Validating Code Quality • Encourage devs to validate code before committing • Focus peer code review on architecture • Fail integration builds or reject pull requests at certain thresholds
  • 30. Testing Drupal Functionality • Provides Behat, the Drupal Extension, other dependencies • Testing with Behat requires an installed Drupal site accessible by URL • Currently, this requires manual set up of a local env • Future feature: Using “drush runserver” for a test env
  • 31. Testing Drupal Functionality • Run Behat for any included test features with: grunt behat
  • 32.
  • 34. Getting Help • See a list of available commands with: grunt help
  • 35.
  • 37. Extending • Overriding the steps in the default build process • Defining new steps or replacing existing ones
  • 38. Future Development • Drupal 8 support • Compatibility with other testing tools • Configurable deployment steps
  • 39. How to Help • Try implementing Grunt Drupal Tasks on your next project • File issues on GitHub to share how it could work better • Patches welcome! (Submit pull requests on GitHub.)
  • 40. Thanks! Questions? Suggestions? • Slides: http://www.slideshare.net/arithmetric/using-grunt-with-drupal • GitHub repo: https://github.com/phase2/grunt-drupal-tasks