Skip to content

Instantly share code, notes, and snippets.

@atosimitu
Created May 6, 2013 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atosimitu/5525683 to your computer and use it in GitHub Desktop.
Save atosimitu/5525683 to your computer and use it in GitHub Desktop.
multiple space issue counts ( use backlog4j https://github.com/hakurai/backlog4j )
#!/usr/bin/env groovy
@Grapes(
@Grab(group='org.backlog4j', module='backlog4j', version='0.5.0')
)
import groovy.json.JsonSlurper
import backlog4j.BacklogClientFactory
import backlog4j.conf.BacklogConfigureBuilder
class CrossLog {
def getConfigure(space){
def configure = new BacklogConfigureBuilder()
.setSpaceId(space.spaceid)
.setUsername(space.username)
.setPassword(space.password)
.buildBacklogConfigure()
return configure
}
def countIssue(spaces) {
def count = 0
def countIssueCommand = { space ->
def backlogClient = new BacklogClientFactory(getConfigure(space)).newBacklogClient()
backlogClient.getProjects().execute().each{ project ->
println project.name
count += backlogClient.countIssue().setProjectId(project.id).addStatusId(1).addStatusId(2).addStatusId(3).execute()
}
}
spaces.each(countIssueCommand)
return count
}
static void main(args) {
println ((new CrossLog()).countIssue((new JsonSlurper().parseText( System.in.text )).spaces))
}
}
{
"spaces":[
{"spaceid": "backlog", "username": "guest", "password": "guest" },
]
}
@atosimitu
Copy link
Author

cat spaces.json | ./crosslog.groovy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment