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

org.hidetake.gradle.ssh.plugin.RemoteContainerExtension.groovy Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.hidetake.gradle.ssh.plugin

import org.hidetake.groovy.ssh.core.Remote

/**
 * An extension class of the remote container.
 *
 * @author hidetake.org
 */
@Category(Collection)
class RemoteContainerExtension {
    /**
     * Find remote hosts associated with given roles.
     *
     * @param remotes mixin object
     * @param roles one or more roles
     * @return remote hosts associated with given roles
     */
    static Collection role(Collection remotes, String... roles) {
        assert remotes != null
        assert roles, 'At least one role must be given'
        roles.collect { String role ->
            remotes.findAll { it.roles.contains(role) }
        }.flatten().toSet()
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy