This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
ruby-tools/jpi/lib/jenkins/plugin/cli/templates/item_listener.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Receives notifications about CRUD operations of Items. | ||
# | ||
# This class will receive callbacks | ||
# when items are created, copied, updated, deleted, etc... | ||
# | ||
# To receive a callback, override the method with the same name as | ||
# the event. E.g. | ||
# | ||
# class MyRunListener | ||
# include Jenkins::Listeners::ItemListener | ||
# | ||
# def updated(item) | ||
# puts "#{item.inspect} updated!" | ||
# end | ||
# end | ||
# | ||
class <%= name.capitalize %>Listener | ||
include Jenkins::Listeners::ItemListener | ||
|
||
# Called after a new job is created and added to@link jenkins.model.Jenkinsend, | ||
# before the initial configuration page is provided. | ||
# | ||
# This is useful for changing the default initial configuration of newly created jobs. | ||
# For example, you can enable/add builders, etc. | ||
def created(item) | ||
end | ||
|
||
# Called after a new job is created by copying from an existing job. | ||
# | ||
# For backward compatibility, the default implementation of this method calls@link #onCreated(Item)end. | ||
# If you choose to handle this method, think about whether you want to call super.onCopied or not. | ||
# | ||
# @param [Jenkins::Model::Item] The source item that the new one was copied from. Never null. | ||
# @param [Jenkins::Model::Item] The newly created item. Never null. | ||
def copied(src_item, item) | ||
end | ||
|
||
# Called after all the jobs are loaded from disk into@link jenkins.model.Jenkinsend | ||
# object. | ||
def loaded() | ||
end | ||
|
||
# Called right before a job is going to be deleted. | ||
# | ||
# At this point the data files of the job is already gone. | ||
# @param [Jenkins::Model::Item] The item being deleted. | ||
def deleted(item) | ||
end | ||
|
||
# Called after a job is renamed. | ||
# | ||
# @param [Jenkins::Model::Item] The item being renamed | ||
# @param The old name of the job. | ||
# @param The new name of the job. Same as@link Item#getName()end. | ||
def renamed(item, oldName, newName) | ||
end | ||
|
||
# Called after a job has its configuration updated. | ||
# | ||
# @param [Jenkins::Model::Item] The item being updated | ||
def updated(item) | ||
end | ||
|
||
# Called at the begenning of the orderly shutdown sequence to | ||
# allow plugins to clean up stuff | ||
def before_shutdown() | ||
end | ||
end |