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
6 changed files
with
80 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
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,4 @@ | ||
module Jenkins::Triggers | ||
require 'jenkins/triggers/trigger' | ||
require 'jenkins/triggers/trigger_proxy' | ||
end |
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,30 @@ | ||
require 'jenkins/model' | ||
|
||
module Jenkins | ||
module Triggers | ||
# Triggers a Build. | ||
# {http://javadoc.jenkins-ci.org/hudson/triggers/Trigger.html} | ||
class Trigger | ||
include Jenkins::Model | ||
include Jenkins::Model::Describable | ||
describe_as Java.hudson.triggers.Trigger | ||
|
||
# Executes the triggered task. | ||
# | ||
# This method is invoked when Trigger.new(String) is used | ||
# to create an instance, and the crontab matches the current time. | ||
def run | ||
end | ||
|
||
|
||
# Called before a Trigger is removed. | ||
# Under some circumstances, this may be invoked more than once for | ||
# a given Trigger, so be prepared for that. | ||
# | ||
# When the configuration is changed for a project, all triggers | ||
# are removed once and then added back. | ||
def stop | ||
end | ||
end | ||
end | ||
end |
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,14 @@ | ||
module Jenkins::Triggers | ||
class TriggerProxy < Java.hudson.triggers.Trigger | ||
include Jenkins::Model::DescribableProxy | ||
proxy_for Jenkins::Triggers::Trigger | ||
|
||
def run | ||
@object.run | ||
end | ||
|
||
def stop | ||
@object.stop | ||
end | ||
end | ||
end |
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,24 @@ | ||
require 'spec_helper' | ||
|
||
describe Jenkins::Triggers::TriggerProxy do | ||
include ProxyHelper | ||
|
||
before do | ||
@object = mock(Jenkins::Triggers::Trigger) | ||
@builder = Jenkins::Triggers::TriggerProxy.new(@plugin, @object) | ||
end | ||
|
||
describe "run" do | ||
it "calls through to its implementation" do | ||
@object.should_receive(:run) | ||
@builder.run | ||
end | ||
end | ||
|
||
describe "stop" do | ||
it "calls through to its implementation" do | ||
@object.should_receive(:stop) | ||
@builder.stop | ||
end | ||
end | ||
end |
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,7 @@ | ||
require 'spec_helper' | ||
|
||
describe Jenkins::Triggers::Trigger do | ||
it "lives" do | ||
subject.should_not be_nil | ||
end | ||
end |