Author: aheritier
Date: Tue May 30 15:58:28 2006
New Revision: 410401
URL: http://svn.apache.org/viewvc?rev=410401&view=rev
Log:
New RSS feed for releases.
Added:
maven/maven-1/plugins/trunk/multichanges/src/main/
maven/maven-1/plugins/trunk/multichanges/src/main/org/
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/RssDateFormatter.java
(with props)
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/images/
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/images/rss.png
(with props)
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases2rss.jsl
Modified:
maven/maven-1/plugins/trunk/multichanges/plugin.jelly
maven/maven-1/plugins/trunk/multichanges/project.xml
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases.jsl
maven/maven-1/plugins/trunk/multichanges/xdocs/changes.xml
Modified: maven/maven-1/plugins/trunk/multichanges/plugin.jelly
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/plugin.jelly?rev=410401&r1=410400&r2=410401&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/multichanges/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/multichanges/plugin.jelly Tue May 30 15:58:28
2006
@@ -61,7 +61,9 @@
the latest release of projects.
========================================================================
-->
- <goal name="multichanges:report" prereqs="multichanges:init">
+ <goal name="multichanges:report"
prereqs="multichanges:generates-releases-report,multichanges:generates-releases-rss"/>
+
+ <goal name="multichanges:generates-releases-file"
prereqs="multichanges:init">
<!-- Gather project list using the maven reactor -->
<m:reactor
@@ -136,6 +138,10 @@
</releases>
</j:file>
+ </goal>
+
+ <goal name="multichanges:generates-releases-report"
prereqs="multichanges:generates-releases-file">
+
<ant:dirname property="reportDir" file="${maven.multichanges.report}"/>
<ant:mkdir dir="${reportDir}"/>
@@ -145,7 +151,33 @@
stylesheet="${plugin.resources}/releases.jsl"
outputMode="xml"
prettyPrint="true"/>
+
+ </goal>
+ <goal name="multichanges:generates-releases-rss"
prereqs="multichanges:generates-releases-file">
+
+ <tstamp>
+ <format property="currentDate" pattern="EEE, dd MMM yyyy HH:mm:ss Z"/>
+ </tstamp>
+ <tstamp>
+ <format property="currentYear" pattern="yyyy"/>
+ </tstamp>
+
+ <!-- Generate a RSS feed of the changes -->
+ <doc:jsl
+ input="${maven.multichanges.data}"
+ output="releases.rss"
+ stylesheet="${plugin.resources}/releases2rss.jsl"
+ encoding="${maven.docs.outputencoding}"
+ outputMode="xml"
+ prettyPrint="false"/>
+
+ <!-- Copy the images -->
+ <mkdir dir="${maven.docs.dest}/images"/>
+ <copy todir="${maven.docs.dest}/images">
+ <fileset dir="${plugin.resources}/images"/>
+ </copy>
+
</goal>
<!--
Modified: maven/maven-1/plugins/trunk/multichanges/project.xml
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/project.xml?rev=410401&r1=410400&r2=410401&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/multichanges/project.xml (original)
+++ maven/maven-1/plugins/trunk/multichanges/project.xml Tue May 30 15:58:28
2006
@@ -64,5 +64,14 @@
<timezone>+1</timezone>
</developer>
</developers>
- <dependencies/>
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ <properties>
+ <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>
+ </dependencies>
</project>
Added:
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/RssDateFormatter.java
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/RssDateFormatter.java?rev=410401&view=auto
==============================================================================
---
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/RssDateFormatter.java
(added)
+++
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/RssDateFormatter.java
Tue May 30 15:58:28 2006
@@ -0,0 +1,56 @@
+package org.apache.maven.plugin.multichanges.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This class provides a method to convert a date in the changes plugin format
+ * (yyyy-MM-dd) to a date in RSS format (RFC 822).
+ *
+ */
+public class RssDateFormatter {
+ /**
+ * The date format used in changes report file (changes.xml used in
+ * maven-changes-plugin).
+ */
+ private final static SimpleDateFormat changesSDF = new SimpleDateFormat(
+ "yyyy-MM-dd");
+
+ /**
+ * The date format defined in RFC 822 and used in RSS feeds.
+ */
+ private final static SimpleDateFormat rfc822DF = new SimpleDateFormat(
+ "EEE, dd MMM yyyy HH:mm:ss Z");
+
+ /**
+ * Log for debug output
+ */
+ private static Log log = LogFactory.getLog(RssDateFormatter.class);
+
+ /**
+ * Converts a date in the changes plugin format (yyyy-MM-dd) to a date
in
+ * RSS format (RFC 822).
+ *
+ * @param changesDate
+ * the date to convert
+ * @return the date in the RFC 822 format. An empty String if an
exception
+ * occurs.
+ */
+ public static final String convertDate(final String changesDate) {
+ try {
+ return rfc822DF.format(changesSDF.parse(changesDate));
+ } catch (ParseException e) {
+ if (log.isDebugEnabled())
+ log
+ .error("Unable to convert the
date [" + changesDate
+ + "]", e);
+ else
+ log.error("Unable to convert the date [" +
changesDate + "] : "
+ + e.getMessage());
+ return "";
+ }
+ }
+}
Propchange:
maven/maven-1/plugins/trunk/multichanges/src/main/org/apache/maven/plugin/multichanges/util/RssDateFormatter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/images/rss.png
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/images/rss.png?rev=410401&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/images/rss.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Modified:
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases.jsl
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases.jsl?rev=410401&r1=410400&r2=410401&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases.jsl
(original)
+++ maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases.jsl
Tue May 30 15:58:28 2006
@@ -2,7 +2,7 @@
<!--
* ========================================================================
*
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 2004-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +24,12 @@
<properties>
<title>Latest releases</title>
</properties>
+ <head>
+ <link rel="alternative" href="releases.rss" type="application/rss+xml"
/>
+ </head>
<body>
<section name="Latest releases">
+ <p>Get the RSS feed of the last releases <a href="releases.rss"><img
src="images/rss.png"/></a></p>
<table>
<tr>
<th>Project name</th>
Added:
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases2rss.jsl
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases2rss.jsl?rev=410401&view=auto
==============================================================================
---
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases2rss.jsl
(added)
+++
maven/maven-1/plugins/trunk/multichanges/src/plugin-resources/releases2rss.jsl
Tue May 30 15:58:28 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * ========================================================================
+ *
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ========================================================================
+-->
+<jsl:stylesheet select="$doc" xmlns:jsl="jelly:jsl" xmlns:x="jelly:xml"
xmlns:j="jelly:core" xmlns="dummy" trim="false">
+ <!-- This needs to be instantiated here to be available in the template
matches -->
+ <j:useBean var="rssDateFormatter"
class="org.apache.maven.plugin.multichanges.util.RssDateFormatter"/>
+ <jsl:template match="releases">
+ <rss version="2.0">
+ <channel>
+ <title>${pom.name} releases</title>
+ <link>${pom.url}</link>
+ <description>${pom.name} releases</description>
+ <lastBuildDate>${currentDate}</lastBuildDate>
+ <language>en-us</language>
+ <copyright>Copyright ${currentYear}
${pom.organization.name}</copyright>
+ <x:set var="projects" sort="@date" descending="true"
select="project[not(@date = 'Not released') and not(@date = 'No information
available')]"/>
+ <j:forEach var="project" items="${projects}">
+ <j:set var="baseUrl"><x:expr select="$project/@url"/></j:set>
+ <j:set var="version"><x:expr select="$project/@version"/></j:set>
+ <j:set var="date"><x:expr select="$project/@date"/></j:set>
+ <item>
+ <title><x:expr select="$project/@name"/> <x:expr
select="$project/@version"/> released.</title>
+ <link>${baseUrl}/announcements/announcement-${version}.txt</link>
+ <guid>${baseUrl}/announcements/announcement-${version}.txt</guid>
+ <pubDate>${rssDateFormatter.convertDate(date)}</pubDate>
+ </item>
+ </j:forEach>
+ </channel>
+ </rss>
+ </jsl:template>
+</jsl:stylesheet>
\ No newline at end of file
Modified: maven/maven-1/plugins/trunk/multichanges/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/multichanges/xdocs/changes.xml?rev=410401&r1=410400&r2=410401&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/multichanges/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/multichanges/xdocs/changes.xml Tue May 30
15:58:28 2006
@@ -24,6 +24,7 @@
</properties>
<body>
<release version="1.3-SNAPSHOT" date="In SVN">
+ <action dev="aheritier" type="add">New RSS feed for releases.</action>
<action dev="aheritier" type="update">Remove usage of the deprecated
dependency-handle tag.</action>
</release>
<release version="1.2" date="2006-01-07">