Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
85753de955 | |||
0441f3c510 | |||
c01eaa0255 | |||
ec7c07f81f | |||
952064d903 |
13
issues/libpit/0000bs5.rst
Normal file
13
issues/libpit/0000bs5.rst
Normal file
@ -0,0 +1,13 @@
|
||||
FileIssue is not formatting output in the same way it parses input.
|
||||
===================================================================
|
||||
|
||||
`FileIssue.formatIssue(Issue)` introduces at least one extra line to the end
|
||||
of the issue body compared to what is parsed in using the PegParser.
|
||||
|
||||
|
||||
----
|
||||
|
||||
========= ===================
|
||||
Created : 2011-12-18T22:53:45
|
||||
Resolved: 2011-12-19T16:09:50
|
||||
========= ===================
|
@ -11,6 +11,10 @@
|
||||
<echo message="GROOVY_HOME: ${env.GROOVY_HOME}"/>
|
||||
</target>
|
||||
|
||||
<target name="clean-all" depends="clean">
|
||||
<delete dir="${release.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="release" depends="build">
|
||||
<mkdir dir="${release.dir}/lib"/>
|
||||
<copy file="${build.dir}/${name}-${version}.${build.number}.jar"
|
||||
|
@ -1,11 +1,11 @@
|
||||
#Thu, 08 Dec 2011 14:35:45 -0600
|
||||
#Mon, 19 Dec 2011 16:21:52 -0600
|
||||
#Sat Apr 24 17:08:00 CDT 2010
|
||||
build.dir=build
|
||||
src.dir=src
|
||||
lib.shared.dir=../shared-libs
|
||||
test.dir=test
|
||||
build.number=0
|
||||
version=3.2.1
|
||||
build.number=1
|
||||
version=3.3.1
|
||||
name=libpit
|
||||
lib.dir=lib
|
||||
lib.local=true
|
||||
|
@ -61,43 +61,45 @@ public class FileIssue extends Issue {
|
||||
}
|
||||
|
||||
public void setCategory(Category c) throws IOException {
|
||||
boolean renamed
|
||||
renamed = source.renameTo(new File(source.canonicalFile.parentFile,
|
||||
makeFilename(id, c, status, priority)))
|
||||
|
||||
if (!renamed)
|
||||
throw new IOException("I was unable to set the category. "
|
||||
File newSource = new File(source.canonicalFile.parentFile,
|
||||
makeFilename(id, c, status, priority))
|
||||
|
||||
if (source.renameTo(newSource)) {
|
||||
source = newSource
|
||||
super.setCategory(c) }
|
||||
else { throw new IOException("I was unable to set the category. "
|
||||
+ "I need to rename the file for this issue, but something is "
|
||||
+ "preventing me from doing so (maybe the path to the file is "
|
||||
+ "no longer valid, or maybe the file is currently open in "
|
||||
+ "some other program).")
|
||||
else super.setCategory(c) }
|
||||
+ "some other program).") }}
|
||||
|
||||
public void setStatus(Status s) throws IOException {
|
||||
boolean renamed
|
||||
renamed = source.renameTo(new File(source.canonicalFile.parentFile,
|
||||
makeFilename(id, category, s, priority)))
|
||||
File newSource = new File(source.canonicalFile.parentFile,
|
||||
makeFilename(id, category, s, priority))
|
||||
|
||||
if (!renamed)
|
||||
throw new IOException("I was unable to set the status. "
|
||||
if (source.renameTo(newSource)) {
|
||||
source = newSource
|
||||
super.setStatus(s) }
|
||||
else { throw new IOException("I was unable to set the status. "
|
||||
+ "I need to rename the file for this issue, but something is "
|
||||
+ "preventing me from doing so (maybe the path to the file is "
|
||||
+ "no longer valid, or maybe the file is currently open in "
|
||||
+ "some other program).")
|
||||
else super.setStatus(s) }
|
||||
+ "some other program).") }}
|
||||
|
||||
public void setPriority(int p) throws IOException {
|
||||
boolean renamed
|
||||
renamed = source.renameTo(new File(source.canonicalFile.parentFile,
|
||||
makeFilename(id, category, status, p)))
|
||||
|
||||
if (!renamed)
|
||||
throw new IOException("I was unable to set the priority. "
|
||||
File newSource = new File(source.canonicalFile.parentFile,
|
||||
makeFilename(id, category, status, p))
|
||||
|
||||
if (source.renameTo(newSource)) {
|
||||
source = newSource
|
||||
super.setPriority(p) }
|
||||
else { throw new IOException("I was unable to set the priority. "
|
||||
+ "I need to rename the file for this issue, but something is "
|
||||
+ "preventing me from doing so (maybe the path to the file is "
|
||||
+ "no longer valid, or maybe the file is currently open in "
|
||||
+ "some other program).")
|
||||
else super.setPriority(p) }
|
||||
+ "some other program).") }}
|
||||
|
||||
public String getFilename() {
|
||||
return makeFilename(id, category, status, priority) }
|
||||
@ -110,6 +112,10 @@ public class FileIssue extends Issue {
|
||||
super.setText(text)
|
||||
writeFile() }
|
||||
|
||||
public def propertyMissing(String name, def value) {
|
||||
super.propertyMissing(name, value)
|
||||
writeFile() }
|
||||
|
||||
boolean deleteFile() { return source.deleteDir() }
|
||||
|
||||
public static boolean isValidFilename(String name) {
|
||||
@ -153,7 +159,7 @@ public class FileIssue extends Issue {
|
||||
|
||||
extOutput[ks] = vs
|
||||
if (ks.length() > maxKeyLen) { maxKeyLen = ks.length() }
|
||||
if (vs.length() > maxKeyLen) { maxValLen = vs.length() } }
|
||||
if (vs.length() > maxValLen) { maxValLen = vs.length() } }
|
||||
|
||||
result.append("=".multiply(maxKeyLen + 1))
|
||||
result.append(" ")
|
||||
|
@ -27,8 +27,8 @@ public class IssuePegParser extends BaseParser<Object> {
|
||||
|
||||
Rule PropertyBlock() {
|
||||
return Sequence(push(makeNode()),
|
||||
HorizontalRule(), OneOrMore(EOL), TableSeparator(), EOL,
|
||||
OneOrMore(PropertyDefinition()), TableSeparator(),
|
||||
EOL, HorizontalRule(), OneOrMore(EOL), TableSeparator(),
|
||||
EOL, OneOrMore(PropertyDefinition()), TableSeparator(),
|
||||
addToNode("extProperties", pop())); }
|
||||
|
||||
Rule PropertyDefinition() {
|
||||
|
@ -20,6 +20,10 @@
|
||||
</fail>
|
||||
</target>
|
||||
|
||||
<target name="clean-all">
|
||||
<delete dir="${release.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="lib">
|
||||
<copy todir="${build.dir}/lib/compile/jar"
|
||||
file="${basedir}/../libpit/release/libpit-${version}.jar"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
#Thu, 08 Dec 2011 14:59:30 -0600
|
||||
#Mon, 19 Dec 2011 16:24:43 -0600
|
||||
build.dir=build
|
||||
src.dir=src
|
||||
build.jar=pit-cli-${application.version}.${build.number}.jar
|
||||
build.number=0
|
||||
version=3.2.1
|
||||
build.number=2
|
||||
version=3.3.1
|
||||
name=pit-cli
|
||||
lib.dir=lib
|
||||
lib.local=true
|
||||
|
@ -13,8 +13,7 @@ import static java.lang.Math.min
|
||||
def cli = new CliBuilder(usage: 'pit-cli [options]')
|
||||
cli.h(longOpt: 'help', 'Show help information.')
|
||||
cli.v(longOpt: 'verbose', 'Show verbose task information')
|
||||
cli.l(longOpt: 'list', 'List issues. Unless otherwise specified it lists all '
|
||||
+ 'sub projects and all unclosed issue categories.')
|
||||
cli.l(longOpt: 'list', 'List issues in the current project.')
|
||||
cli.i(argName: 'id', longOpt: 'id', args: 1,
|
||||
'Filter issues by id. Accepts a comma-delimited list.')
|
||||
cli.c(argName: 'category', longOpt: 'category', args: 1,
|
||||
@ -29,6 +28,7 @@ cli.p(argName: 'priority', longOpt: 'priority', args: 1,
|
||||
cli.r(argName: 'project', longOpt: 'project', args: 1,
|
||||
'Filter issues by project (relative to the current directory). Accepts a '
|
||||
+ 'comma-delimited list.')
|
||||
cli.R(longOpt: 'recursive', 'Include subprojects.')
|
||||
cli.e(argName: 'extended-property', args: 1, 'Filter for issues by extended ' +
|
||||
'property. Format is "-e <propname>=<propvalue>".')
|
||||
/*cli.s(longOpt: 'show-subprojects',
|
||||
@ -83,7 +83,7 @@ cli._(longOpt: 'version', 'Display PIT version information.')
|
||||
// ======== Parse CLI Options ======== //
|
||||
// =================================== //
|
||||
|
||||
def VERSION = "3.2.1"
|
||||
def VERSION = "3.3.1"
|
||||
def opts = cli.parse(args)
|
||||
def issuedb = [:]
|
||||
def workingDir = new File('.')
|
||||
@ -245,6 +245,7 @@ if (opts.l) {
|
||||
if (opts.v) {
|
||||
println ""
|
||||
issue.text.eachLine { println "${offset} ${it}" }
|
||||
println ""
|
||||
issue.extendedProperties.each { name, value ->
|
||||
def formattedValue = ExtendedPropertyHelp.format(value)
|
||||
println "${offset} * ${name}: ${formattedValue}"}
|
||||
@ -260,8 +261,10 @@ if (opts.l) {
|
||||
|
||||
// print all the issues in the root of this db
|
||||
issuedb.eachIssue(filter) { printIssue(it, "") }
|
||||
// print all projects
|
||||
issuedb.eachProject(filter) { printProject(it, "") } }
|
||||
|
||||
if (opts.R) {
|
||||
// print all projects
|
||||
issuedb.eachProject(filter) { printProject(it, "") }} }
|
||||
|
||||
// daily list second
|
||||
else if (opts.D) {
|
||||
@ -294,7 +297,11 @@ else if (opts.D) {
|
||||
if (!opts.o) { filter.issueSorter = [ {it.due}, {it.priority}, {it.id} ] }
|
||||
|
||||
// Get our issues
|
||||
def allIssues = issuedb.getAllIssues(filter)
|
||||
def allIssues = opts.R ?
|
||||
// If -R passed, get all issues, including subprojects.
|
||||
issuedb.getAllIssues(filter) :
|
||||
// Otherwise, just use the issues for this project.
|
||||
issuedb.issues.values().findAll { filter ? filter.accept(it) : true }
|
||||
|
||||
// Set up our time interval.
|
||||
def today = new DateMidnight()
|
||||
@ -309,6 +316,14 @@ else if (opts.D) {
|
||||
if (issue.due) println "${issue.due.toString('EEE, MM/dd')} -- ${issue}"
|
||||
else println " -- ${issue}" }
|
||||
|
||||
def priorityDateSorter = { i1, i2 ->
|
||||
if (i1.priority == i2.priority) {
|
||||
def d1 = i1.due ?: new DateTime()
|
||||
def d2 = i2.due ?: new DateTime()
|
||||
|
||||
return d1.compareTo(d2) }
|
||||
else { return i1.priority - i2.priority }}
|
||||
|
||||
// Sort the issues into seperate lists based on their due dates and
|
||||
// reminders.
|
||||
allIssues.each { issue ->
|
||||
@ -332,7 +347,7 @@ else if (opts.D) {
|
||||
println "Tasks Scheduled for Today"
|
||||
println "-------------------------"
|
||||
|
||||
scheduledToday.each { printIssue(it) }
|
||||
scheduledToday.sort(priorityDateSorter).each { printIssue(it) }
|
||||
|
||||
println "" }
|
||||
|
||||
@ -340,7 +355,7 @@ else if (opts.D) {
|
||||
println "Tasks Due Today"
|
||||
println "---------------"
|
||||
|
||||
dueToday.each { printIssue(it) }
|
||||
dueToday.sort(priorityDateSorter).each { printIssue(it) }
|
||||
|
||||
println ""}
|
||||
|
||||
@ -348,7 +363,7 @@ else if (opts.D) {
|
||||
println "Upcoming Tasks"
|
||||
println "--------------"
|
||||
|
||||
reminderToday.each { printIssue(it) }
|
||||
reminderToday.sort(priorityDateSorter).each { printIssue(it) }
|
||||
|
||||
println ""}
|
||||
|
||||
@ -356,7 +371,7 @@ else if (opts.D) {
|
||||
println "Other Open Issues"
|
||||
println "-----------------"
|
||||
|
||||
notDueOrReminder.each { printIssue(it) }
|
||||
notDueOrReminder.sort(priorityDateSorter).each { printIssue(it) }
|
||||
|
||||
println "" }}
|
||||
|
||||
@ -430,11 +445,16 @@ else if (assignOpts.size() > 0) {
|
||||
case Status.REJECTED: assignOpts.rejected = new DateTime(); break
|
||||
default: break }}
|
||||
|
||||
issuedb.walkProject(filter) { issue ->
|
||||
def processIssue = { issue ->
|
||||
println issue
|
||||
assignOpts.each { propName, value ->
|
||||
issue[propName] = value
|
||||
def formattedValue = ExtendedPropertyHelp.format(value)
|
||||
println " set ${propName} to ${formattedValue}" } }}
|
||||
|
||||
println " set ${propName} to ${formattedValue}" } }
|
||||
|
||||
if (opts.R) { issuedb.walkProject(filter, processIssue) }
|
||||
else {
|
||||
issuedb.issues.values()
|
||||
.findAll { filter ? filter.accept(it) : true }
|
||||
.each(processIssue) }}
|
||||
else { cli.usage(); return -1 }}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user