Blog

Eric Peterson

December 21, 2017

Spread the word


Share your thoughts

A short one but a good one today. Let's see how we can automate tasks with [CommandBox Githooks.](https://www.forgebox.io/view/commandbox-githooks)

CommandBox Githooks

What are Githooks?

Githooks run on different git actions, like pre-commit and post-checkout. They allow you to hook in to git's lifecycle to execute tasks. Some examples of these tasks are enforcing a commit message format in pre-commit or installing dependencies in post-checkout. This is more useful than it may sound — I know I often forget to install new dependencies when checking out a branch. Automating that step helps me spend less time debugging in the wrong direction.

Running Githooks with CommandBox

CommandBox Githooks lets you use CommandBox, CFML, and your box.json to manage these githooks for your project. You configure it in three steps.

  1. Install commandbox-githooks for CommandBox. This step only needs to be done once per CommandBox installation.
  2. Configure CommandBox Githooks for your repository by running githooks install. This will set up CommandBox to handle the githooks.

    Note: This needs to be done on each user's local repository as githooks are not synced.

  3. Add a githooks struct to your box.json. The keys of this struct are the camel-case names of the githooks (post-checkout => postCheckout). The value is either a single command or an array of commands to run for the githook.

Let's show you what this actually looks like:

Wrap up

CommandBox Githooks can save you mental energy and time debugging by helping you automate githook tasks with CommandBox and CFML. Try it out today!

Add Your Comment

(1)

Dec 21, 2017 08:09:32 UTC

by John Farrar

This is one of the greatest integration points for CFML developers. Remember if you think hooks are missing they are likely hooks that should be run from your origin repository, a.k.a. BitBucket or some other server.

Recent Entries

Is Cloud the Answer for Your ColdFusion Dilemma?

Is Cloud the Answer for Your ColdFusion Dilemma?

Feeling the limits of an on-premise ColdFusion setup?

Many businesses face high costs, limited scalability, and performance bottlenecks, leaving them wondering if the cloud could be the answer.

In our FREE whitepaper, "Is Cloud the Answer for Your ColdFusion Dilemma?", we explore:

  • Benefits of Migrating to the Cloud: From cost savings to increased flexibility, find out what a cloud-based ColdFusion setup can do.
Cristobal Escobar
Cristobal Escobar
November 13, 2024
Mastering Events and Listeners in CBWIRE

Mastering Events and Listeners in CBWIRE

In CBWIRE, events and listeners are the backbone of building responsive, modular applications without relying heavily on JavaScript. This guide walks you through setting up and using CBWIRE events to create seamless interactions between components, from dispatching events in CFML and frontend templates to listening with Alpine.js and JavaScript. Learn how to make your applications feel dynamic and engaging by effortlessly connecting components. Whether you’re triggering events to update a dashboard or targeting specific parts of your app with dispatchTo, these techniques will empower you to create a modern, interactive CFML experience with ease.

Grant Copley
Grant Copley
November 11, 2024
10 Key Benefits of Hiring a Specialized ColdFusion Consulting Team

10 Key Benefits of Hiring a Specialized ColdFusion Consulting Team

ColdFusion remains a powerful and versatile platform for building dynamic web applications. However, keeping your ColdFusion environment optimized, secure, and scalable requires specialized expertise. Whether managing a long-standing ColdFusion application or planning new development projects, hiring a dedicated ColdFusion consulting and support team can be a game-changer for CTOs, CIOs, and developers. Here's why:

1. Expert Guidance on ColdFusion Web Development

...

Cristobal Escobar
Cristobal Escobar
November 08, 2024