Author: tchemit Date: 2008-10-08 23:13:51 +0000 (Wed, 08 Oct 2008) New Revision: 235 Added: maven-jrst-plugin/tags/0.8.3/ maven-jrst-plugin/tags/0.8.3/changelog maven-jrst-plugin/tags/0.8.3/pom.xml maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java maven-jrst-plugin/tags/0.8.3/src/main/resources/ maven-jrst-plugin/tags/0.8.3/src/site/fr/ maven-jrst-plugin/tags/0.8.3/src/site/site.xml Removed: maven-jrst-plugin/tags/0.8.3/THIRD-PARTY.txt maven-jrst-plugin/tags/0.8.3/changelog maven-jrst-plugin/tags/0.8.3/pom.xml maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java maven-jrst-plugin/tags/0.8.3/src/site/site.xml Log: [maven-release-plugin] copy for tag 0.8.3 Copied: maven-jrst-plugin/tags/0.8.3 (from rev 219, maven-jrst-plugin/trunk) Deleted: maven-jrst-plugin/tags/0.8.3/THIRD-PARTY.txt =================================================================== --- maven-jrst-plugin/trunk/THIRD-PARTY.txt 2008-10-03 13:18:32 UTC (rev 219) +++ maven-jrst-plugin/tags/0.8.3/THIRD-PARTY.txt 2008-10-08 23:13:51 UTC (rev 235) @@ -1,58 +0,0 @@ -List of third-party dependencies grouped by their license type. - -Common Public License Version 1.0 : - * JUnit (junit:junit:3.8.1 - http://junit.org) - -GPL : - * JRst (lutinlib:jrst:0.8.2-SNAPSHOT - http://labs.libre-entreprise.org/projects/jrst/jrst) - * Lutin utilities library (lutinlib:lutinutil:0.26 - http://labs.libre-entreprise.org/projects/lutinutil/lutinutil) - -LGPL : - * xom (xom:xom:1.0 - http://www.xom.nu) - -The Apache Software License, Version 2.0 : - * Apache XML Graphics Commons (org.apache.xmlgraphics:xmlgraphics-commons:1.1 - http://xmlgraphics.apache.org/commons/) - * Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging) - * IO (commons-io:commons-io:1.1 - http://jakarta.apache.org/commons/io/) - * IO (commons-io:commons-io:1.3.1 - http://jakarta.apache.org/commons/io/) - * Lang (commons-lang:commons-lang:2.1 - http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/) - * Log4j (log4j:log4j:1.2.14 - http://logging.apache.org/log4j/docs/) - * Logging (commons-logging:commons-logging:1.1 - http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/) - * Maven Artifact (org.apache.maven:maven-artifact:2.0.9 - http://maven.apache.org/maven-artifact) - * Maven Artifact Manager (org.apache.maven:maven-artifact-manager:2.0.9 - http://maven.apache.org/maven-artifact-manager) - * Maven Local Settings Model (org.apache.maven:maven-settings:2.0.9 - http://maven.apache.org/maven-settings) - * Maven Model (org.apache.maven:maven-model:2.0.9 - http://maven.apache.org/maven-model) - * Maven Plugin API (org.apache.maven:maven-plugin-api:2.0.9 - http://maven.apache.org/maven-plugin-api) - * Maven Plugin Registry Model (org.apache.maven:maven-plugin-registry:2.0.9 - http://maven.apache.org/maven-plugin-registry) - * Maven Profile Model (org.apache.maven:maven-profile:2.0.9 - http://maven.apache.org/maven-profile) - * Maven Project Builder (org.apache.maven:maven-project:2.0.9 - http://maven.apache.org/maven-project) - * Maven Repository Metadata Model (org.apache.maven:maven-repository-metadata:2.0.9 - http://maven.apache.org/maven-repository-metadata) - * Maven Wagon API (org.apache.maven.wagon:wagon-provider-api:1.0-beta-2 - http://maven.apache.org/wagon/wagon-provider-api) - * Plexus Common Utilities (org.codehaus.plexus:plexus-utils:1.5.1 - http://plexus.codehaus.org/plexus-utils) - * XML Commons External Components XML APIs (xml-apis:xml-apis:1.0.b2 - http://xml.apache.org/commons/#external) - -Unknown license : - * Batik Ext (batik:batik-ext:1.6-1 - no url defined) - * Batik GUI Utilities (batik:batik-gui-util:1.6-1 - no url defined) - * Batik Utilities (batik:batik-util:1.6-1 - no url defined) - * Default Plexus Container (org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1 - no url defined) - * Plexus Common Utilities (org.codehaus.plexus:plexus-utils:1.0.4 - no url defined) - * Unnamed - com.ibm.icu:icu4j:jar:2.6.1 (com.ibm.icu:icu4j:2.6.1 - no url defined) - * Unnamed - commons-collections:commons-collections:jar:3.1 (commons-collections:commons-collections:3.1 - no url defined) - * Unnamed - commons-primitives:commons-primitives:jar:1.0 (commons-primitives:commons-primitives:1.0 - no url defined) - * Unnamed - fop:fop:jar:0.93 (fop:fop:0.93 - no url defined) - * Unnamed - jaxen:jaxen:jar:1.0-FCS (jaxen:jaxen:1.0-FCS - no url defined) - * Unnamed - jdom:jdom:jar:1.0 (jdom:jdom:1.0 - no url defined) - * Unnamed - jewelcli:jewelcli:jar:0.41 (jewelcli:jewelcli:0.41 - no url defined) - * Unnamed - nwalsh:docbook-xsl-nwalsh:jar:1.71.1 (nwalsh:docbook-xsl-nwalsh:1.71.1 - no url defined) - * Unnamed - org.apache.ant:ant-launcher:jar:1.7.0 (org.apache.ant:ant-launcher:1.7.0 - http://ant.apache.org/ant-launcher) - * Unnamed - xalan:xalan:jar:2.6.0 (xalan:xalan:2.6.0 - no url defined) - * Unnamed - xerces:xercesImpl:jar:2.6.2 (xerces:xercesImpl:2.6.2 - no url defined) - * Unnamed - xerces:xmlParserAPIs:jar:2.6.2 (xerces:xmlParserAPIs:2.6.2 - no url defined) - * Unnamed - xml-apis:xml-apis:jar:1.3.02 (xml-apis:xml-apis:1.3.02 - http://xml.apache.org/commons/#external) - * Unnamed - xml-apis:xmlParserAPIs:jar:2.0.2 (xml-apis:xmlParserAPIs:2.0.2 - no url defined) - * classworlds (classworlds:classworlds:1.1-alpha-2 - http://classworlds.codehaus.org/) - * dom4j (dom4j:dom4j:1.6.1 - http://dom4j.org) - * jaxen (jaxen:jaxen:1.1-beta-6 - http://jaxen.codehaus.org/) - * jaxen (jaxen:jaxen:1.1.1 - http://jaxen.codehaus.org/) - * org.apache.tools.ant (org.apache.ant:ant:1.7.0 - http://ant.apache.org/ant) \ No newline at end of file Deleted: maven-jrst-plugin/tags/0.8.3/changelog =================================================================== --- maven-jrst-plugin/trunk/changelog 2008-10-03 13:18:32 UTC (rev 219) +++ maven-jrst-plugin/tags/0.8.3/changelog 2008-10-08 23:13:51 UTC (rev 235) @@ -1,2 +0,0 @@ -ver-0-8-2 thimel 20080922 - * 20080922 [thimel] Using lutinpluginproject 3.0 Copied: maven-jrst-plugin/tags/0.8.3/changelog (from rev 227, maven-jrst-plugin/trunk/changelog) =================================================================== --- maven-jrst-plugin/tags/0.8.3/changelog (rev 0) +++ maven-jrst-plugin/tags/0.8.3/changelog 2008-10-08 23:13:51 UTC (rev 235) @@ -0,0 +1,8 @@ +ver-0-8-3 thimel 200810XX + * 20081008 [chemit] refactor plugin to generate ony when required + * 20081008 [chemit] Using lutinpluginproject 3.0 in a better way :) + * 20081008 [chemit] add log4j.properties + * 20081008 [chemit] use a DirectoryScanner instead of FileAction since we do not want to parse scm admin files... + +ver-0-8-2 thimel 20080922 + * 20080922 [thimel] Using lutinpluginproject 3.0 Deleted: maven-jrst-plugin/tags/0.8.3/pom.xml =================================================================== --- maven-jrst-plugin/trunk/pom.xml 2008-10-03 13:18:32 UTC (rev 219) +++ maven-jrst-plugin/tags/0.8.3/pom.xml 2008-10-08 23:13:51 UTC (rev 235) @@ -1,58 +0,0 @@ -<?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/maven-v4_0_0.xsd"> - - <!-- Plugin mandatory info --> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.codelutin</groupId> - <artifactId>lutinpluginproject</artifactId> - <version>3.0</version> - </parent> - - <!--A unique name for this project--> - <groupId>org.codelutin</groupId> - <artifactId>maven-jrst-plugin</artifactId> - <version>0.8.2</version> - - <packaging>maven-plugin</packaging> - - <!-- Plugin additional information --> - <name>Plugin maven JRst</name> - <description> - Plugin pour maven2 pour la génération de xdoc à partir de fichiers RST. - </description> - - <inceptionYear>2006</inceptionYear> - - <properties> - <!-- id du projet du labs --> - <labs.id>54</labs.id> - - <!-- nom du projet sur le labs --> - <labs.project>jrst</labs.project> - - <!-- Test --> - <maven.test.skip>false</maven.test.skip> - </properties> - - <!--Source control management--> - <scm> - <connection>${maven.scm.connection}</connection> - <developerConnection>${maven.scm.developerConnection}</developerConnection> - <url>${maven.scm.url}</url> - </scm> - - <!-- Plugin dependencies --> - <dependencies> - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>jrst</artifactId> - <version>[0.8,)</version> - <scope>compile</scope> - </dependency> - </dependencies> - -</project> - Copied: maven-jrst-plugin/tags/0.8.3/pom.xml (from rev 234, maven-jrst-plugin/trunk/pom.xml) =================================================================== --- maven-jrst-plugin/tags/0.8.3/pom.xml (rev 0) +++ maven-jrst-plugin/tags/0.8.3/pom.xml 2008-10-08 23:13:51 UTC (rev 235) @@ -0,0 +1,114 @@ +<?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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinpluginproject</artifactId> + <version>3.0</version> + </parent> + + <!--groupId>org.codelutin</groupId--> + <artifactId>maven-jrst-plugin</artifactId> + + <dependencies> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>jrst</artifactId> + <version>0.8.3</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutinpluginutil</artifactId> + <version>0.2</version> + <scope>compile</scope> + </dependency> + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Plugin maven JRst</name> + <version>0.8.3</version> + <description> + Plugin pour maven2 pour la génération de xdoc à partir de fichiers RST. + </description> + <inceptionYear>2006</inceptionYear> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + <packaging>maven-plugin</packaging> + + <properties> + <!-- id du projet du labs --> + <labs.id>54</labs.id> + + <!-- nom du projet sur le labs --> + <labs.project>jrst</labs.project> + + </properties> + + <build> + <plugins> + + <!-- plugin license switcher --> + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-license-switcher-plugin</artifactId> + <version>0.2</version> + <executions> + <execution> + <goals> + <goal>license</goal> + <goal>third-party</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> + </build> + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + <scm> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/jrst/maven-jrst-plugin/tags/0.8.3</connection> + <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/jrst/maven-jrst-plugin/tags/0.8.3</developerConnection> + <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-jrst-plugin/tags/0.8.3?root=jrst</url> + </scm> + + <!-- Maven Environment : profiles --> + <profiles> + <profile> + <id>license</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-license-switcher-plugin</artifactId> + <version>0.2</version> + <executions> + <execution> + <goals> + <goal>switch</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> + Deleted: maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java =================================================================== --- maven-jrst-plugin/trunk/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java 2008-10-03 13:18:32 UTC (rev 219) +++ maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java 2008-10-08 23:13:51 UTC (rev 235) @@ -1,232 +0,0 @@ -/* *##% Plugin maven JRst - * Copyright (C) 2006 - 2008 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ - -/* * - * JRstPlugin.java - * - * Created: 14 avril 2006 - * - * @author ruchaud - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ - -package org.codelutin.jrst.plugin; - -import java.io.File; -import java.io.IOException; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.codelutin.jrst.JRST; -import org.codelutin.util.FileUtil; -import org.codelutin.util.FileUtil.FileAction; - -/** - * Génére du xdoc à partir de fichiers Rst. - * <p/> - * Les fichiers rst sont dans les repertoires: - * <li> src/site/fr/rst/ - * <li> src/site/en/rst/ - * <li> src/site/es/rst/ - * <li> ... - * <p/> - * et ils iront au final dans: - * <li> target/generated-site/fr/xdoc/ - * <li> target/generated-site/en/xdoc/ - * <li> target/generated-site/es/xdoc/ - * <li> ... - * <p/> - * tous les autres fichiers iront dans target/generated-site en - * respectant la meme hierarchie de repertoire. - * - * @goal jrst - * @phase pre-site - */ -public class JRstPlugin extends AbstractMojo implements FileAction { - /** - * Répertoire source des fichiers Rst - * - * @parameter default-value="src/site" - * @required - */ - private String directoryIn = "src/site"; - - /** - * Encoding en entrée - * - * @parameter default-value="UTF-8" - */ - private String inputEncoding = "UTF-8"; - - /** - * Encoding en sortie - * - * @parameter default-value="UTF-8" - */ - private String outputEncoding = "UTF-8"; - - /** - * Répertoire cible des fichiers xdoc générée - * - * @parameter default-value="target/generated-site" - * @required - */ - private String directoryOut = "target/generated-site"; - - /** - * Arréte la génération en cas d'erreurs - * - * @parameter default-value="true" - */ - private boolean ignoreErrors = true; - - /** - * Ecrase les fichiers générés - * - * @parameter default-value="ifnewer" - */ - private String overwrite = "ifnewer"; - - /** @parameter default-value="fr" */ - private String defaultLocale = "fr"; - - /** - * Permet d'obtenir plus d'information - * - * @parameter default-value="false" - */ - private boolean verbose = false; - - /** - * Number of generated files. - */ - private int numberFilesGenerates; - - /** - * Retourne la langue par defaut precisé dans le pom.xml - * - * @return la langue par defaut precisé dans le pom.xml - */ - protected String getDefaultLocale() { - return defaultLocale; - } - - /** @return the overwrite */ - public JRST.Overwrite getOverwrite() { - JRST.Overwrite result = JRST.Overwrite.NEVER; - if (this.overwrite.contains("new")) { - result = JRST.Overwrite.IFNEWER; - } else if ("true".equalsIgnoreCase(this.overwrite) - || "alltime".equalsIgnoreCase(this.overwrite)) { - result = JRST.Overwrite.ALLTIME; - } - return result; - } - - public void execute() throws MojoExecutionException { - try { - actionGenerate(); - } catch (GenerationJRstException e) { - System.out.println("Error during generation for :\n" - + GenerationJRstException.getFilesErrors()); - if (!ignoreErrors) - throw new MojoExecutionException("Erreur lors de l'execution"); - } - actionCopy(); - } - - private void actionGenerate() { - getLog().info("Génération des fichier xdocs à partir des fichiers rst"); - numberFilesGenerates = 0; - FileUtil.walkAfter(new File(directoryIn), this); - getLog().info( - "Generating " + numberFilesGenerates + " files to " - + directoryOut); - } - - public boolean doAction(File file) { - String fileIn = file.getAbsoluteFile().toString(); - String fileOut = null; - getLog().info("Using " + fileIn); - if (fileIn.matches(".*[/\\\\]rst[/\\\\].*\\.rst")) { - fileOut = fileIn.replace(directoryIn, directoryOut).replace(".rst", - ".xml").replaceFirst("([/\\\\])rst([/\\\\])", "$1xdoc$2"); - - if (defaultLocale != null && !"".equals(defaultLocale)) { - fileOut = fileOut.replaceFirst("([/\\\\])" + defaultLocale - + "([/\\\\])", "$1"); - } - - try { - JRST.generate(JRST.TYPE_XDOC, new File(fileIn), inputEncoding, - new File(fileOut), outputEncoding, getOverwrite()); - numberFilesGenerates++; - } catch (Exception e) { - getLog().error(e); - if (!ignoreErrors) { - throw new GenerationJRstException(fileIn); - } - } - } - - if (fileOut != null && verbose) { - getLog().info("Using " + fileIn); - getLog().info("Generating " + fileOut); - } - return true; - } - - private void actionCopy() { - getLog().info("Copie des fichiers images"); - /* Execution de la tâche ant copy */ - - try { - if (defaultLocale != null && !"".equals(defaultLocale)) { - // copie de tous les fichiers non rst - FileUtil.copyAndRenameRecursively(new File(directoryIn), - new File(directoryOut), false, "([/\\\\])" - + defaultLocale + "([/\\\\])", "$1", true, - ".*[/\\\\]rst[/\\\\].*"); - - // copie des images du repertoire rst dans le build-site - FileUtil.copyAndRenameRecursively( - new File(directoryIn), - new File(directoryOut), - false, // on ne copie que le contenu de directoryIn - "([/\\\\])" + defaultLocale + "([/\\\\])rst([/\\\\])", - "$1resources$2", false, - ".*[/\\\\]rst[/\\\\].*(\\.png|\\.jpeg|\\.jpg|\\.gif)$"); - } else { - // copie de tous les fichiers non rst - FileUtil.copyAndRenameRecursively(new File(directoryIn), - new File(directoryOut), false, "", "", true, - ".*[/\\\\]rst[/\\\\].*"); - - // copie des images du repertoire rst dans le build-site - FileUtil.copyAndRenameRecursively(new File(directoryIn), - new File(directoryOut), false, "([/\\\\])rst([/\\\\])", - "$1resources$2", false, - ".*[/\\\\]rst[/\\\\].*(\\.png|\\.jpeg|\\.jpg|\\.gif)$"); - } - } catch (IOException eee) { - getLog().error(eee); - } - } -} Copied: maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java (from rev 223, maven-jrst-plugin/trunk/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java) =================================================================== --- maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java (rev 0) +++ maven-jrst-plugin/tags/0.8.3/src/main/java/org/codelutin/jrst/plugin/JRstPlugin.java 2008-10-08 23:13:51 UTC (rev 235) @@ -0,0 +1,319 @@ +/* *##% Plugin maven JRst + * Copyright (C) 2006 - 2008 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + +/* * + * JRstPlugin.java + * + * Created: 14 avril 2006 + * + * @author ruchaud + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ + +package org.codelutin.jrst.plugin; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codelutin.jrst.JRST; +import org.codelutin.util.FileUtil; +import org.codelutin.util.MirroredFileUpdater; + +import java.io.File; +import java.io.IOException; + +/** + * Génére du xdoc à partir de fichiers Rst. + * <p/> + * Les fichiers rst sont dans les repertoires: + * <li> src/site/fr/rst/ + * <li> src/site/en/rst/ + * <li> src/site/es/rst/ + * <li> ... + * <p/> + * et ils iront au final dans: + * <li> target/generated-rst/fr/xdoc/ + * <li> target/generated-rst/en/xdoc/ + * <li> target/generated-rst/es/xdoc/ + * <li> ... + * <p/> + * tous les autres fichiers iront dans target/generated-site en + * respectant la meme hierarchie de repertoire. + * + * @goal jrst + * @phase pre-site + */ +public class JRstPlugin extends AbstractMojo { + + /** La liste des ressource a copier si rien n'est specifie via la propriete includeResources */ + protected static final String[] DEFAULT_INCLUDE_RESOURCES = { + "**\\/*.png", + "**\\/*.jpeg", + "**\\/*.jpg", + "**\\/*.gif" + }; + + + /** + * Répertoire source des fichiers Rst + * + * @parameter default-value="src/site" + * @required + */ + protected File directoryIn; + + /** + * Encoding en entrée + * + * @parameter default-value="UTF-8" + */ + protected String inputEncoding = "UTF-8"; + + /** + * Encoding en sortie + * + * @parameter default-value="UTF-8" + */ + protected String outputEncoding = "UTF-8"; + + /** + * Répertoire cible des fichiers xdoc générée + * + * @parameter default-value="target/generated-site" + * @required + */ + protected File directoryOut; + + /** + * Répertoire cible des fichiers resources générée + * + * @parameter default-value="target/generated-site/resources" + * @required + */ + protected File resourceDirectoryOut; + + /** + * Arréte la génération en cas d'erreurs + * + * @parameter default-value="true" + */ + protected boolean ignoreErrors = true; + + /** + * Ecrase les fichiers générés + * + * @parameter default-value="ifnewer" + */ + protected String overwrite = "ifnewer"; + + /** + * La locale par defaut a utiliser. + * + * @parameter default-value="fr" + */ + protected String defaultLocale = "fr"; + + /** + * Permet d'obtenir plus d'information + * + * @parameter expression="${jrst.verbose}" default-value="${maven.verbose}" + */ + protected boolean verbose; + + /** + * Flag pour forcer la generation des rst et la copie des resources. + * + * @parameter expression="${jrst.force}" default-value="false" + */ + protected boolean force; + + /** + * La liste des ressources a recopier + * + * @parameter expression="${jrst.includeResources}" + */ + protected String[] includeResources; + + /** Number of generated files. */ + protected int numberFilesGenerates; + + /** + * Retourne la langue par defaut precisé dans le pom.xml + * + * @return la langue par defaut precisé dans le pom.xml + */ + protected String getDefaultLocale() { + return defaultLocale; + } + + /** @return the overwrite */ + public JRST.Overwrite getOverwrite() { + JRST.Overwrite result = JRST.Overwrite.NEVER; + if (this.overwrite.contains("new")) { + result = JRST.Overwrite.IFNEWER; + } else if ("true".equalsIgnoreCase(this.overwrite) + || "alltime".equalsIgnoreCase(this.overwrite)) { + result = JRST.Overwrite.ALLTIME; + } + return result; + } + + public void execute() throws MojoExecutionException { + try { + actionGenerate(); + } catch (GenerationJRstException e) { + getLog().error("Error during generation for :\n" + + GenerationJRstException.getFilesErrors()); + if (!ignoreErrors) { + throw new MojoExecutionException("Erreur lors de l'execution"); + } + } + actionCopy(); + } + + private void actionGenerate() { + getLog().info("Génération des fichier xdocs à partir des fichiers rst"); + + MirroredFileUpdater rstUpdater = new RstUpdater(directoryIn, directoryOut, defaultLocale); + + numberFilesGenerates = 0; + DirectoryScanner ds = new DirectoryScanner(); + ds.setBasedir(directoryIn); + ds.setIncludes(new String[]{"**\\/*.rst"}); + ds.scan(); + String[] files = ds.getIncludedFiles(); + + for (String file : files) { + File in = new File(directoryIn, file); + + if (!force && rstUpdater.isFileUpToDate(in)) { + if (verbose) { + getLog().info("skip up-to-date rst file : " + in); + } + continue; + } + + doAction(in, rstUpdater.getMirrorFile(in)); + } + + getLog().info("Generating " + numberFilesGenerates + " files to " + directoryOut); + } + + public boolean doAction(File in, File out) { + + getLog().info("Using " + in); + + try { + JRST.generate(JRST.TYPE_XDOC, in, inputEncoding, + out, outputEncoding, getOverwrite()); + numberFilesGenerates++; + } catch (Exception e) { + getLog().error(e); + if (!ignoreErrors) { + throw new GenerationJRstException(in.getAbsolutePath()); + } + } + + if (out != null && verbose) { + //getLog().info("Using " + fileIn); + getLog().info("Generating " + out); + } + return true; + } + + protected void actionCopy() { + getLog().info("Copie des fichiers images"); + + MirroredFileUpdater resourceUpdater = new RessourceUpdater(directoryIn, resourceDirectoryOut, defaultLocale); + + DirectoryScanner ds = new DirectoryScanner(); + ds.setBasedir(directoryIn); + ds.setIncludes(includeResources == null || includeResources.length == 0 ? DEFAULT_INCLUDE_RESOURCES : includeResources); + ds.scan(); + + for (String file : ds.getIncludedFiles()) { + File in = new File(directoryIn, file); + if (!force && resourceUpdater.isFileUpToDate(in)) { + if (verbose) { + getLog().info("skip up-to-date resource file : " + in); + } + // do not copy the resource + continue; + } + File out = resourceUpdater.getMirrorFile(in); + if (verbose) { + getLog().info("copy resource " + in + " to " + out); + } + try { + FileUtil.copy(in, out); + } catch (IOException e) { + getLog().error(e); + } + } + } + + /** + * An updater for rst files + * + * @author chemit + */ + protected static class RstUpdater extends MirroredFileUpdater { + + protected String defaultLocale; + + protected RstUpdater(File sourceDirectory, File destinationDirectory, String defaultLocale) { + super(sourceDirectory, destinationDirectory); + this.defaultLocale = defaultLocale; + } + + public File getMirrorFile(File f) { + String file = f.getAbsolutePath().substring(prefixSourceDirecotory); + file = file.replace(".rst", ".xml").replaceFirst("([/\\\\])rst([/\\\\])", "$1xdoc$2"); + if (defaultLocale != null && !"".equals(defaultLocale)) { + file = file.replaceFirst("([/\\\\])" + defaultLocale + "([/\\\\])", "$1"); + } + return new File(destinationDirectory, file); + } + } + + /** + * An updater for resources files + * + * @author chemit + */ + protected static class RessourceUpdater extends MirroredFileUpdater { + + protected String defaultLocale; + + protected RessourceUpdater(File sourceDirectory, File destinationDirectory, String defaultLocale) { + super(sourceDirectory, destinationDirectory); + this.defaultLocale = defaultLocale; + } + + public File getMirrorFile(File f) { + String file = f.getAbsolutePath().substring(prefixSourceDirecotory); + file = file.replaceFirst("([/\\\\])rst([/\\\\])", "$1$2"); + if (defaultLocale != null && !"".equals(defaultLocale)) { + file = file.replaceFirst("([/\\\\])" + defaultLocale + "([/\\\\])", "$1"); + } + return new File(destinationDirectory, file); + } + } +} Copied: maven-jrst-plugin/tags/0.8.3/src/main/resources (from rev 220, maven-jrst-plugin/trunk/src/main/resources) Copied: maven-jrst-plugin/tags/0.8.3/src/site/fr (from rev 222, maven-jrst-plugin/trunk/src/site/fr) Deleted: maven-jrst-plugin/tags/0.8.3/src/site/site.xml =================================================================== --- maven-jrst-plugin/trunk/src/site/site.xml 2008-10-03 13:18:32 UTC (rev 219) +++ maven-jrst-plugin/tags/0.8.3/src/site/site.xml 2008-10-08 23:13:51 UTC (rev 235) @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="MavenJRstPlugin"> - - <skin> - <groupId>lutinlib</groupId> - <artifactId>lutin-site-skin</artifactId> - <version>0.1</version> - </skin> - - <bannerLeft> - <name>Maven-JRst-Plugin</name> - </bannerLeft> - - <bannerRight> - <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> - <href>http://www.codelutin.com</href> - </bannerRight> - - <poweredBy> - <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> - <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> - <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/> - </poweredBy> - - <body> - <links> - <item name="JRst" href="http://jrst.labs.libre-entreprise.org/"/> - <item name="Labs" href="http://labs.libre-entreprise.org/"/> - <item name="Code Lutin" href="http://www.codelutin.com/"/> - </links> - - <menu name="Utilisateur"> - <item href="index.html" name="Accueil"/> - <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/lutinplugin/maven-jrst-..." name="T�l�chargement"/> - </menu> - - <!--<menu name="Developpeur"> - <item name="Todo" href="Todo.html"/> - </menu>--> - - ${reports} - - </body> -</project> Copied: maven-jrst-plugin/tags/0.8.3/src/site/site.xml (from rev 226, maven-jrst-plugin/trunk/src/site/site.xml) =================================================================== --- maven-jrst-plugin/tags/0.8.3/src/site/site.xml (rev 0) +++ maven-jrst-plugin/tags/0.8.3/src/site/site.xml 2008-10-08 23:13:51 UTC (rev 235) @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <publishDate format="dd/MM/yyyy"/> + + <skin> + <groupId>org.codelutin</groupId> + <artifactId>maven-lutin-skin</artifactId> + <version>0.2</version> + </skin> + + <bannerLeft> + <name>${project.name}</name> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>${project.organization.url}</href> + </bannerRight> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> + <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> + <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" + img="images/restructuredtext-logo.png"/> + </poweredBy> + + <body> + <links> + <item name="Labs" href="http://labs.libre-entreprise.org/"/> + <item name="${project.organization.name}" href="${project.organization.url}"/> + </links> + + <menu ref="parent"/> + <menu name="Utilisateur"> + <item name="Accueil" href="index.html"/> + <item name="Détail des goals" href="plugin-info.html"> + <item name="jrst:jrst" href="jrst-mojo.html"/> + <item name="jrst:help" href="help-mojo.html"/> + </item> + </menu> + + <menu name="Téléchargement"> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}" + name="Télécharger la dernière version"/> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}" + name="Voir toutes les versions"/> + </menu> + + <menu name="Développeur"> + <item name="A faire" href="Todo.html"/> + </menu> + + <menu ref="reports"/> + + </body> +</project>