<classpathentry kind="lib" path="ext/dagger-compiler-1.1.0.jar" sourcepath="ext/src/dagger-compiler-1.1.0.jar" /> | <classpathentry kind="lib" path="ext/dagger-compiler-1.1.0.jar" sourcepath="ext/src/dagger-compiler-1.1.0.jar" /> | ||||
<classpathentry kind="lib" path="ext/javawriter-2.1.1.jar" sourcepath="ext/src/javawriter-2.1.1.jar" /> | <classpathentry kind="lib" path="ext/javawriter-2.1.1.jar" sourcepath="ext/src/javawriter-2.1.1.jar" /> | ||||
<classpathentry kind="lib" path="ext/annotations-12.0.jar" sourcepath="ext/src/annotations-12.0.jar" /> | <classpathentry kind="lib" path="ext/annotations-12.0.jar" sourcepath="ext/src/annotations-12.0.jar" /> | ||||
<classpathentry kind="lib" path="ext/jcommander-1.17.jar" sourcepath="ext/src/jcommander-1.17.jar" /> | |||||
<classpathentry kind="lib" path="ext/log4j-1.2.17.jar" sourcepath="ext/src/log4j-1.2.17.jar" /> | <classpathentry kind="lib" path="ext/log4j-1.2.17.jar" sourcepath="ext/src/log4j-1.2.17.jar" /> | ||||
<classpathentry kind="lib" path="ext/slf4j-api-1.6.6.jar" sourcepath="ext/src/slf4j-api-1.6.6.jar" /> | <classpathentry kind="lib" path="ext/slf4j-api-1.6.6.jar" sourcepath="ext/src/slf4j-api-1.6.6.jar" /> | ||||
<classpathentry kind="lib" path="ext/slf4j-log4j12-1.6.6.jar" sourcepath="ext/src/slf4j-log4j12-1.6.6.jar" /> | <classpathentry kind="lib" path="ext/slf4j-log4j12-1.6.6.jar" sourcepath="ext/src/slf4j-log4j12-1.6.6.jar" /> | ||||
<classpathentry kind="lib" path="ext/jna-3.5.0.jar" sourcepath="ext/src/jna-3.5.0.jar" /> | <classpathentry kind="lib" path="ext/jna-3.5.0.jar" sourcepath="ext/src/jna-3.5.0.jar" /> | ||||
<classpathentry kind="lib" path="ext/guava-13.0.1.jar" sourcepath="ext/src/guava-13.0.1.jar" /> | <classpathentry kind="lib" path="ext/guava-13.0.1.jar" sourcepath="ext/src/guava-13.0.1.jar" /> | ||||
<classpathentry kind="lib" path="ext/libpam4j-1.7.jar" sourcepath="ext/src/libpam4j-1.7.jar" /> | <classpathentry kind="lib" path="ext/libpam4j-1.7.jar" sourcepath="ext/src/libpam4j-1.7.jar" /> | ||||
<classpathentry kind="lib" path="ext/args4j-2.0.26.jar" sourcepath="ext/src/args4j-2.0.26.jar" /> | |||||
<classpathentry kind="lib" path="ext/jedis-2.3.1.jar" sourcepath="ext/src/jedis-2.3.1.jar" /> | <classpathentry kind="lib" path="ext/jedis-2.3.1.jar" sourcepath="ext/src/jedis-2.3.1.jar" /> | ||||
<classpathentry kind="lib" path="ext/commons-pool2-2.0.jar" sourcepath="ext/src/commons-pool2-2.0.jar" /> | <classpathentry kind="lib" path="ext/commons-pool2-2.0.jar" sourcepath="ext/src/commons-pool2-2.0.jar" /> | ||||
<classpathentry kind="lib" path="ext/junit-4.11.jar" sourcepath="ext/src/junit-4.11.jar" /> | <classpathentry kind="lib" path="ext/junit-4.11.jar" sourcepath="ext/src/junit-4.11.jar" /> |
http://junit.org | http://junit.org | ||||
--------------------------------------------------------------------------- | |||||
ant-googlecode | |||||
--------------------------------------------------------------------------- | |||||
ant-googlecode, released under the | |||||
New BSD License | |||||
http://code.google.com/p/ant-googlecode | |||||
--------------------------------------------------------------------------- | |||||
GenJar | |||||
--------------------------------------------------------------------------- | |||||
GenJar, released under the | |||||
Apache Software License, Version 1.1. | |||||
http://genjar.sourceforge.net | |||||
--------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ||||
Fancybox image viewer | Fancybox image viewer | ||||
--------------------------------------------------------------------------- | --------------------------------------------------------------------------- | ||||
MIT license | MIT license | ||||
https://github.com/xetorthio/jedis | https://github.com/xetorthio/jedis | ||||
--------------------------------------------------------------------------- | |||||
args4j | |||||
--------------------------------------------------------------------------- | |||||
args4j, release under the | |||||
Apache License 2.0 | |||||
http://args4j.kohsuke.org |
- compile 'com.squareup.dagger:dagger-compiler:1.1.0' :war optional apt | - compile 'com.squareup.dagger:dagger-compiler:1.1.0' :war optional apt | ||||
# Standard dependencies | # Standard dependencies | ||||
- compile 'com.intellij:annotations:12.0' :war | - compile 'com.intellij:annotations:12.0' :war | ||||
- compile 'com.beust:jcommander:1.17' :fedclient :authority | |||||
- compile 'log4j:log4j:1.2.17' :war :fedclient :authority | - compile 'log4j:log4j:1.2.17' :war :fedclient :authority | ||||
- compile 'org.slf4j:slf4j-api:1.6.6' :war :fedclient :authority | - compile 'org.slf4j:slf4j-api:1.6.6' :war :fedclient :authority | ||||
- compile 'org.slf4j:slf4j-log4j12:1.6.6' :war :fedclient :authority | - compile 'org.slf4j:slf4j-log4j12:1.6.6' :war :fedclient :authority | ||||
- compile 'org.freemarker:freemarker:2.3.19' :war | - compile 'org.freemarker:freemarker:2.3.19' :war | ||||
- compile 'com.github.dblock.waffle:waffle-jna:1.5' :war | - compile 'com.github.dblock.waffle:waffle-jna:1.5' :war | ||||
- compile 'org.kohsuke:libpam4j:1.7' :war | - compile 'org.kohsuke:libpam4j:1.7' :war | ||||
- compile 'args4j:args4j:2.0.26' :war :fedclient :authority | |||||
- compile 'commons-codec:commons-codec:1.7' :war | - compile 'commons-codec:commons-codec:1.7' :war | ||||
- compile 'redis.clients:jedis:2.3.1' :war | - compile 'redis.clients:jedis:2.3.1' :war | ||||
- test 'junit' | - test 'junit' |
</SOURCES> | </SOURCES> | ||||
</library> | </library> | ||||
</orderEntry> | </orderEntry> | ||||
<orderEntry type="module-library"> | |||||
<library name="jcommander-1.17.jar"> | |||||
<CLASSES> | |||||
<root url="jar://$MODULE_DIR$/ext/jcommander-1.17.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC /> | |||||
<SOURCES> | |||||
<root url="jar://$MODULE_DIR$/ext/src/jcommander-1.17.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</orderEntry> | |||||
<orderEntry type="module-library"> | <orderEntry type="module-library"> | ||||
<library name="log4j-1.2.17.jar"> | <library name="log4j-1.2.17.jar"> | ||||
<CLASSES> | <CLASSES> | ||||
</SOURCES> | </SOURCES> | ||||
</library> | </library> | ||||
</orderEntry> | </orderEntry> | ||||
<orderEntry type="module-library"> | |||||
<library name="args4j-2.0.26.jar"> | |||||
<CLASSES> | |||||
<root url="jar://$MODULE_DIR$/ext/args4j-2.0.26.jar!/" /> | |||||
</CLASSES> | |||||
<JAVADOC /> | |||||
<SOURCES> | |||||
<root url="jar://$MODULE_DIR$/ext/src/args4j-2.0.26.jar!/" /> | |||||
</SOURCES> | |||||
</library> | |||||
</orderEntry> | |||||
<orderEntry type="module-library"> | <orderEntry type="module-library"> | ||||
<library name="jedis-2.3.1.jar"> | <library name="jedis-2.3.1.jar"> | ||||
<CLASSES> | <CLASSES> |
- Repository mailing lists could not be reset from the Edit Repository page (issue-399) | - Repository mailing lists could not be reset from the Edit Repository page (issue-399) | ||||
- Ensure the Lucene ticket index is updated on repository deletion. | - Ensure the Lucene ticket index is updated on repository deletion. | ||||
changes: | changes: | ||||
- Option to allow LDAP users to directly authenticate without performing LDAP searches | |||||
- Option to allow LDAP users to directly authenticate without performing LDAP searches (pr-162)) | |||||
- Replace JCommander with args4j to be consistent with other tools (ticket-28) | |||||
additions: | additions: | ||||
- Added a French translation | |||||
dependencyChanges: ~ | |||||
- Added a French translation (pr-163) | |||||
dependencyChanges: | |||||
- args4j 2.0.26 | |||||
contributors: | contributors: | ||||
- James Moger | |||||
- David Ostrovsky | |||||
- Johann Ollivier-Lapeyre | - Johann Ollivier-Lapeyre | ||||
- Jeremie Brebec | - Jeremie Brebec | ||||
settings: | settings: |
import org.eclipse.jgit.lib.StoredConfig; | import org.eclipse.jgit.lib.StoredConfig; | ||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder; | import org.eclipse.jgit.storage.file.FileRepositoryBuilder; | ||||
import org.eclipse.jgit.util.FS; | import org.eclipse.jgit.util.FS; | ||||
import org.kohsuke.args4j.CmdLineException; | |||||
import org.kohsuke.args4j.CmdLineParser; | |||||
import org.kohsuke.args4j.Option; | |||||
import com.beust.jcommander.JCommander; | |||||
import com.beust.jcommander.Parameter; | |||||
import com.beust.jcommander.ParameterException; | |||||
import com.beust.jcommander.Parameters; | |||||
import com.gitblit.models.RefModel; | import com.gitblit.models.RefModel; | ||||
import com.gitblit.utils.ArrayUtils; | import com.gitblit.utils.ArrayUtils; | ||||
import com.gitblit.utils.JGitUtils; | import com.gitblit.utils.JGitUtils; | ||||
public static void main(String... args) { | public static void main(String... args) { | ||||
Params params = new Params(); | Params params = new Params(); | ||||
JCommander jc = new JCommander(params); | |||||
CmdLineParser parser = new CmdLineParser(params); | |||||
try { | try { | ||||
jc.parse(args); | |||||
} catch (ParameterException t) { | |||||
parser.parseArgument(args); | |||||
} catch (CmdLineException t) { | |||||
System.err.println(t.getMessage()); | System.err.println(t.getMessage()); | ||||
jc.usage(); | |||||
parser.printUsage(System.out); | |||||
return; | return; | ||||
} | } | ||||
Set<String> indexedBranches = new LinkedHashSet<String>(); | Set<String> indexedBranches = new LinkedHashSet<String>(); | ||||
// add all local branches to index | // add all local branches to index | ||||
if(params.addAllLocalBranches) { | |||||
if (params.addAllLocalBranches) { | |||||
List<RefModel> list = JGitUtils.getLocalBranches(repository, true, -1); | List<RefModel> list = JGitUtils.getLocalBranches(repository, true, -1); | ||||
for (RefModel refModel : list) { | for (RefModel refModel : list) { | ||||
System.out.println(MessageFormat.format("adding [gitblit] indexBranch={0} for {1}", refModel.getName(), repo)); | System.out.println(MessageFormat.format("adding [gitblit] indexBranch={0} for {1}", refModel.getName(), repo)); | ||||
/** | /** | ||||
* JCommander Parameters class for AddIndexedBranch. | |||||
* Parameters class for AddIndexedBranch. | |||||
*/ | */ | ||||
@Parameters(separators = " ") | |||||
private static class Params { | private static class Params { | ||||
@Parameter(names = { "--repositoriesFolder" }, description = "The root repositories folder ", required = true) | |||||
@Option(name = "--repositoriesFolder", usage = "The root repositories folder ", required = true, metaVar = "PATH") | |||||
public String folder; | public String folder; | ||||
@Parameter(names = { "--branch" }, description = "The branch to index", required = false) | |||||
@Option(name = "--branch", usage = "The branch to index", metaVar = "BRANCH") | |||||
public String branch = "default"; | public String branch = "default"; | ||||
@Parameter(names = { "--skip" }, description = "Skip the named repository (simple fizzy matching is supported)", required = false) | |||||
@Option(name = "--skip", usage = "Skip the named repository (simple fizzy matching is supported)") | |||||
public List<String> exclusions = new ArrayList<String>(); | public List<String> exclusions = new ArrayList<String>(); | ||||
@Parameter(names = { "--all-local-branches" }, description = "Add all local branches to index. If specified, the --branch parameter is not considered.", required = false) | |||||
public boolean addAllLocalBranches = false; | |||||
@Option(name = "--all-local-branches", usage = "Add all local branches to index. If specified, the --branch parameter is not considered.") | |||||
public boolean addAllLocalBranches; | |||||
} | } | ||||
} | } |
import java.util.Collection; | import java.util.Collection; | ||||
import java.util.List; | import java.util.List; | ||||
import com.beust.jcommander.JCommander; | |||||
import com.beust.jcommander.Parameter; | |||||
import com.beust.jcommander.ParameterException; | |||||
import com.beust.jcommander.Parameters; | |||||
import org.kohsuke.args4j.CmdLineException; | |||||
import org.kohsuke.args4j.CmdLineParser; | |||||
import org.kohsuke.args4j.Option; | |||||
import com.gitblit.manager.FederationManager; | import com.gitblit.manager.FederationManager; | ||||
import com.gitblit.manager.GitblitManager; | import com.gitblit.manager.GitblitManager; | ||||
import com.gitblit.manager.IGitblit; | import com.gitblit.manager.IGitblit; | ||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
Params params = new Params(); | Params params = new Params(); | ||||
JCommander jc = new JCommander(params); | |||||
CmdLineParser parser = new CmdLineParser(params); | |||||
try { | try { | ||||
jc.parse(args); | |||||
} catch (ParameterException t) { | |||||
usage(jc, t); | |||||
parser.parseArgument(args); | |||||
} catch (CmdLineException t) { | |||||
usage(parser, t); | |||||
} | } | ||||
System.out.println("Gitblit Federation Client v" + Constants.getVersion() + " (" + Constants.getBuildDate() + ")"); | System.out.println("Gitblit Federation Client v" + Constants.getVersion() + " (" + Constants.getBuildDate() + ")"); | ||||
model.token = params.token; | model.token = params.token; | ||||
model.mirror = params.mirror; | model.mirror = params.mirror; | ||||
model.bare = params.bare; | model.bare = params.bare; | ||||
model.frequency = params.frequency; | |||||
model.folder = ""; | model.folder = ""; | ||||
registrations.add(model); | registrations.add(model); | ||||
} | } | ||||
System.exit(0); | System.exit(0); | ||||
} | } | ||||
private static void usage(JCommander jc, ParameterException t) { | |||||
private static void usage(CmdLineParser parser, CmdLineException t) { | |||||
System.out.println(Constants.getGitBlitVersion()); | System.out.println(Constants.getGitBlitVersion()); | ||||
System.out.println(); | System.out.println(); | ||||
if (t != null) { | if (t != null) { | ||||
System.out.println(); | System.out.println(); | ||||
} | } | ||||
if (jc != null) { | |||||
jc.usage(); | |||||
if (parser != null) { | |||||
parser.printUsage(System.out); | |||||
} | } | ||||
System.exit(0); | System.exit(0); | ||||
} | } | ||||
/** | /** | ||||
* JCommander Parameters class for FederationClient. | |||||
* Parameters class for FederationClient. | |||||
*/ | */ | ||||
@Parameters(separators = " ") | |||||
private static class Params { | private static class Params { | ||||
@Parameter(names = { "--registrations" }, description = "Gitblit Federation Registrations File", required = false) | |||||
@Option(name = "--registrations", usage = "Gitblit Federation Registrations File", metaVar = "FILE") | |||||
public String registrationsFile = "${baseFolder}/federation.properties"; | public String registrationsFile = "${baseFolder}/federation.properties"; | ||||
@Parameter(names = { "--url" }, description = "URL of Gitblit instance to mirror from", required = false) | |||||
@Option(name = "--url", usage = "URL of Gitblit instance to mirror from", metaVar = "URL") | |||||
public String url; | public String url; | ||||
@Parameter(names = { "--mirror" }, description = "Mirror repositories", required = false) | |||||
@Option(name = "--mirror", usage = "Mirror repositories") | |||||
public boolean mirror; | public boolean mirror; | ||||
@Parameter(names = { "--bare" }, description = "Create bare repositories", required = false) | |||||
@Option(name = "--bare", usage = "Create bare repositories") | |||||
public boolean bare; | public boolean bare; | ||||
@Parameter(names = { "--token" }, description = "Federation Token", required = false) | |||||
@Option(name = "--token", usage = "Federation Token", metaVar = "TOKEN") | |||||
public String token; | public String token; | ||||
@Parameter(names = { "--frequency" }, description = "Period to wait between pull attempts (requires --daemon)", required = false) | |||||
public String frequency = "60 mins"; | |||||
@Parameter(names = { "--baseFolder" }, description = "Base folder for received data", required = false) | |||||
@Option(name = "--baseFolder", usage = "Base folder for received data", metaVar = "PATH") | |||||
public String baseFolder; | public String baseFolder; | ||||
@Parameter(names = { "--repositoriesFolder" }, description = "Destination folder for cloned repositories", required = false) | |||||
@Option(name = "--repositoriesFolder", usage = "Destination folder for cloned repositories", metaVar = "PATH") | |||||
public String repositoriesFolder; | public String repositoriesFolder; | ||||
} | } |
import org.eclipse.jgit.storage.file.FileBasedConfig; | import org.eclipse.jgit.storage.file.FileBasedConfig; | ||||
import org.eclipse.jgit.util.FS; | import org.eclipse.jgit.util.FS; | ||||
import org.eclipse.jgit.util.FileUtils; | import org.eclipse.jgit.util.FileUtils; | ||||
import org.kohsuke.args4j.CmdLineException; | |||||
import org.kohsuke.args4j.CmdLineParser; | |||||
import org.kohsuke.args4j.Option; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import com.beust.jcommander.JCommander; | |||||
import com.beust.jcommander.Parameter; | |||||
import com.beust.jcommander.ParameterException; | |||||
import com.beust.jcommander.Parameters; | |||||
import com.gitblit.authority.GitblitAuthority; | import com.gitblit.authority.GitblitAuthority; | ||||
import com.gitblit.authority.NewCertificateConfig; | import com.gitblit.authority.NewCertificateConfig; | ||||
import com.gitblit.servlet.GitblitContext; | import com.gitblit.servlet.GitblitContext; | ||||
// filter out the baseFolder parameter | // filter out the baseFolder parameter | ||||
List<String> filtered = new ArrayList<String>(); | List<String> filtered = new ArrayList<String>(); | ||||
String folder = "data"; | String folder = "data"; | ||||
for (int i = 0; i< args.length; i++) { | |||||
for (int i = 0; i < args.length; i++) { | |||||
String arg = args[i]; | String arg = args[i]; | ||||
if (arg.equals("--baseFolder")) { | if (arg.equals("--baseFolder")) { | ||||
if (i + 1 == args.length) { | if (i + 1 == args.length) { | ||||
Params.baseFolder = folder; | Params.baseFolder = folder; | ||||
Params params = new Params(); | Params params = new Params(); | ||||
JCommander jc = new JCommander(params); | |||||
CmdLineParser parser = new CmdLineParser(params); | |||||
try { | try { | ||||
jc.parse(filtered.toArray(new String[filtered.size()])); | |||||
parser.parseArgument(filtered); | |||||
if (params.help) { | if (params.help) { | ||||
server.usage(jc, null); | |||||
server.usage(parser, null); | |||||
} | } | ||||
} catch (ParameterException t) { | |||||
server.usage(jc, t); | |||||
} catch (CmdLineException t) { | |||||
server.usage(parser, t); | |||||
} | } | ||||
if (params.stop) { | if (params.stop) { | ||||
/** | /** | ||||
* Display the command line usage of Gitblit GO. | * Display the command line usage of Gitblit GO. | ||||
* | * | ||||
* @param jc | |||||
* @param parser | |||||
* @param t | * @param t | ||||
*/ | */ | ||||
protected final void usage(JCommander jc, ParameterException t) { | |||||
protected final void usage(CmdLineParser parser, CmdLineException t) { | |||||
System.out.println(Constants.BORDER); | System.out.println(Constants.BORDER); | ||||
System.out.println(Constants.getGitBlitVersion()); | System.out.println(Constants.getGitBlitVersion()); | ||||
System.out.println(Constants.BORDER); | System.out.println(Constants.BORDER); | ||||
System.out.println(t.getMessage()); | System.out.println(t.getMessage()); | ||||
System.out.println(); | System.out.println(); | ||||
} | } | ||||
if (jc != null) { | |||||
jc.usage(); | |||||
if (parser != null) { | |||||
parser.printUsage(System.out); | |||||
System.out | System.out | ||||
.println("\nExample:\n java -server -Xmx1024M -jar gitblit.jar --repositoriesFolder c:\\git --httpPort 80 --httpsPort 443"); | .println("\nExample:\n java -server -Xmx1024M -jar gitblit.jar --repositoriesFolder c:\\git --httpPort 80 --httpsPort 443"); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* JCommander Parameters class for GitBlitServer. | |||||
* Parameters class for GitBlitServer. | |||||
*/ | */ | ||||
@Parameters(separators = " ") | |||||
public static class Params { | public static class Params { | ||||
public static String baseFolder; | public static String baseFolder; | ||||
/* | /* | ||||
* Server parameters | * Server parameters | ||||
*/ | */ | ||||
@Parameter(names = { "-h", "--help" }, description = "Show this help") | |||||
@Option(name = "--help", aliases = { "-h"}, usage = "Show this help") | |||||
public Boolean help = false; | public Boolean help = false; | ||||
@Parameter(names = { "--stop" }, description = "Stop Server") | |||||
@Option(name = "--stop", usage = "Stop Server") | |||||
public Boolean stop = false; | public Boolean stop = false; | ||||
@Parameter(names = { "--tempFolder" }, description = "Folder for server to extract built-in webapp") | |||||
@Option(name = "--tempFolder", usage = "Folder for server to extract built-in webapp", metaVar="PATH") | |||||
public String temp = FILESETTINGS.getString(Keys.server.tempFolder, "temp"); | public String temp = FILESETTINGS.getString(Keys.server.tempFolder, "temp"); | ||||
@Parameter(names = { "--dailyLogFile" }, description = "Log to a rolling daily log file INSTEAD of stdout.") | |||||
@Option(name = "--dailyLogFile", usage = "Log to a rolling daily log file INSTEAD of stdout.") | |||||
public Boolean dailyLogFile = false; | public Boolean dailyLogFile = false; | ||||
/* | /* | ||||
* GIT Servlet Parameters | * GIT Servlet Parameters | ||||
*/ | */ | ||||
@Parameter(names = { "--repositoriesFolder" }, description = "Git Repositories Folder") | |||||
@Option(name = "--repositoriesFolder", usage = "Git Repositories Folder", metaVar="PATH") | |||||
public String repositoriesFolder = FILESETTINGS.getString(Keys.git.repositoriesFolder, | public String repositoriesFolder = FILESETTINGS.getString(Keys.git.repositoriesFolder, | ||||
"git"); | "git"); | ||||
/* | /* | ||||
* Authentication Parameters | * Authentication Parameters | ||||
*/ | */ | ||||
@Parameter(names = { "--userService" }, description = "Authentication and Authorization Service (filename or fully qualified classname)") | |||||
@Option(name = "--userService", usage = "Authentication and Authorization Service (filename or fully qualified classname)") | |||||
public String userService = FILESETTINGS.getString(Keys.realm.userService, | public String userService = FILESETTINGS.getString(Keys.realm.userService, | ||||
"users.conf"); | "users.conf"); | ||||
/* | /* | ||||
* JETTY Parameters | * JETTY Parameters | ||||
*/ | */ | ||||
@Parameter(names = { "--useNio" }, description = "Use NIO Connector else use Socket Connector.") | |||||
@Option(name = "--useNio", usage = "Use NIO Connector else use Socket Connector.") | |||||
public Boolean useNIO = FILESETTINGS.getBoolean(Keys.server.useNio, true); | public Boolean useNIO = FILESETTINGS.getBoolean(Keys.server.useNio, true); | ||||
@Parameter(names = "--httpPort", description = "HTTP port for to serve. (port <= 0 will disable this connector)") | |||||
@Option(name = "--httpPort", usage = "HTTP port for to serve. (port <= 0 will disable this connector)", metaVar="PORT") | |||||
public Integer port = FILESETTINGS.getInteger(Keys.server.httpPort, 0); | public Integer port = FILESETTINGS.getInteger(Keys.server.httpPort, 0); | ||||
@Parameter(names = "--httpsPort", description = "HTTPS port to serve. (port <= 0 will disable this connector)") | |||||
@Option(name = "--httpsPort", usage = "HTTPS port to serve. (port <= 0 will disable this connector)", metaVar="PORT") | |||||
public Integer securePort = FILESETTINGS.getInteger(Keys.server.httpsPort, 8443); | public Integer securePort = FILESETTINGS.getInteger(Keys.server.httpsPort, 8443); | ||||
@Parameter(names = "--ajpPort", description = "AJP port to serve. (port <= 0 will disable this connector)") | |||||
@Option(name = "--ajpPort", usage = "AJP port to serve. (port <= 0 will disable this connector)", metaVar="PORT") | |||||
public Integer ajpPort = FILESETTINGS.getInteger(Keys.server.ajpPort, 0); | public Integer ajpPort = FILESETTINGS.getInteger(Keys.server.ajpPort, 0); | ||||
@Parameter(names = "--gitPort", description = "Git Daemon port to serve. (port <= 0 will disable this connector)") | |||||
@Option(name = "--gitPort", usage = "Git Daemon port to serve. (port <= 0 will disable this connector)", metaVar="PORT") | |||||
public Integer gitPort = FILESETTINGS.getInteger(Keys.git.daemonPort, 9418); | public Integer gitPort = FILESETTINGS.getInteger(Keys.git.daemonPort, 9418); | ||||
@Parameter(names = "--alias", description = "Alias of SSL certificate in keystore for serving https.") | |||||
@Option(name = "--alias", usage = "Alias of SSL certificate in keystore for serving https.", metaVar="ALIAS") | |||||
public String alias = FILESETTINGS.getString(Keys.server.certificateAlias, ""); | public String alias = FILESETTINGS.getString(Keys.server.certificateAlias, ""); | ||||
@Parameter(names = "--storePassword", description = "Password for SSL (https) keystore.") | |||||
@Option(name = "--storePassword", usage = "Password for SSL (https) keystore.", metaVar="PASSWORD") | |||||
public String storePassword = FILESETTINGS.getString(Keys.server.storePassword, ""); | public String storePassword = FILESETTINGS.getString(Keys.server.storePassword, ""); | ||||
@Parameter(names = "--shutdownPort", description = "Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)") | |||||
@Option(name = "--shutdownPort", usage = "Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)", metaVar="PORT") | |||||
public Integer shutdownPort = FILESETTINGS.getInteger(Keys.server.shutdownPort, 8081); | public Integer shutdownPort = FILESETTINGS.getInteger(Keys.server.shutdownPort, 8081); | ||||
@Parameter(names = "--requireClientCertificates", description = "Require client X509 certificates for https connections.") | |||||
@Option(name = "--requireClientCertificates", usage = "Require client X509 certificates for https connections.") | |||||
public Boolean requireClientCertificates = FILESETTINGS.getBoolean(Keys.server.requireClientCertificates, false); | public Boolean requireClientCertificates = FILESETTINGS.getBoolean(Keys.server.requireClientCertificates, false); | ||||
/* | /* | ||||
* Setting overrides | * Setting overrides | ||||
*/ | */ | ||||
@Parameter(names = { "--settings" }, description = "Path to alternative settings") | |||||
@Option(name = "--settings", usage = "Path to alternative settings", metaVar="FILE") | |||||
public String settingsfile; | public String settingsfile; | ||||
@Parameter(names = { "--ldapLdifFile" }, description = "Path to LDIF file. This will cause an in-memory LDAP server to be started according to gitblit settings") | |||||
@Option(name = "--ldapLdifFile", usage = "Path to LDIF file. This will cause an in-memory LDAP server to be started according to gitblit settings", metaVar="FILE") | |||||
public String ldapLdifFile; | public String ldapLdifFile; | ||||
} | } |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import com.beust.jcommander.JCommander; | |||||
import com.beust.jcommander.Parameter; | |||||
import com.beust.jcommander.ParameterException; | |||||
import com.beust.jcommander.Parameters; | |||||
import org.kohsuke.args4j.CmdLineException; | |||||
import org.kohsuke.args4j.CmdLineParser; | |||||
import org.kohsuke.args4j.Option; | |||||
import com.gitblit.manager.IRepositoryManager; | import com.gitblit.manager.IRepositoryManager; | ||||
import com.gitblit.manager.IRuntimeManager; | import com.gitblit.manager.IRuntimeManager; | ||||
import com.gitblit.manager.RepositoryManager; | import com.gitblit.manager.RepositoryManager; | ||||
Params.baseFolder = folder; | Params.baseFolder = folder; | ||||
Params params = new Params(); | Params params = new Params(); | ||||
JCommander jc = new JCommander(params); | |||||
CmdLineParser parser = new CmdLineParser(params); | |||||
try { | try { | ||||
jc.parse(filtered.toArray(new String[filtered.size()])); | |||||
parser.parseArgument(filtered); | |||||
if (params.help) { | if (params.help) { | ||||
reindex.usage(jc, null); | |||||
reindex.usage(parser, null); | |||||
return; | return; | ||||
} | } | ||||
} catch (ParameterException t) { | |||||
reindex.usage(jc, t); | |||||
} catch (CmdLineException t) { | |||||
reindex.usage(parser, t); | |||||
return; | return; | ||||
} | } | ||||
/** | /** | ||||
* Display the command line usage of ReindexTickets. | * Display the command line usage of ReindexTickets. | ||||
* | * | ||||
* @param jc | |||||
* @param parser | |||||
* @param t | * @param t | ||||
*/ | */ | ||||
protected final void usage(JCommander jc, ParameterException t) { | |||||
protected final void usage(CmdLineParser parser, CmdLineException t) { | |||||
System.out.println(Constants.BORDER); | System.out.println(Constants.BORDER); | ||||
System.out.println(Constants.getGitBlitVersion()); | System.out.println(Constants.getGitBlitVersion()); | ||||
System.out.println(Constants.BORDER); | System.out.println(Constants.BORDER); | ||||
System.out.println(t.getMessage()); | System.out.println(t.getMessage()); | ||||
System.out.println(); | System.out.println(); | ||||
} | } | ||||
if (jc != null) { | |||||
jc.usage(); | |||||
if (parser != null) { | |||||
parser.printUsage(System.out); | |||||
System.out | System.out | ||||
.println("\nExample:\n java -gitblit.jar com.gitblit.ReindexTickets --baseFolder c:\\gitblit-data"); | .println("\nExample:\n java -gitblit.jar com.gitblit.ReindexTickets --baseFolder c:\\gitblit-data"); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* JCommander Parameters. | |||||
* Parameters. | |||||
*/ | */ | ||||
@Parameters(separators = " ") | |||||
public static class Params { | public static class Params { | ||||
public static String baseFolder; | public static String baseFolder; | ||||
@Parameter(names = { "-h", "--help" }, description = "Show this help") | |||||
@Option(name = "--help", aliases = { "-h"}, usage = "Show this help") | |||||
public Boolean help = false; | public Boolean help = false; | ||||
private final FileSettings FILESETTINGS = new FileSettings(new File(baseFolder, Constants.PROPERTIES_FILE).getAbsolutePath()); | private final FileSettings FILESETTINGS = new FileSettings(new File(baseFolder, Constants.PROPERTIES_FILE).getAbsolutePath()); | ||||
@Parameter(names = { "--repositoriesFolder" }, description = "Git Repositories Folder") | |||||
@Option(name = "--repositoriesFolder", usage = "Git Repositories Folder", metaVar = "PATH") | |||||
public String repositoriesFolder = FILESETTINGS.getString(Keys.git.repositoriesFolder, "git"); | public String repositoriesFolder = FILESETTINGS.getString(Keys.git.repositoriesFolder, "git"); | ||||
@Parameter(names = { "--settings" }, description = "Path to alternative settings") | |||||
@Option(name = "--settings", usage = "Path to alternative settings", metaVar = "FILE") | |||||
public String settingsfile; | public String settingsfile; | ||||
} | } | ||||
} | } |
- [Jetty](http://eclipse.org/jetty) (Apache 2.0, EPL 1.0) | - [Jetty](http://eclipse.org/jetty) (Apache 2.0, EPL 1.0) | ||||
- [SLF4J](http://www.slf4j.org) (MIT/X11) | - [SLF4J](http://www.slf4j.org) (MIT/X11) | ||||
- [Log4j](http://logging.apache.org/log4j) (Apache 2.0) | - [Log4j](http://logging.apache.org/log4j) (Apache 2.0) | ||||
- [JCommander](http://jcommander.org) (Apache 2.0) | |||||
- [args4j](http://args4j.kohsuke.org) (Apache 2.0) | |||||
- [BouncyCastle](http://www.bouncycastle.org) (MIT/X11) | - [BouncyCastle](http://www.bouncycastle.org) (MIT/X11) | ||||
- [JSch - Java Secure Channel](http://www.jcraft.com/jsch) (BSD) | - [JSch - Java Secure Channel](http://www.jcraft.com/jsch) (BSD) | ||||
- [Rome](http://rome.dev.java.net) (Apache 1.1) | - [Rome](http://rome.dev.java.net) (Apache 1.1) |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import com.beust.jcommander.JCommander; | |||||
import com.beust.jcommander.ParameterException; | |||||
import org.kohsuke.args4j.CmdLineException; | |||||
import org.kohsuke.args4j.CmdLineParser; | |||||
import com.gitblit.GitBlitServer; | import com.gitblit.GitBlitServer; | ||||
import com.gitblit.IStoredSettings; | import com.gitblit.IStoredSettings; | ||||
import com.gitblit.Keys; | import com.gitblit.Keys; | ||||
Params.baseFolder = folder; | Params.baseFolder = folder; | ||||
Params params = new Params(); | Params params = new Params(); | ||||
JCommander jc = new JCommander(params); | |||||
CmdLineParser parser = new CmdLineParser(params); | |||||
try { | try { | ||||
jc.parse(filtered.toArray(new String[filtered.size()])); | |||||
parser.parseArgument(filtered); | |||||
if (params.help) { | if (params.help) { | ||||
server.usage(jc, null); | |||||
server.usage(parser, null); | |||||
} | } | ||||
} catch (ParameterException t) { | |||||
server.usage(jc, t); | |||||
} catch (CmdLineException t) { | |||||
server.usage(parser, t); | |||||
} | } | ||||
if (params.stop) { | if (params.stop) { |