This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.json.JsonSlurper | |
final rootUser = args[0] | |
final filename = args[1] | |
def data | |
new File(filename).withReader {reader -> | |
data = new JsonSlurper().parse(reader) | |
} | |
println "Number of mapped users = ${data.size()}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.gpars.GParsPool | |
def inputfile = args[0] | |
def layouts = [ 'twopi', 'sfdp', 'osage'] | |
def formats = [ 'pdf','svg'] | |
def combinations = [layouts, formats].combinations() | |
GParsPool.withPool(4) { | |
combinations.eachParallel { combination -> | |
String layout = combination[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.5.2') | |
import groovy.json.JsonBuilder | |
import groovyx.net.http.HTTPBuilder | |
import static groovyx.net.http.ContentType.JSON | |
final rootUser = args[0] | |
final String RATE_LIMIT_HEADER = 'X-RateLimit-Remaining' | |
final String rootUrl = 'https://api.github.com' | |
final Closure<Boolean> hasWatchers = {it.watchers > 1} | |
final Closure findReposForUser = { HTTPBuilder http, username -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name = 'glassfish', root = 'http://maven.glassfish.org/content/groups/public/') | |
@GrabResolver(name = "github", root = "http://kellyrob99.github.com/Jenkins-api-tour/repository") | |
@Grab('org.kar:hudson-api:0.2-SNAPSHOT') | |
@GrabExclude('org.codehaus.groovy:groovy') | |
import org.kar.hudson.api.cli.HudsonCliApi | |
/** | |
* Open an interactive Groovy shell that imports the hudson.model.* classes and exposes | |
* a 'hudson' and/or 'jenkins' object in the Binding which is an instance of hudson.model.Hudson | |
*/ | |
HudsonCliApi cliApi = new HudsonCliApi() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name = 'glassfish', root = 'http://maven.glassfish.org/content/groups/public/') | |
@GrabResolver(name = "github", root = "http://kellyrob99.github.com/Jenkins-api-tour/repository") | |
@Grab('org.kar:hudson-api:0.2-SNAPSHOT') | |
@GrabExclude('org.codehaus.groovy:groovy') | |
import org.kar.hudson.api.cli.HudsonCliApi | |
String rootUrl = 'http://localhost:8080' | |
HudsonCliApi cliApi = new HudsonCliApi() | |
OutputStream out = new ByteArrayOutputStream() | |
def script = '''hudson.items.findAll{ job -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name = 'glassfish', root = 'http://maven.glassfish.org/content/groups/public/') | |
@GrabResolver(name = "github", root = "http://kellyrob99.github.com/Jenkins-api-tour/repository") | |
@Grab('org.kar:hudson-api:0.2-SNAPSHOT') | |
@GrabExclude('org.codehaus.groovy:groovy') | |
import org.kar.hudson.api.cli.HudsonCliApi | |
String rootUrl = 'http://localhost:8080' | |
HudsonCliApi cliApi = new HudsonCliApi() | |
OutputStream out = new ByteArrayOutputStream() | |
cliApi.runCliCommand(rootUrl, ['groovysh', 'hudson.jobNames.inspect()'], System.in, out, System.err) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name = 'glassfish', root = 'http://maven.glassfish.org/content/groups/public/') | |
@GrabResolver(name = "github", root = "http://kellyrob99.github.com/Jenkins-api-tour/repository") | |
@Grab('org.kar:hudson-api:0.2-SNAPSHOT') | |
@GrabExclude('org.codehaus.groovy:groovy') | |
import static java.net.HttpURLConnection.* | |
import org.kar.hudson.api.* | |
import org.kar.hudson.api.cli.HudsonCliApi | |
String rootUrl = 'http://localhost:8080' | |
HudsonCliApi cliApi = new HudsonCliApi() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name='glassfish', root='http://maven.glassfish.org/content/groups/public/') | |
@GrabResolver(name='jenkins', root='http://maven.jenkins-ci.org/content/repositories/releases') | |
@GrabResolver(name="github", root="http://kellyrob99.github.com/Jenkins-api-tour/repository") | |
@Grab('org.kar:hudson-api:0.2-SNAPSHOT') | |
@GrabExclude('org.codehaus.groovy:groovy') | |
import static java.net.HttpURLConnection.* | |
import org.kar.hudson.api.* | |
import org.kar.hudson.api.cli.HudsonCliApi | |
String rootUrl = 'http://localhost:8080' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name='glassfish', root='http://maven.glassfish.org/content/groups/public/') | |
@GrabResolver(name="github", root="http://kellyrob99.github.com/Jenkins-api-tour/repository") | |
@Grab('org.kar:hudson-api:0.2-SNAPSHOT') | |
@GrabExclude('org.codehaus.groovy:groovy') | |
import org.kar.hudson.api.cli.HudsonCliApi | |
String rootUrl = 'http://localhost:8080' | |
HudsonCliApi cliApi = new HudsonCliApi() | |
def listPlugins = 'Hudson.instance.pluginManager.plugins.each { \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def findPluginsWithUpdates = ''' | |
Hudson.instance.pluginManager.plugins.inject([]) { List toUpdate, plugin -> | |
if(plugin.hasUpdate()) | |
{ | |
toUpdate << plugin.shortName | |
} | |
toUpdate | |
}.inspect() | |
''' | |
OutputStream updateablePlugins = new ByteArrayOutputStream() |