Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Move ZanataClient to new module zanata-cli; add push command
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Dec 11, 2012
1 parent 769f215 commit 28d69d2
Show file tree
Hide file tree
Showing 17 changed files with 269 additions and 61 deletions.
5 changes: 3 additions & 2 deletions .gitignore
@@ -1,8 +1,9 @@
/target/
/*/target/
*~
/.settings
/.project
.classpath
.project
.settings
*.iml
*/bin/
test-output/
6 changes: 6 additions & 0 deletions pom.xml
Expand Up @@ -25,6 +25,11 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-cli</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-client-commands</artifactId>
Expand Down Expand Up @@ -64,6 +69,7 @@
</dependencyManagement>

<modules>
<module>zanata-cli</module>
<module>zanata-client-commands</module>
<module>zanata-maven-plugin</module>
<module>zanata-rest-client</module>
Expand Down
2 changes: 2 additions & 0 deletions zanata-cli/etc/scripts/zanataj
@@ -0,0 +1,2 @@
#!/bin/bash -e
exec mvn -q exec:java -Dexec.args="$*"
63 changes: 63 additions & 0 deletions zanata-cli/pom.xml
@@ -0,0 +1,63 @@
<?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>
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>2.0.2-SNAPSHOT</version>
</parent>
<artifactId>zanata-cli</artifactId>
<name>Zanata command-line client</name>

<!-- Should be the same as zanata-client/pom.xml -->
<scm>
<connection>scm:git:git://github.com/zanata/zanata-client.git</connection>
<developerConnection>scm:git:git@github.com:zanata/zanata-client.git</developerConnection>
<url>https://github.com/zanata/zanata-client</url>
</scm>

<build>
<plugins>
<plugin>
<!-- See the script etc/zanataj -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.zanata.client.ZanataClient</mainClass>
<!-- mainly to get logging working: -->
<classpathScope>test</classpathScope>
</configuration>
</plugin>
</plugins>
</build>


<dependencies>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-client-commands</artifactId>
</dependency>
</dependencies>
</project>
Expand Up @@ -14,13 +14,14 @@
import org.zanata.client.commands.BasicOptions;
import org.zanata.client.commands.BasicOptionsImpl;
import org.zanata.client.commands.ListRemoteOptionsImpl;
import org.zanata.client.commands.PublicanPullOptionsImpl;
import org.zanata.client.commands.PublicanPushOptionsImpl;
//import org.zanata.client.commands.PublicanPullOptionsImpl;
//import org.zanata.client.commands.PublicanPushOptionsImpl;
import org.zanata.client.commands.PutProjectOptionsImpl;
import org.zanata.client.commands.PutUserOptionsImpl;
import org.zanata.client.commands.PutVersionOptionsImpl;
import org.zanata.client.commands.SystemExitStrategy;
import org.zanata.client.commands.ZanataCommand;
import org.zanata.client.commands.push.PushOptionsImpl;
import org.zanata.client.commands.stats.GetStatisticsOptionsImpl;
import org.zanata.util.VersionUtility;

Expand Down Expand Up @@ -53,7 +54,7 @@ public ZanataCommand initCommand()
/**
* Only for testing (allows access to optionsMap)
*/
public ZanataClient()
ZanataClient()
{
this(new SystemExitStrategy(), System.out, System.err);
}
Expand All @@ -65,8 +66,10 @@ public ZanataClient(AppAbortStrategy strategy, PrintStream out, PrintStream err)
this.err = err;
// getOptionsMap().put("listlocal", new ListLocalOptionsImpl());
getOptionsMap().put("listremote", new ListRemoteOptionsImpl());
getOptionsMap().put("publican-push", new PublicanPushOptionsImpl());
getOptionsMap().put("publican-pull", new PublicanPullOptionsImpl());
// getOptionsMap().put("publican-push", new PublicanPushOptionsImpl());
// getOptionsMap().put("publican-pull", new PublicanPullOptionsImpl());
// getOptionsMap().put("pull", new PullOptionsImpl());
getOptionsMap().put("push", new PushOptionsImpl());
getOptionsMap().put("putproject", new PutProjectOptionsImpl());
getOptionsMap().put("putuser", new PutUserOptionsImpl());
getOptionsMap().put("putversion", new PutVersionOptionsImpl());
Expand Down
14 changes: 14 additions & 0 deletions zanata-cli/src/main/resources/log4j.xml
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<param name="threshold" value="info"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p [%c{1}] - %m%n" />
</layout>
</appender>
<root>
<level value="info" />
<appender-ref ref="STDOUT" />
</root>
</log4j:configuration>
3 changes: 0 additions & 3 deletions zanata-client-commands/.gitignore

This file was deleted.

12 changes: 6 additions & 6 deletions zanata-client-commands/pom.xml
Expand Up @@ -9,12 +9,12 @@
<artifactId>zanata-client-commands</artifactId>
<name>Zanata client commands</name>

<!-- Should be the same as zanata-client/pom.xml -->
<scm>
<connection>scm:git:git://github.com/zanata/zanata-client.git</connection>
<developerConnection>scm:git:git@github.com:zanata/zanata-client.git</developerConnection>
<url>https://github.com/zanata/zanata-client</url>
</scm>
<!-- Should be the same as zanata-client/pom.xml -->
<scm>
<connection>scm:git:git://github.com/zanata/zanata-client.git</connection>
<developerConnection>scm:git:git@github.com:zanata/zanata-client.git</developerConnection>
<url>https://github.com/zanata/zanata-client</url>
</scm>

<dependencies>
<dependency>
Expand Down
Expand Up @@ -31,7 +31,7 @@ public interface ConfigurableProjectOptions extends ConfigurableOptions

public String getProjectType();

@Option(name = "--project-type", metaVar = "PROJTYPE", usage = "Project type This value is required unless specified in zanata.xml.")
@Option(aliases = { "-T" }, name = "--project-type", metaVar = "PROJTYPE", usage = "Project type This value is required unless specified in zanata.xml.")
public void setProjectType(String projectType);

public File getProjectConfig();
Expand Down
Expand Up @@ -160,4 +160,8 @@ public static ZanataProxyFactory createRequestFactory(ConfigurableOptions opts)
}
}

public boolean parseBoolean(String s)
{
return Boolean.parseBoolean(s);
}
}
Expand Up @@ -108,6 +108,7 @@ public static void logOptions(Logger logger, PullOptions opts)
}
logger.info("Locales to pull: {}", opts.getLocaleMapList());
logger.info("Encode tab as \\t: {}", opts.getEncodeTabs());
logger.info("Current directory: {}", System.getProperty("user.dir"));
if (opts.getPullType() == PushPullType.Source)
{
logger.info("Pulling source documents only");
Expand Down
Expand Up @@ -151,6 +151,7 @@ else if (opts.getPushType() == PushPullType.Source)
logger.info("Pushing source and target documents");
logger.info("Locales to push: {}", opts.getLocaleMapList());
}
logger.info("Current directory: {}", System.getProperty("user.dir"));
logger.info("Source directory (originals): {}", opts.getSrcDir());
if (opts.getPushType() == PushPullType.Both || opts.getPushType() == PushPullType.Trans)
{
Expand Down

0 comments on commit 28d69d2

Please sign in to comment.