A simple class, whose only purpose is to house static strings referencing the Jervis wiki, to be used as helpful hints when throwing exceptions.
To run this example, clone Jervis and execute ./gradlew console to bring up a Groovy Console with the classpath set up.
When overriding the URLs you must override the getter method using meta programming. The following is an example of overriding the LIFECYCLES_SPEC.
import net.gleske.jervis.exceptions.WikiPages
WikiPages.metaClass.static.getLifecyclesSpec = {->'https://wiki.example.com/lifecycle_explanation.html'}
import net.gleske.jervis.lang.lifecycleValidator
def x = new lifecycleValidator()
x.load_JSONString("""
{
"ruby": {
"defaultKey": "rake1",
"rake1": {
"fileExistsCondition": "Gemfile.lock",
"fallbackKey": "rake2",
"env": "export BUNDLE_GEMFILE=\$PWD/Gemfile",
"install": "bundle install --jobs=3 --retry=3 --deployment",
"script": "bundle exec rake"
},
"rake2": {
"env": "export BUNDLE_GEMFILE=\$PWD/Gemfile",
"install": "bundle install --jobs=3 --retry=3",
"script": "bundle exec rake"
}
}
}
""".toString())
x.validate()
The important part of the above example is the following excerpt.
import net.gleske.jervis.exceptions.WikiPages
WikiPages.metaClass.static.getLifecyclesSpec = {->'https://wiki.example.com/lifecycle_explanation.html'}
import net.gleske.jervis.lang.lifecycleValidator
What is important is that we modified the WikiPages class
before we imported the lifecycleValidator class.
This is important because the class can't be statically modified from within the
lifecycleValidator after it is imported.
Here's an example error message from the above sample.
net.gleske.jervis.exceptions.LifecycleMissingKeyException:
ERROR: Lifecycle validation failed. Missing key: ruby.friendlyName
See wiki page:
https://wiki.example.com/lifecycle_explanation.html
at net.gleske.jervis.lang.lifecycleValidator$_validate_closure1.doCall(lifecycleValidator.groovy:118)
at net.gleske.jervis.lang.lifecycleValidator.validate(lifecycleValidator.groovy:112)
at net.gleske.jervis.lang.lifecycleValidator$validate$0.call(Unknown Source)
| Modifiers | Name | Description |
|---|---|---|
static String |
LIFECYCLES_SPEC |
A static reference to the lifecycles file spec wiki page. |
static String |
PIPELINE_SUPPORT |
A static reference to the pipeline support wiki page. |
static String |
PLATFORMS_SPEC |
A static reference to the platforms file spec wiki page. |
static String |
SECURE_SECRETS |
A static reference to the secure secrets in repositories wiki page. |
static String |
SUPPORTED_LANGUAGES |
A static reference to the supported languages wiki page. |
static String |
SUPPORTED_TOOLS |
A static reference to the supported tools wiki page. |
static String |
TOOLCHAINS_SPEC |
A static reference to the toolchains file spec wiki page. |
A static reference to the lifecycles file spec wiki page.
A static reference to the pipeline support wiki page.
A static reference to the platforms file spec wiki page.
A static reference to the secure secrets in repositories wiki page.
A static reference to the supported languages wiki page.
A static reference to the supported tools wiki page.
A static reference to the toolchains file spec wiki page.