Add templates for ClearCase, Starteam and Perforce for scm-usage page.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@378073 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-02-15 19:41:31 +00:00
parent 2e3901818a
commit ab3eda60d2
10 changed files with 382 additions and 31 deletions

View File

@ -268,5 +268,25 @@
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.0-beta-2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-perforce</artifactId>
<version>1.0-beta-2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-clearcase</artifactId>
<version>1.0-beta-2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-starteam</artifactId>
<version>1.0-beta-2</version>
</dependency>
</dependencies>
</project>

View File

@ -20,6 +20,19 @@ package org.apache.maven.xdoc.util;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.scm.manager.NoSuchScmProviderException;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.clearcase.ClearCaseScmProvider;
import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
import org.apache.maven.scm.provider.starteam.StarteamScmProvider;
import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.scm.repository.ScmRepositoryException;
import org.apache.maven.util.EnhancedStringTokenizer;
/**
@ -118,6 +131,139 @@ public final class ScmUtil
return null;
}
/**
* Create the documentation to provide an developer access with a <code>Perforce</code> SCM.
* For example, generate the following command line:
* <p>p4 -H hostname -p port -u username -P password path</p>
* <p>p4 -H hostname -p port -u username -P password path submit -c changement</p>
*
* @param perforceRepo
* @see <a href="http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html">http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html</>
*/
public String developerAccessPerforce( String devConnection )
{
StringBuffer command = new StringBuffer();
char delim = getSCMConnectionSeparator( devConnection ).charAt( 0 );
PerforceScmProvider perforceProvider= new PerforceScmProvider();
PerforceScmProviderRepository perforceRepo;
String scmSpecificUrl = devConnection.substring( 13 );
try
{
perforceRepo = (PerforceScmProviderRepository)
perforceProvider.makeProviderScmRepository( scmSpecificUrl, delim );
}
catch (ScmRepositoryException e)
{
System.err.println( "Your developerConnection does not seem to be valid: " + e.getMessage() );
return "";
}
command.append( "p4" );
if ( !StringUtils.isEmpty( perforceRepo.getHost() ) )
{
command.append( " -H " ).append( perforceRepo.getHost() );
}
if ( perforceRepo.getPort() > 0 )
{
command.append( " -p " + perforceRepo.getPort() );
}
command.append( " -u username" );
command.append( " -P password" );
command.append( " " );
command.append( perforceRepo.getPath() );
command.append( "\n" );
command.append( "p4 submit -c \"A comment\"" );
return command.toString();
}
// Starteam
/**
* Create the documentation to provide an developer access with a <code>Starteam</code> SCM.
* For example, generate the following command line:
* <p>stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -is</p>
* <p>stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -f NCI -is</p>
*
* @param starteamRepo
*/
public String developerAccessStarteam( String devConnection )
{
StringBuffer command = new StringBuffer();
char delim = getSCMConnectionSeparator( devConnection ).charAt( 0 );
StarteamScmProvider starteamProvider= new StarteamScmProvider();
StarteamScmProviderRepository starteamRepo;
String scmSpecificUrl = devConnection.substring( 13 );
try
{
starteamRepo = (StarteamScmProviderRepository)
starteamProvider.makeProviderScmRepository( scmSpecificUrl, delim );
}
catch (ScmRepositoryException e)
{
System.err.println( "Your developerConnection does not seem to be valid: " + e.getMessage() );
return "";
}
// Safety: remove the username/password if present
String fullUrl = StringUtils.replace( starteamRepo.getFullUrl(), starteamRepo.getUser(), "username" );
fullUrl = StringUtils.replace( fullUrl, starteamRepo.getPassword(), "password" );
command.append( "stcmd co -x -nologo -stop -p " );
command.append( fullUrl );
command.append( " -is" );
command.append( "\n" );
command.append( "stcmd ci -x -nologo -stop -p " );
command.append( fullUrl );
command.append( " -f NCI -is" );
return command.toString();
}
/**
* Create the documentation to provide an developer access with a <code>Clearcase</code> SCM.
* For example, generate the following command line:
* <p>cleartool checkout module</p>
*
* @param clearCaseRepo
*/
public String developerAccessClearCase( String devConnection )
{
StringBuffer command = new StringBuffer();
char delim = getSCMConnectionSeparator( devConnection ).charAt( 0 );
ClearCaseScmProvider clearCaseProvider= new ClearCaseScmProvider();
ClearCaseScmProviderRepository clearCaseRepo;
String scmSpecificUrl = devConnection.substring( 14 );
try
{
clearCaseRepo = (ClearCaseScmProviderRepository)
clearCaseProvider.makeProviderScmRepository( scmSpecificUrl, delim );
}
catch (ScmRepositoryException e)
{
System.err.println( "Your developerConnection does not seem to be valid: " + e.getMessage() );
return "";
}
command.append( "cleartool checkout " ).append( clearCaseRepo.getViewName( "id" ) );
return command.toString();
}
/**
* Splits an SCM string into parts.
*

View File

@ -1,11 +1,42 @@
<section name="Anonymous Clearcase Access with Maven">
<section key="template.scm.section2.title"
bundle="plugin-resources.templates.templates"
name="Overview">
<p>
<em>This section is under construction.</em>
<message key="template.scm.section2.part1"
bundle="plugin-resources.templates.templates" />
<a href="http://www-306.ibm.com/software/awdtools/clearcase/">Clearcase</a>
<message key="template.clearcase.section2.part2"
bundle="plugin-resources.templates.templates" />
<a href="http://www.redbooks.ibm.com/redbooks/pdfs/sg246399.pdf">http://www.redbooks.ibm.com/redbooks/pdfs/sg246399.pdf</a>.
</p>
</section>
<section name="Developer Clearcase Access with Maven">
#if ($repository.developerConnection && $repository.developerConnection != '')
#set ($command = $scmUtil.developerAccessClearCase($repository.developerConnection))
<subsection key="template.scm.section6.title"
bundle="plugin-resources.templates.templates"
name="Developer Access">
<p>
<em>This section is under construction.</em>
<message key="template.clearcase.section6.description"
bundle="plugin-resources.templates.templates" />
</p>
<source>$command</source>
</subsection>
<subsection key="template.scm.accessbehindfirewall.title"
bundle="plugin-resources.templates.templates"
name="Access from behind a firewall">
<p>
<message key="template.scm.accessbehindfirewall.general.intro"
bundle="plugin-resources.templates.templates" />
</p>
</subsection>
#end
</section>

View File

@ -1,11 +1,42 @@
<section name="Anonymous Perforce Access with Maven">
<section key="templatescm.section2.title"
bundle="plugin-resources.templates.templates"
name="Overview">
<p>
<em>This section is under construction.</em>
<message key="template.scm.section2.part1"
bundle="plugin-resources.templates.templates" />
<a href="http://www.perforce.com/">Perforce</a>
<message key="template.perforce.section2.part2"
bundle="plugin-resources.templates.templates" />
<a href="http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html">http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html</a>.
</p>
</section>
<section name="Developer Perforce Access with Maven">
#if ($repository.developerConnection && $repository.developerConnection != '')
#set ($command = $scmUtil.developerAccessPerforce($repository.developerConnection))
<subsection key="template.scm.section6.title"
bundle="plugin-resources.templates.templates"
name="Developer Access">
<p>
<em>This section is under construction.</em>
<message key="template.perforce.section6.description"
bundle="plugin-resources.templates.templates" />
</p>
<source>$command</source>
</subsection>
<subsection key="template.scm.accessbehindfirewall.title"
bundle="plugin-resources.templates.templates"
name="Access from behind a firewall">
<p>
<message key="template.scm.accessbehindfirewall.general.intro"
bundle="plugin-resources.templates.templates" />
</p>
</subsection>
#end
</section>

View File

@ -1,11 +1,41 @@
<section name="Anonymous Starteam Access with Maven">
<section key="template.scm.section2.title"
bundle="plugin-resources.templates.templates"
name="Overview">
<p>
<em>This section is under construction.</em>
<message key="template.scm.section2.part1"
bundle="plugin-resources.templates.templates" />
<a href="http://www.borland.com/us/products/starteam/">Starteam</a>
<message key="template.starteam.section2.part2"
bundle="plugin-resources.templates.templates" />.
</p>
</section>
<section name="Developer Starteam Access with Maven">
#if ($repository.developerConnection && $repository.developerConnection != '')
#set ($command = $scmUtil.developerAccessStarteam($repository.developerConnection))
<subsection key="template.scm.section6.title"
bundle="plugin-resources.templates.templates"
name="Developer Access">
<p>
<em>This section is under construction.</em>
<message key="template.starteam.section6.description"
bundle="plugin-resources.templates.templates" />
</p>
<source>$command</source>
</subsection>
<subsection key="template.scm.accessbehindfirewall.title"
bundle="plugin-resources.templates.templates"
name="Access from behind a firewall">
<p>
<message key="template.scm.accessbehindfirewall.general.intro"
bundle="plugin-resources.templates.templates" />
</p>
</subsection>
#end
</section>

View File

@ -64,6 +64,25 @@ template.svn.section8.intro1=The Subversion client can go through a proxy, if yo
template.svn.section8.intro2=There are comments in the file explaining what to do. If you don't have that file, get the latest Subversion client and run any command; this will cause the configuration directory and template files to be created.
template.svn.section8.intro3=Example : Edit the 'servers' file and add something like:
# For clearcase.xml
template.clearcase.section2.part2=to manage its source code. Instructions for using ClearCase can be found at
template.clearcase.section6.description=Only project developers can access the ClearCase tree via this method. Substitute username with the proper value.
# For perforce.xml
template.perforce.section2.part2=to manage its source code. Instructions for using Perforce can be found at
template.perforce.section6.description=Only project developers can access the Perforce tree via this method. Substitute username and password with the proper values.
# For starteam.xml
template.starteam.section2.part2=to manage its source code.
template.starteam.section6.description=Only project developers can access the Starteam tree via this method. Substitute username and password with the proper values.
# Used by clearcase.xml, perforce.xml, starteam.xml
template.scm.section2.title=Source Repository
template.scm.section2.part1=This project uses
template.scm.section6.title=Developer Access
template.scm.accessbehindfirewall.title=Access from behind a firewall
template.scm.accessbehindfirewall.general.intro=Refer to the documentation of the SCM used for more information about an access behind a firewall.
# For dependencies.xml
template.dependencies.title=Dependencies
template.dependencies.section.title=Dependencies

View File

@ -54,9 +54,9 @@ template.svn.section3.description=Das Quellcode Archiv dieses Projektes kann dur
template.svn.section4.title=Anonymer Zugriff
template.svn.section4.description=Das Quellcode Archiv dieses Projektes kann mit dem folgenden Befehl ausgecheckt werden:
template.svn.section5.title=Entwickler Zugriff mit Maven
template.svn.section5.description=Even though everyone can checkout the Subversion repository via HTTPS, committers have to use HTTPS if they want to be able to check back in their changes. Use the following instruction set on a single line:
template.svn.section5.description=Jeder kann auf das Subversion Archiv via HTTPS zugreifen, aber Entwickler müssen es verwenden, wenn sie ihre Änderungen wider ein-checken wollen. Verwenden Sie die folgenden Instruktionen auf einer Linie:
template.svn.section6.title=Entwickler Zugriff
template.svn.section6.description=Even though everyone can checkout the Subversion repository via HTTPS, committers have to use HTTPS if they want to be able to check back in their changes. Use the following command:
template.svn.section6.description=Jeder kann auf das Subversion Archiv via HTTPS zugreifen, aber Entwickler müssen es verwenden, wenn sie ihre Änderungen wider ein-checken wollen. Verwenden Sie den folgenden Befehl:
template.svn.section7.title=Zugriff hinter einer Firewall
template.svn.section7.description=Entwickler die sich hinter einer Firewall befinden die den http Zugriff auf das Quellcode Archiv blockiert, sollten versuchen über die Entwickler-Verbindung darauf zuzugreifen:
template.svn.section8.title=Zugriff über einen Proxy
@ -65,6 +65,25 @@ verwendenden Proxy angeben. Es h
template.svn.section8.intro2=Diese Datei enthält einige Gebrauchshinweise. Sollte diese Datei nicht existieren, verwenden Sie die neueste Version von Subversion und exekutieren Sie irgend einen Befehl. Die Datei wird dann automatisch erzeugt.
template.svn.section8.intro3=Beispiel: Editieren Sie die "servers" Datei und fügen Sie hinzu:
# For clearcase.xml
template.clearcase.section2.part2=um seinen Quellcode zu verwalten. Instruktionen zur Verwendung von ClearCase finden Sie hier:
template.clearcase.section6.description=Nur Entwickler können auf das ClearCase Quellcode Archiv mit dieser Methode zugreifen. Ersetzen Sie den Benutzernamen ("username") durch Ihren eigenen.
# For perforce.xml
template.perforce.section2.part2=um seinen Quellcode zu verwalten. Instruktionen zur Verwendung von Perforce finden Sie hier:
template.perforce.section6.description=Nur Entwickler können auf das Perforce Quellcode Archiv mit dieser Methode zugreifen. Ersetzen Sie den Benutzernamen ("username") und 'password' mit den entsprechenden Werten.
# For starteam.xml
template.starteam.section2.part2=um seinen Quellcode zu verwalten.
template.starteam.section6.description=Nur Entwickler können auf das Perforce Quellcode Archiv mit dieser Methode zugreifen. Ersetzen Sie den Benutzernamen ("username") und 'password' mit den entsprechenden Werten.
# Used by clearcase.xml, perforce.xml, starteam.xml
template.scm.section2.title=Quellcode Archiv
template.scm.section2.part1=Dieses Projekt verwendet
template.scm.section6.title=Entwickler Zugriff
template.scm.accessbehindfirewall.title=Zugriff hinter einer Firewall
template.scm.accessbehindfirewall.general.intro=Konsultieren Sie die Gebrauchshinweisungen Ihres SCM's für Information über Zugriff hinter einer Firewall.
# For dependencies.xml
template.dependencies.title = Abhängigkeiten
template.dependencies.section.title = Abhängigkeiten

View File

@ -65,6 +65,25 @@ pour indiquer quel proxy utilis
template.svn.section8.intro2=Il y a des commentaires dans le fichier qui explique comment faire. Si vous n'avez pas ce fichier, télécharger la version la plus récente de Subversion et tapez n'importe quelle commande ; ceci créera les fichiers de configuration.
template.svn.section8.intro3=Exemple : Editer le fichier 'servers' et ajouter quelque chose du genre:
# For clearcase.xml
template.clearcase.section2.part2=pour gérer son code source. Des instructions sur l'utilisation de ClearCase peuvent être trouvées à
template.clearcase.section6.description=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de ClearCase par l'intermédiaire de cette méthode. Remplacez username avec la valeur appropriée.
# For perforce.xml
template.perforce.section2.part2=pour gérer son code source. Des instructions sur l'utilisation de Perforce peuvent être trouvées à
template.perforce.section6.description=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de ClearCase par l'intermédiaire de cette méthode. Remplacez username et password avec les valeurs appropriées.
# For starteam.xml
template.starteam.section2.part2=tpour gérer son code source.
template.starteam.section6.description=Seulement les dévelopeurs du projet peuvent accéder à l'arbre de Starteam par l'intermédiaire de cette méthode. Remplacez username et password avec les valeurs appropriées.
# Used by clearcase.xml, perforce.xml, starteam.xml
template.scm.section2.title=Dépôt de sources
template.scm.section2.part1=Ce projet utilise
template.scm.section6.title=Accès pour les dévelopeurs
template.scm.accessbehindfirewall.title=Accès derrière un firewall
template.scm.accessbehindfirewall.general.intro=Référez-vous à la documentation du dépôt d'archive utilisé pour plus d'informations sur l'accès derrière un firewall.
# For dependencies.xml
template.dependencies.title=Dépendances
template.dependencies.section.title=Dépendances

View File

@ -32,6 +32,15 @@ public class ScmUtilTest extends TestCase
private final String cvs2 =
"scm:cvs:ext:username@cvs.apache.org:/cvs/root:module";
private final String svn = "scm:svn:http://svn.apache.org/svn/root/module";
private final String perforce1 =
"scm:perforce:john_doe@somehost:21:path_to_repository";
private final String perforce2 = "scm:perforce://depot/modules/myproject";
private final String starteam1 =
"scm:starteam:john_doe:secret_password@myhost:23456/project/view/folder";
private final String starteam2 =
"scm:starteam:john_doe@myhost:23456/project/view/folder";
private final String clearcase =
"scm:clearcase:my_module_view://myserver/clearcase/configspecs/my_module.txt";
private final String invalid = "";
public void testSCMConnectionSeparator()
@ -68,4 +77,30 @@ public class ScmUtilTest extends TestCase
"scm:cvs:ext:john_doe@cvs.apache.org:/cvs/root:module" );
assertEquals( scmUtil.getCvsConnection( svn, "" ), "" );
}
public void testDeveloperAccessPerforce()
{
assertEquals( scmUtil.developerAccessPerforce( perforce1 ),
"p4 -H somehost -p 21 -u username -P password path_to_repository\np4 submit -c \"A comment\"" );
assertEquals( scmUtil.developerAccessPerforce( perforce2 ),
"p4 -u username -P password //depot/modules/myproject\np4 submit -c \"A comment\"" );
}
// TODO: FIXME: why does this fail with a NoClassDefFoundError?
/*
public void testDeveloperAccessStarteam()
{
assertEquals( scmUtil.developerAccessStarteam( starteam1 ),
"stcmd co -x -nologo -stop -p username:password@myhost:23456/project/view/folder -is\nstcmd ci -x -nologo -stop -p username:password@myhost:23456/project/view/folder -f NCI -is" );
assertEquals( scmUtil.developerAccessStarteam( starteam2 ),
"stcmd co -x -nologo -stop -p username:@myhost:23456/project/view/folder -is\nstcmd ci -x -nologo -stop -p username:@myhost:23456/project/view/folder -f NCI -is" );
}
*/
public void testDeveloperAccessClearCase()
{
assertEquals( scmUtil.developerAccessClearCase( clearcase ),
"cleartool checkout my_module_view" );
}
}

View File

@ -27,6 +27,7 @@
</properties>
<body>
<release version="1.10-SNAPSHOT" date="in SVN">
<action dev="ltheussl" type="add">Include instructions for ClearCase, Starteam and Perforce access in the scm-usage page.</action>
<action dev="ltheussl" type="fix" issue="MPXDOC-181"><code>xdoc:init</code> was called six times during one <code>xdoc</code> run.</action>
<action dev="ltheussl" type="add" issue="MPXDOC-191">Include dependencies' scope in dependencies page.</action>
<action dev="ltheussl" type="add" issue="MPXDOC-190">Include the new theme <code>maven-stylus.css</code>.</action>