Bugfix in defaultSorters for Filter

This commit is contained in:
Jonathan Bernard 2010-02-21 16:09:13 -06:00
parent 8ffd3ccdf3
commit d642be27e8
12 changed files with 22 additions and 20 deletions

View File

@ -1,10 +1,10 @@
#Sun Feb 21 15:42:19 CST 2010
#Sun Feb 21 16:03:56 CST 2010
build.dir=build
src.dir=src
lib.shared.dir=../shared-libs
test.dir=test
build.number=64
expected.application.version=1.1.2
build.number=1
expected.application.version=1.1.3
lib.dir=lib
release.dir=release
release.jar=pit-${application.version}.jar

Binary file not shown.

Binary file not shown.

View File

@ -7,8 +7,8 @@ class Filter {
List<String> ids = null
int priority = 9
boolean acceptProjects = true
Closure projectSorter = defaultIssueSorter
Closure issueSorter = defaultProjectSorter
Closure issueSorter = defaultIssueSorter
Closure projectSorter = defaultProjectSorter
public static Closure defaultIssueSorter = { it.id.toInteger() }
public static Closure defaultProjectSorter = { it.name }

Binary file not shown.

BIN
pit-cli/lib/pit-1.1.3.jar Normal file

Binary file not shown.

View File

@ -1,9 +1,9 @@
#Thu Feb 18 11:26:18 CST 2010
#Sun Feb 21 16:05:16 CST 2010
build.dir=build
src.dir=src
build.jar=pit-cli-${application.version}.${build.number}.jar
build.number=1
expected.application.version=1.1.1
expected.application.version=1.1.3
lib.dir=lib
release.dir=release
release.jar=pit-cli-${application.version}.jar

View File

@ -40,13 +40,15 @@ if (opts.c) categories = opts.c.split(/[,\s]/)
categories = categories.collect { Category.toCategory(it) }
// build issue list
issuedb = new Project(new File('.'),
new Filter('categories': categories,
issuedb = new FileProject(new File('.'))
// build filter from options
def filter = new Filter('categories': categories,
'priority': (opts.p ? opts.p.toInteger() : 9),
'projects': (opts.r ? opts.r.toLowerCase().split(/[,\s]/).asType(List.class) : []),
'ids': (opts.i ? opts.i.split(/[,\s]/).asType(List.class) : []),
'acceptProjects': (opts.s || !opts.S)))
'acceptProjects': (opts.s || !opts.S))
// list first
if (opts.l) {
def issuePrinter = { issue, offset ->
@ -62,12 +64,12 @@ if (opts.l) {
projectPrinter = { project, offset ->
println "\n${offset}${project.name}"
println "${offset}${'-'.multiply(project.name.length())}"
project.eachIssue { issuePrinter.call(it, offset) }
project.eachProject { projectPrinter.call(it, offset + " ") }
project.eachIssue(filter) { issuePrinter.call(it, offset) }
project.eachProject(filter) { projectPrinter.call(it, offset + " ") }
}
issuedb.eachIssue { issuePrinter.call(it, "") }
issuedb.eachProject { projectPrinter.call(it, "") }
issuedb.eachProject(filter) { projectPrinter.call(it, "") }
}
@ -77,7 +79,7 @@ else if (opts.P) {
try { priority = max(0, min(9, opts.P.toInteger())) }
catch (e) { println "Invalid priority: ${opts.P}"; return 1 }
walkProject(issuedb) { it.priority = priority }
walkProject(issuedb, filter) { it.priority = priority }
}
// change category third
else if (opts.C) {
@ -85,7 +87,7 @@ else if (opts.C) {
try { cat = Category.toCategory(opts.C) }
catch (e) { println "Invalid category: ${opts.C}"; return 1 }
walkProject(issuedb) { it.category = cat }
walkProject(issued, filterb) { it.category = cat }
}
// new entry last
else if (opts.n) {
@ -131,7 +133,7 @@ else if (opts.n) {
println issue
}
def walkProject(Project p, Closure c) {
p.eachIssue(c)
p.eachProject { walkProject(it, c) }
def walkProject(Project p, Filter filter, Closure c) {
p.eachIssue(filter, c)
p.eachProject(filter) { walkProject(it, filter, c) }
}

View File

@ -1 +1 @@
application.version=1.1.2
application.version=1.1.3