Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pj-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.project
/.classpath
/.settings/
/target/
/bulldozer-temp.json
/bulldozer-state.json
/.factorypath
/dependency-reduced-pom.xml
62 changes: 62 additions & 0 deletions pj-cli/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>pj-cli</artifactId>

<parent>
<groupId>com.g2forge.project</groupId>
<artifactId>pj-project</artifactId>
<version>0.0.2-SNAPSHOT</version>
<relativePath>../pj-project/pom.xml</relativePath>
</parent>

<name>Project CLI</name>
<description>Command line interface for Project.</description>

<dependencies>
<dependency>
<groupId>com.g2forge.project</groupId>
<artifactId>pj-plan</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.g2forge.project</groupId>
<artifactId>pj-create</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.g2forge.project</groupId>
<artifactId>pj-report</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.g2forge.project.cli.Project</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
12 changes: 12 additions & 0 deletions pj-cli/src/main/java/com/g2forge/project/cli/Project.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.g2forge.project.cli;

import com.g2forge.alexandria.command.command.DispatchCommand;
import com.g2forge.alexandria.command.command.IStandardCommand;
import com.g2forge.alexandria.command.command.IStructuredCommand;
import com.g2forge.project.core.IProjectCommand;

public class Project implements IStructuredCommand {
public static void main(String[] args) throws Throwable {
IStandardCommand.main(args, DispatchCommand.createAnnotation(IProjectCommand.class));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.g2forge.project.core;

import com.g2forge.alexandria.command.command.IStandardCommand;

public interface IProjectCommand extends IStandardCommand {}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.atlassian.jira.rest.client.api.domain.input.TransitionInput;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.g2forge.alexandria.annotations.service.Service;
import com.g2forge.alexandria.command.command.IStandardCommand;
import com.g2forge.alexandria.command.exit.IExit;
import com.g2forge.alexandria.command.invocation.CommandInvocation;
Expand All @@ -46,6 +47,7 @@
import com.g2forge.gearbox.jira.JiraAPI;
import com.g2forge.gearbox.jira.fields.KnownField;
import com.g2forge.project.core.HConfig;
import com.g2forge.project.core.IProjectCommand;
import com.g2forge.project.core.Server;
import com.g2forge.project.plan.create.CreateIssue.CreateIssueBuilder;
import com.google.common.base.Objects;
Expand Down Expand Up @@ -153,7 +155,8 @@
* </tbody>
* </table>
*/
public class Create implements IStandardCommand {
@Service(IProjectCommand.class)
public class Create implements IProjectCommand {
@Data
@Builder
@AllArgsConstructor
Expand Down
23 changes: 20 additions & 3 deletions pj-plan/src/main/java/com/g2forge/project/plan/Plan.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
package com.g2forge.project.plan;

import java.io.InputStream;
import java.io.PrintStream;

import com.g2forge.alexandria.annotations.service.Service;
import com.g2forge.alexandria.command.command.DispatchCommand;
import com.g2forge.alexandria.command.command.IStructuredCommand;
import com.g2forge.alexandria.command.exit.IExit;
import com.g2forge.alexandria.command.invocation.CommandInvocation;
import com.g2forge.project.core.IProjectCommand;

public class Plan implements IStructuredCommand {
public static void main(String[] args) throws Throwable {
@Service(IProjectCommand.class)
public class Plan implements IProjectCommand, IStructuredCommand {
protected static DispatchCommand.ManualBuilder build() {
final DispatchCommand.ManualBuilder builder = new DispatchCommand.ManualBuilder();
builder.command(new Download(), "download");
builder.command(new Sprints(), "sprints");
builder.main(args);
return builder;
}

public static void main(String[] args) throws Throwable {
build().main(args);
}

@Override
public IExit invoke(CommandInvocation<?, InputStream, PrintStream> invocation) throws Throwable {
return build().invoke(invocation);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.atlassian.jira.rest.client.api.domain.User;
import com.g2forge.alexandria.adt.associative.cache.Cache;
import com.g2forge.alexandria.adt.associative.cache.NeverCacheEvictionPolicy;
import com.g2forge.alexandria.annotations.service.Service;
import com.g2forge.alexandria.command.command.IStandardCommand;
import com.g2forge.alexandria.command.exit.IExit;
import com.g2forge.alexandria.command.invocation.CommandInvocation;
Expand All @@ -45,6 +46,7 @@
import com.g2forge.alexandria.java.function.IFunction1;
import com.g2forge.alexandria.java.function.IPredicate1;
import com.g2forge.alexandria.java.function.builder.IBuilder;
import com.g2forge.alexandria.java.io.dataaccess.PathDataSink;
import com.g2forge.alexandria.java.io.dataaccess.PathDataSource;
import com.g2forge.alexandria.log.HLog;
import com.g2forge.alexandria.match.HMatch;
Expand All @@ -54,6 +56,7 @@
import com.g2forge.gearbox.jira.JiraAPI;
import com.g2forge.gearbox.jira.fields.KnownField;
import com.g2forge.project.core.HConfig;
import com.g2forge.project.core.IProjectCommand;
import com.g2forge.project.core.Server;

import lombok.AllArgsConstructor;
Expand All @@ -64,7 +67,8 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class Billing implements IStandardCommand {
@Service(IProjectCommand.class)
public class Billing implements IProjectCommand {
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
Expand Down Expand Up @@ -327,7 +331,7 @@ public IExit invoke(CommandInvocation<?, InputStream, PrintStream> invocation) t
final String filename = Filename.fromPath(arguments.getRequest()).getPrefix().toString() + " (" + DATE_FORMAT_FILENAME.format(request.getStart()) + " to " + DATE_FORMAT_FILENAME.format(request.getEnd()) + ").csv";
final Path outputFile = outputDirectory.resolve(filename);
log.info("Writing bill to {}", outputFile);
BillLine.getMapper().write(billLines, outputFile);
BillLine.getMapper().write(billLines, new PathDataSink(outputFile));
}

log.info("Bill by user");
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<module>pj-create</module>
<module>pj-plan</module>
<module>pj-report</module>
<module>pj-cli</module>
</modules>
</project>
Loading