Created
May 6, 2013 14:58
-
-
Save atosimitu/5525683 to your computer and use it in GitHub Desktop.
multiple space issue counts ( use backlog4j https://github.com/hakurai/backlog4j )
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
#!/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)) | |
} | |
} |
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
{ | |
"spaces":[ | |
{"spaceid": "backlog", "username": "guest", "password": "guest" }, | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cat spaces.json | ./crosslog.groovy