servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ksobkow...@apache.org
Subject svn commit: r1730098 - in /servicemix/website/trunk/src: main/scala/org/apache/servicemix/website/Helper.scala test/scala/org/apache/servicemix/website/HelperTest.scala
Date Fri, 12 Feb 2016 19:52:46 GMT
Author: ksobkowiak
Date: Fri Feb 12 19:52:46 2016
New Revision: 1730098

URL: http://svn.apache.org/viewvc?rev=1730098&view=rev
Log:
SM-2395: Download pages should correctly refer the documentation pages

Modified:
    servicemix/website/trunk/src/main/scala/org/apache/servicemix/website/Helper.scala
    servicemix/website/trunk/src/test/scala/org/apache/servicemix/website/HelperTest.scala

Modified: servicemix/website/trunk/src/main/scala/org/apache/servicemix/website/Helper.scala
URL: http://svn.apache.org/viewvc/servicemix/website/trunk/src/main/scala/org/apache/servicemix/website/Helper.scala?rev=1730098&r1=1730097&r2=1730098&view=diff
==============================================================================
--- servicemix/website/trunk/src/main/scala/org/apache/servicemix/website/Helper.scala (original)
+++ servicemix/website/trunk/src/main/scala/org/apache/servicemix/website/Helper.scala Fri
Feb 12 19:52:46 2016
@@ -49,9 +49,13 @@ object Helper {
   def sha1(specs: (ReleaseArtifact => ReleaseArtifact)*)(implicit release: Release) :
String = _metafile(artifactFor(specs, release), "sha1")
 
   /**
-   * The version specific docs url for a page
-   */
-  def docs(page: String)(implicit release: Release) = s"http://servicemix.apache.org/docs/${release.majorMinorX}/${page}"
+    * The version specific docs url for a page
+    */
+  def docs(page: String)(implicit release: Release) = release match {
+    case Release(version, _) if version.startsWith("3") => s"http://servicemix.apache.org/docs/${release.majorMinorX}/${page}"
+    case Release(version, _) if version.startsWith("4") => s"http://servicemix.apache.org/docs/${release.majorMinorX}/${page}"
+    case _ => s"http://servicemix.apache.org/docs/${release.majorX}/${page}"
+  }
 
   /**
    * Function to specify a -minimal assembly
@@ -115,7 +119,8 @@ object Helper {
     case ReleaseArtifact(Release(version, _), _, _, _) if version.startsWith("3") => "servicemix-3"
     case ReleaseArtifact(Release(version, _), _, _, _) if version.startsWith("4") => "servicemix-4"
     case ReleaseArtifact(Release(version, _), _, _, _) if version.startsWith("5") => "servicemix-5"
-    case _ => "servicemix-6"
+    case ReleaseArtifact(Release(version, _), _, _, _) if version.startsWith("6") => "servicemix-6"
+    case _ => "servicemix-7"
   }
 
   val versionOf : ReleaseArtifact => String = _.release.version
@@ -162,4 +167,9 @@ case class Release(version: String, arch
     case _                   => throw new RuntimeException(s"Unable to convert ${version}
to <major>.<minor>.x format")
   }
 
+  lazy val majorX = version.split("\\.").slice(0,1) match {
+    case Array(major) => s"${major}.x"
+    case _            => throw new RuntimeException(s"Unable to convert ${version} to
<major>.<minor>.x format")
+  }
+
 }

Modified: servicemix/website/trunk/src/test/scala/org/apache/servicemix/website/HelperTest.scala
URL: http://svn.apache.org/viewvc/servicemix/website/trunk/src/test/scala/org/apache/servicemix/website/HelperTest.scala?rev=1730098&r1=1730097&r2=1730098&view=diff
==============================================================================
--- servicemix/website/trunk/src/test/scala/org/apache/servicemix/website/HelperTest.scala
(original)
+++ servicemix/website/trunk/src/test/scala/org/apache/servicemix/website/HelperTest.scala
Fri Feb 12 19:52:46 2016
@@ -81,18 +81,43 @@ class HelperTest {
   }
 
   @Test
-  def testDocumentationForSnapshotRelease = {
+  def testDocumentationForSnapshotReleaseOld = {
     implicit val release = Release("4.5.2-SNAPSHOT")
     assertEquals("http://servicemix.apache.org/docs/4.5.x/index.html", docs("index.html"))
     assertEquals("http://servicemix.apache.org/docs/4.5.x/quickstart/index.html", docs("quickstart/index.html"))
   }
 
   @Test
-  def testDocumentationForRelease = {
+  def testDocumentationForSnapshotRelease = {
+    implicit val release = Release("5.5.2-SNAPSHOT")
+    assertEquals("http://servicemix.apache.org/docs/5.x/index.html", docs("index.html"))
+    assertEquals("http://servicemix.apache.org/docs/5.x/quickstart/index.html", docs("quickstart/index.html"))
+  }
+
+  @Test
+  def testDocumentationForReleaseOld = {
     implicit val release = Release("4.4.2")
     assertEquals("http://servicemix.apache.org/docs/4.4.x/index.html", docs("index.html"))
     assertEquals("http://servicemix.apache.org/docs/4.4.x/quickstart/index.html", docs("quickstart/index.html"))
   }
 
+  @Test
+  def testDocumentationForRelease = {
+    implicit val release = Release("5.4.2")
+    assertEquals("http://servicemix.apache.org/docs/5.x/index.html", docs("index.html"))
+    assertEquals("http://servicemix.apache.org/docs/5.x/quickstart/index.html", docs("quickstart/index.html"))
+  }
+
+  @Test
+  def testMajorMinorX = {
+    implicit val release = Release("6.1.0")
+    assertEquals("6.1.x", release.majorMinorX)
+  }
+
+  @Test
+  def testMajorX = {
+    implicit val release = Release("6.1.0")
+    assertEquals("6.x", release.majorX)
+  }
 
 }



Mime
View raw message