-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #453 from Alex-Weatherhead/feature/452
Add support for branch/tag comparators in when block
- Loading branch information
Showing
10 changed files
with
409 additions
and
134 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
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
33 changes: 33 additions & 0 deletions
33
src/main/groovy/com/lesfurets/jenkins/unit/declarative/ComparatorEnum.groovy
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,33 @@ | ||
package com.lesfurets.jenkins.unit.declarative | ||
|
||
enum ComparatorEnum { | ||
|
||
EQUALS ('EQUALS'), | ||
GLOB ('GLOB'), | ||
REGEXP ('REGEXP') | ||
|
||
private static Map map | ||
|
||
static { | ||
map = [:] | ||
values().each { comparator -> | ||
map.put(comparator.name, comparator) | ||
} | ||
} | ||
|
||
static ComparatorEnum getComparator(String name) { | ||
return map.get(name) | ||
} | ||
|
||
private final String name | ||
|
||
private ComparatorEnum(String name) { | ||
this.name = name | ||
} | ||
|
||
@Override | ||
String toString() { | ||
return this.name | ||
} | ||
|
||
} |
Oops, something went wrong.