All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.ksoichiro.web.resource.extension.BowerConfig.groovy Maven / Gradle / Ivy

package com.github.ksoichiro.web.resource.extension

import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import org.gradle.api.logging.LogLevel

/**
 * Configuration for using bower.
 */
// @EqualsAndHashCode is required to execute valid up-to-date check.
@EqualsAndHashCode
@ToString
class BowerConfig implements Serializable {
    static final long serialVersionUID = -1L
    LogLevel logLevel
    List dependencies
    List dependencyResolutions
    boolean parallelize
    List options

    BowerConfig() {
        this.dependencies = []
        this.dependencyResolutions = []
        this.options = []
    }

    /**
     * Configure bower dependencies by closure.
     *
     * @param configureClosure closure to be passed to this config object
     */
    void dependencies(Closure configureClosure) {
        configureClosure.delegate = this
        configureClosure()
    }

    /**
     * Add a bower dependency by {@code configuration} map.
     *
     * @param configuration configuration map containing dependency information
     */
    void install(Map configuration) {
        dependencies.add(new BowerDependency(configuration))
    }

    /**
     * Add a bower dependency resolution by ${@code configuration} map.
     * This is equivalent to resolutions in bower.json.
     *
     * @param configuration configuration map containing dependency resolution information
     */
    void resolve(Map configuration) {
        dependencyResolutions.add(new BowerDependencyResolution(configuration))
    }

    def methodMissing(String name, args) {
        this."$name" = args[0]
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy