jvanzyl     02/02/25 21:27:54

  Modified:    src/java/org/apache/maven ChangeLog.java
               src/templates/build build-docs.xml
  Log:
  Adding "site" target to the docs so one can easily view the whole
  site before deploying the site.
  
  The ChangeLog task now uses a TreeMap so that the entries are sorted
  and will optionally take a "days" parameter so that that only that
  number of "days" will be displayed from the current day.
  
  Revision  Changes    Path
  1.7       +39 -6     jakarta-turbine-maven/src/java/org/apache/maven/ChangeLog.java
  
  Index: ChangeLog.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ChangeLog.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChangeLog.java    25 Feb 2002 12:54:08 -0000      1.6
  +++ ChangeLog.java    26 Feb 2002 05:27:54 -0000      1.7
  @@ -63,7 +63,6 @@
   import org.apache.maven.project.Project;
   import org.apache.maven.project.Developer;
   
  -
   /**
    * Change log task. The task will examine the output of cvs log and group
    * related changes together. It produces an XML output representing the list of
  @@ -71,7 +70,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jeff Martin</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: ChangeLog.java,v 1.6 2002/02/25 12:54:08 kaz Exp $
  + * @version $Id: ChangeLog.java,v 1.7 2002/02/26 05:27:54 jvanzyl Exp $
    */
   public class ChangeLog
        extends Task
  @@ -80,7 +79,13 @@
       /**
        * Project descriptor.
        */
  -    protected File projectDescriptor;
  +    private File projectDescriptor;
  +
  +    /**
  +     * Date range option to use with the 'cvs log' command. Only used
  +     * when <code>days</code> is set.
  +     */
  +    private String dateRange;
   
       /**
        * User list
  @@ -119,7 +124,7 @@
       /**
        * rcs entries
        */
  -    private Hashtable entries = new Hashtable();
  +    private Map entries = new TreeMap();
   
       /**
        * input format for dates read in from cvs log
  @@ -148,6 +153,18 @@
       }
   
       /**
  +     * Set the numbers of days worth of log entries to process.
  +     */
  +    public void setDays(int days)
  +    {
  +        Date d = new Date(
  +            System.currentTimeMillis() - days * 24 * 60 * 60 * 1000);
  +
  +        // We want something of the form: -d ">=YYYY/MM/dd"
  +        dateRange = "-d >=" + inputDate.format(d);
  +    }
  +
  +    /**
        * Set the input stream for the cvs process. cvs requires no input so this
        * is not used.
        */
  @@ -202,15 +219,23 @@
       public void execute()
           throws BuildException
       {
  +        if (projectDescriptor == null)
  +        {
  +            throw new BuildException("projectDescriptor must be set");
  +        }
  +
   
           if (base == null)
           {
               throw new BuildException("basedir must be set");
           }
  +
           if (output == null)
           {
               throw new BuildException("output must be set");
           }
  +
  +
           if (!base.exists())
           {
               throw new BuildException(
  @@ -245,6 +270,12 @@
   
           toExecute.setExecutable("cvs");
           toExecute.createArgument().setValue("log");
  +
  +        if (dateRange != null)
  +        {
  +            toExecute.createArgument().setValue(dateRange);
  +        }
  +
           Execute exe = new Execute(this);
           exe.setCommandline(toExecute.getCommandline());
           exe.setAntRun(project);
  @@ -367,10 +398,12 @@
           out.println("<body>");
           out.println("<section name=\"Change Log\"/>");
           out.println("<changelog>");
  -        for (Enumeration en = entries.elements(); en.hasMoreElements(); )
  +
  +        for (Iterator i = entries.values().iterator(); i.hasNext(); )
           {
  -            ((Entry) en.nextElement()).print();
  +            ((Entry) i.next()).print();
           }
  +
           out.println("</changelog>");
           out.println("</body>");
           out.println("</document>");
  
  
  
  1.19      +12 -2     jakarta-turbine-maven/src/templates/build/build-docs.xml
  
  Index: build-docs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-docs.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- build-docs.xml    25 Feb 2002 23:13:27 -0000      1.18
  +++ build-docs.xml    26 Feb 2002 05:27:54 -0000      1.19
  @@ -76,6 +76,7 @@
         projectDescriptor="project.xml"
         baseDir="src"
         output="xdocs/changelog.xml"
  +      days="5"
       />
     
     </target>
  @@ -191,12 +192,21 @@
     </target>
   
     <!-- ================================================================== -->
  -  <!-- D E P L O Y  S I T E                                               -->
  +  <!-- S I T E                                                            -->
     <!-- ================================================================== -->
   
  +  <target
  +    name="site"
  +    depends="init,docs,javadocs,cross-ref"
  +  />
  +
  +  <!-- ================================================================== -->
  +  <!-- D E P L O Y  S I T E                                               -->
  +  <!-- ================================================================== -->
  +  
     <target 
       name="deploy-site" 
  -    depends="init,docs,javadocs,cross-ref">
  +    depends="site">
       
       <!-- This needs to taken from the project properties -->
       <property name="homepage" value="/www/jakarta.apache.org/turbine/maven/"/>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to