
com.sysgears.grain.gradle.helpers.ProjectEnvironment.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grain-gradle-plugin Show documentation
Show all versions of grain-gradle-plugin Show documentation
Gradle plugin for Grain general purpose static site generator which provides
all the modern features and tools for generating any kind of HTML content.
package com.sysgears.grain.gradle.helpers
import org.gradle.api.Project
/**
* Provides access to the project environment.
*/
class ProjectEnvironment {
/**
* Looks up the value of given project property.
*
* @param project the project to look up the property for
* @param name the property name
* @param value the value to return in case if the property is not found
* @return the value of the project property if found, the default value otherwise
*/
static String lookUpProjectProp(Project project, String name, String value) {
project.hasProperty(name) && project."$name"?.trim() ?
project."$name" : value
}
/**
* Looks up the value of given environment variable.
*
* @param name the name of the environment variable
* @param value the value to return in case if the variable is not found
* @return the value of the environment variable if found, the default value otherwise
*/
static String lookUpEnvVariable(String name, String value) {
System.getenv(name)?.trim() ?: value
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy