You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2012/05/29 10:15:41 UTC

svn commit: r1343595 - in /sling/site/trunk: lib/view.pm templates/downloads.html

Author: fmeschbe
Date: Tue May 29 08:15:41 2012
New Revision: 1343595

URL: http://svn.apache.org/viewvc?rev=1343595&view=rev
Log:
SLING-2002 Improved rendition and add Maven plugins

Modified:
    sling/site/trunk/lib/view.pm
    sling/site/trunk/templates/downloads.html

Modified: sling/site/trunk/lib/view.pm
URL: http://svn.apache.org/viewvc/sling/site/trunk/lib/view.pm?rev=1343595&r1=1343594&r2=1343595&view=diff
==============================================================================
--- sling/site/trunk/lib/view.pm (original)
+++ sling/site/trunk/lib/view.pm Tue May 29 08:15:41 2012
@@ -87,8 +87,13 @@ sub single_narrative {
 
 # The specially crafted download page
 # Input is a list of artifacts formatted as:
+#
 #   <title>|<id>|<version>[|<qualifier>]
-
+#
+# Special handling if title is "sling": This denotes the
+# version of the Sling Launchpad distribution whie is
+# rendered specially: The id is actually the launchpad
+# distribution version
 sub downloads {
 	my %args = @_;	
     my $file = "content$args{path}";
@@ -100,6 +105,7 @@ sub downloads {
     read_text_file $file, \%args;
 
     my $result = "|Artifact | Version | Binary | Source|\n|--|--|--|--|\n";
+    my $maven = "|Artifact | Version | Binary | Source|\n|--|--|--|--|\n";
     my $launchpad = "| Artifact | Version | Provides | Package |\n|-|-|-|-|\n";
 
     my @lines = split( /\n/, $args{content} );
@@ -113,19 +119,32 @@ sub downloads {
     	
     	if ($title eq "sling") {
     		
-            $launchpad .="| Sling Standalone Application | $artifact | A self-runnable Sling jar. | " . downloadmirror("sling", "org.apache.sling.launchpad-$artifact-standalone.jar"). "|\n";
-            $launchpad .="| Sling Web Application | $artifact | A ready-to run Sling webapp as a war file. | " . downloadmirror("sling", "org.apache.sling.launchpad-$artifact.war"). "|\n";
-            $launchpad .="| Sling Source Package | $artifact | The released Sling source code. | " . downloadmirror("sling", "sling-$artifact-source-release.tar.gz")."<br/>" . downloadmirror("sling", "sling-$artifact-source-release.zip")." |\n";
+            $launchpad .="| Sling Standalone Application | $artifact | A self-runnable Sling jar. | " . downloadLink("org.apache.sling.launchpad-$artifact-standalone.jar"). "|\n";
+            $launchpad .="| Sling Web Application | $artifact | A ready-to run Sling webapp as a war file. | " . downloadLink("org.apache.sling.launchpad-$artifact.war"). "|\n";
+            $launchpad .="| Sling Source Package | $artifact | The released Sling source code. | " . downloadLink("sling-$artifact-source-release.tar.gz")."<br/>" . downloadLink("sling-$artifact-source-release.zip")." |\n";
             
     	} else {
 	    	
-	        $result .= "|$title|$version|" . slingdownload($ext, "$artifact-$version$classifier") . " | " . slingdownload("zip", "$artifact-$version-source-release") . "|\n";
-	        
+	    	my $target = \$result;
+	    	my $artifactLabel;
+	    	if ($ext eq "war") {
+                $artifactLabel = "Web Application";
+	    	} elsif ($classifier eq "-app") {
+                $artifactLabel = "Java Application";
+	    	} elsif ($artifact =~/^maven-/) {
+	    		$target = \$maven;
+                $artifactLabel = "Maven Plugin";
+	    	} else {
+	    		$artifactLabel = "Bundle";
+	    	}
+	    	
+	        ${$target} .= "|$title|$version|" . downloadLink("$artifact-$version$classifier.$ext", $artifactLabel) . " | " . downloadLink("$artifact-$version-source-release.zip", "Source ZIP") . "|\n";
     	}
     }
 
     $args{launchpad} = $launchpad;
     $args{content} = $result;
+    $args{maven} = $maven;
     
     return Dotiac::DTL::Template($template)->render(\%args), html => \%args;
 }
@@ -316,33 +335,11 @@ sub read_ref_page_data {
     return $out;
 }
 
-sub downloadmirror {
-    my ($param0, $body) = @_;
-	my $dp = "http://www.apache.org/dist";
-	my $dld = "${body}";
-	my $asc = "${body}.asc";
-	my $md5 = "${body}.md5";
-	return "[$body]([preferred]/$param0/$dld) ([asc]($dp/$param0/$asc), [md5]($dp/$param0/$md5))";
-}
-
-sub slingdownload {
-	my ($param0, $body) = @_;
+sub downloadLink {
+	my ($artifact, $label) = @_;
     my $dp = "http://www.apache.org/dist";
-    
-    if ($param0 eq "bin") {
-		my $dld1 = "${body}.tar.gz";
-		my $asc1 = "${dld1}.asc";
-		my $md51 = "${dld1}.md5";
-		my $dld2 = "${body}.zip";
-		my $asc2 = "${dld2}.asc";
-		my $md52 = "${dld2}.md5";
-		return "[tar.gz]([preferred]/sling/$dld1) ([asc]($dp/sling/$asc1), [md5]($dp/sling/$md51)) [zip]([preferred]/sling/$dld2) ([asc]($dp/sling/$asc2), [md5]($dp/sling/$md52)";
-    } else {
-        my $dld = "${body}.${param0}";
-        my $asc = "${dld}.asc";
-        my $md5 = "${dld}.md5";
-        return "[$param0]([preferred]/sling/$dld) ([asc]($dp/sling/$asc), [md5]($dp/sling/$md5))";
-    }
+    $label = $artifact unless ($label);
+    return "[$label]([preferred]/sling/$artifact) ([asc]($dp/sling/$artifact.asc), [md5]($dp/sling/$artifact.md5))";
 }
 
 sub breadcrumbs {

Modified: sling/site/trunk/templates/downloads.html
URL: http://svn.apache.org/viewvc/sling/site/trunk/templates/downloads.html?rev=1343595&r1=1343594&r2=1343595&view=diff
==============================================================================
--- sling/site/trunk/templates/downloads.html (original)
+++ sling/site/trunk/templates/downloads.html Tue May 29 08:15:41 2012
@@ -18,7 +18,16 @@ Software License (version 2.0). See our
 in each distribution.
 </p>
 
-<h2>Mirrors</h2>
+<div class="toc">
+<ul>
+<li><a href="#mirrors">Mirrors</a></li>
+<li><a href="#application">Sling Application</a></li>
+<li><a href="#components">Sling Components</a></li>
+<li><a href="#maven">Maven Plugins</a></li>
+</ul>
+</div>
+
+<h2 id="mirrors">Mirrors</h2>
 
 <p>
 Use the links below to download binary or source distributions of Apache
@@ -49,7 +58,7 @@ please reload this page by <a href="/dow
 <input type="submit" value="Change"></input>
 </form>
 
-<h2>Sling Application</h2>
+<h2 id="application">Sling Application</h2>
 
 {{ launchpad|markdown }}
 
@@ -66,7 +75,10 @@ incubator releases of Apache Sling, have
 <a href="http://archive.apache.org/dist/incubator/sling/">Incubator archives</a>.
 </p>
 
-<h2>Sling Components</h2>
+<h2 id="components">Sling Components</h2>
 {{ content|markdown }}
 
+<h2 id="maven">Maven Plugins</h2>
+{{ maven|markdown }}
+
 {% endblock %}