class ExampleEvent

Overview

This class demonstrates how you can extend the BaseEvent class to create a new event type! Event types are defined in the config file for runway. (event.type in the config file) This class defines how events are "checked" when their schedule runs and how they are "handled" when a deployment should be made

You should copy/paste this entire file as a starting point for creating a new event type

Defined in:

runway/events/example.cr

Constructors

Instance Method Summary

Instance methods inherited from class BaseEvent

check_for_event : Payload check_for_event, post_deploy(payload : Payload) : Payload post_deploy

Constructor methods inherited from class BaseEvent

new(log : Log, event : Event) new

Constructor Detail

def self.new(log : Log, event : Event) #

This is the constructor for the class. It is required to call the super constructor with the log and event After calling super, you can do any additional setup you need for your event See the github_deployment.cr file for an example of how to do additional setup


[View source]

Instance Method Detail

def check_for_event : Payload #

This method is called by the scheduler to check if the event should be handled Here you will do any checks to see if the event should be handled Example: Reach out to the GitHub API and see if a new release has been made that you want to upgrade to


[View source]
def post_deploy(payload : Payload) : Payload #

If #post_deploy is defined in the event class, it will be called after the deployment is complete and... ... if the payload has a run_post_deploy? attribute set to true the check_for_event method should set the run_post_deploy? attribute to true if you want this method to be called


[View source]