package com.perforce.workspace.tjuricek.initializer.model; import java.util.Arrays; /** * Defines scripts that can be setup as triggers in the Perforce server being * initialized. As a matter of convention, we either use bash (OS X, Linux) or * batch (Windows). The initializer will create the appropriate one for the * platform. */ public class PerforceTrigger { private String bash; private String batch; private TriggerLine[] triggerLines; public String getBash() { return bash; } public void setBash(String bash) { this.bash = bash; } public String getBatch() { return batch; } public void setBatch(String batch) { this.batch = batch; } public TriggerLine[] getTriggerLines() { return triggerLines; } public void setTriggerLines(TriggerLine[] triggerLines) { this.triggerLines = triggerLines; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PerforceTrigger that = (PerforceTrigger) o; if (bash != null ? !bash.equals(that.bash) : that.bash != null) return false; if (batch != null ? !batch.equals(that.batch) : that.batch != null) return false; if (!Arrays.equals(triggerLines, that.triggerLines)) return false; return true; } @Override public int hashCode() { int result = bash != null ? bash.hashCode() : 0; result = 31 * result + (batch != null ? batch.hashCode() : 0); result = 31 * result + (triggerLines != null ? Arrays.hashCode(triggerLines) : 0); return result; } @Override public String toString() { return "PerforceTrigger{" + "bash='" + bash + '\'' + ", batch='" + batch + '\'' + ", triggerLines=" + Arrays.toString(triggerLines) + '}'; } /** * Represents information to add to each trigger line. See the command * parameter for more information. */ public static class TriggerLine { private String name; private String type; private String path; private String command; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } /** * The command is a handlebars script with a special context: {{command}} * is replaced with the appropriate executable script path. */ public String getCommand() { return command; } public void setCommand(String command) { this.command = command; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TriggerLine that = (TriggerLine) o; if (command != null ? !command.equals(that.command) : that.command != null) return false; if (name != null ? !name.equals(that.name) : that.name != null) return false; if (path != null ? !path.equals(that.path) : that.path != null) return false; if (type != null ? !type.equals(that.type) : that.type != null) return false; return true; } @Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + (type != null ? type.hashCode() : 0); result = 31 * result + (path != null ? path.hashCode() : 0); result = 31 * result + (command != null ? command.hashCode() : 0); return result; } @Override public String toString() { return "TriggerLine{" + "name='" + name + '\'' + ", type='" + type + '\'' + ", path='" + path + '\'' + ", command='" + command + '\'' + '}'; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 9165 | tjuricek |
Some documentation framework and a fatjar style distribution for the initializer to run outside of a gradle plugin. Upped the version to 0.1.2, but this may need some testing before it's really guaranteed to work in standalone mode |
||
#1 | 9088 | tjuricek |
0.1.0 First version of the initializer. This currently requires setting up a local version of the p4java_ext project, since that project is awating approval into the main jcenter repository. |