Permalink
Browse files

Adding syntax highlighting for Scala code.

  • Loading branch information...
1 parent 3631cc8 commit 1f499af559463eb1c04fd27a8559f69b696fec8d @jsuereth jsuereth committed Jan 24, 2012
Showing with 168 additions and 30 deletions.
  1. +1 −0 src/jekyll/_includes/header.txt
  2. +126 −0 src/jekyll/resources/syntax.css
  3. +41 −30 src/jekyll/using_sonatype.md
@@ -6,6 +6,7 @@
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<link href='http://fonts.googleapis.com/css?family=Copse' rel='stylesheet' type='text/css'>
<link href='resources/site.css' rel='stylesheet' type='text/css'>
+ <link href='resources/syntax.css' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
</script>
</head>
@@ -0,0 +1,126 @@
+.hll { background-color: #ffffcc }
+.scala { /* background: #f8f8f8; */ }
+.c { color: #408080; font-style: italic } /* Comment */
+.err { border: 1px solid #FF0000 } /* Error */
+.k { color: #008000; font-weight: bold } /* Keyword */
+.o { color: #666666 } /* Operator */
+.cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.cp { color: #BC7A00 } /* Comment.Preproc */
+.c1 { color: #408080; font-style: italic } /* Comment.Single */
+.cs { color: #408080; font-style: italic } /* Comment.Special */
+.gd { color: #A00000 } /* Generic.Deleted */
+.ge { font-style: italic } /* Generic.Emph */
+.gr { color: #FF0000 } /* Generic.Error */
+.gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.gi { color: #00A000 } /* Generic.Inserted */
+.go { color: #808080 } /* Generic.Output */
+.gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.gs { font-weight: bold } /* Generic.Strong */
+.gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.gt { color: #0040D0 } /* Generic.Traceback */
+.kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.kp { color: #008000 } /* Keyword.Pseudo */
+.kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.kt { color: #B00040 } /* Keyword.Type */
+.m { color: #666666 } /* Literal.Number */
+.s { color: #BA2121 } /* Literal.String */
+.na { color: #7D9029 } /* Name.Attribute */
+.nb { color: #008000 } /* Name.Builtin */
+.nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.no { color: #880000 } /* Name.Constant */
+.nd { color: #AA22FF } /* Name.Decorator */
+.ni { color: #999999; font-weight: bold } /* Name.Entity */
+.ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.nf { color: #0000FF } /* Name.Function */
+.nl { color: #A0A000 } /* Name.Label */
+.nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.nt { color: #22AA22; font-weight: bold } /* Name.Tag */
+.nv { color: #19177C } /* Name.Variable */
+.ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.w { color: #bbbbbb } /* Text.Whitespace */
+.mf { color: #666666 } /* Literal.Number.Float */
+.mh { color: #666666 } /* Literal.Number.Hex */
+.mi { color: #666666 } /* Literal.Number.Integer */
+.mo { color: #666666 } /* Literal.Number.Oct */
+.sb { color: #BA2121 } /* Literal.String.Backtick */
+.sc { color: #BA2121 } /* Literal.String.Char */
+.sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.s2 { color: #BA2121 } /* Literal.String.Double */
+.se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.sh { color: #BA2121 } /* Literal.String.Heredoc */
+.si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.sx { color: #008000 } /* Literal.String.Other */
+.sr { color: #BB6688 } /* Literal.String.Regex */
+.s1 { color: #BA2121 } /* Literal.String.Single */
+.ss { color: #19177C } /* Literal.String.Symbol */
+.bp { color: #008000 } /* Name.Builtin.Pseudo */
+.vc { color: #19177C } /* Name.Variable.Class */
+.vg { color: #19177C } /* Name.Variable.Global */
+.vi { color: #19177C } /* Name.Variable.Instance */
+.il { color: #666666 } /* Literal.Number.Integer.Long */
+
+
+.scala .hll { /*background-color: #ffffcc*/ }
+.scala { /*background: #f8f8f8;*/ }
+.scala .c { color: #408080; font-style: italic } /* Comment */
+.scala .err { border: 1px solid #FF0000 } /* Error */
+.scala .k { color: #22aa22; font-weight: bold } /* Keyword */
+.scala .o { color: #666666 } /* Operator */
+.scala .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.scala .cp { color: #BC7A00 } /* Comment.Preproc */
+.scala .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.scala .cs { color: #408080; font-style: italic } /* Comment.Special */
+.scala .gd { color: #A00000 } /* Generic.Deleted */
+.scala .ge { font-style: italic } /* Generic.Emph */
+.scala .gr { color: #FF0000 } /* Generic.Error */
+.scala .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.scala .gi { color: #00A000 } /* Generic.Inserted */
+.scala .go { color: #808080 } /* Generic.Output */
+.scala .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.scala .gs { font-weight: bold } /* Generic.Strong */
+.scala .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.scala .gt { color: #0040D0 } /* Generic.Traceback */
+.scala .kc { color: #22AA22; font-weight: bold } /* Keyword.Constant */
+.scala .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.scala .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.scala .kp { color: #008000 } /* Keyword.Pseudo */
+.scala .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.scala .kt { color: #B00040 } /* Keyword.Type */
+.scala .m { color: #666666 } /* Literal.Number */
+.scala .s { color: #ee3333 } /* Literal.String */
+.scala .na { color: #7D9029 } /* Name.Attribute */
+.scala .nb { color: #008000 } /* Name.Builtin */
+.scala .nc { color: #6677ff; font-weight: bold } /* Name.Class */
+.scala .no { color: #880000 } /* Name.Constant */
+.scala .nd { color: #AA22FF } /* Name.Decorator */
+.scala .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.scala .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.scala .nf { color: #0000FF } /* Name.Function */
+.scala .nl { color: #A0A000 } /* Name.Label */
+.scala .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.scala .nt { color: #22AA22; font-weight: bold } /* Name.Tag */
+.scala .nv { color: #19177C } /* Name.Variable */
+.scala .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.scala .w { color: #bbbbbb } /* Text.Whitespace */
+.scala .mf { color: #666666 } /* Literal.Number.Float */
+.scala .mh { color: #666666 } /* Literal.Number.Hex */
+.scala .mi { color: #666666 } /* Literal.Number.Integer */
+.scala .mo { color: #666666 } /* Literal.Number.Oct */
+.scala .sb { color: #BA2121 } /* Literal.String.Backtick */
+.scala .sc { color: #BA2121 } /* Literal.String.Char */
+.scala .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.scala .s2 { color: #BA2121 } /* Literal.String.Double */
+.scala .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.scala .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.scala .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.scala .sx { color: #008000 } /* Literal.String.Other */
+.scala .sr { color: #BB6688 } /* Literal.String.Regex */
+.scala .s1 { color: #BA2121 } /* Literal.String.Single */
+.scala .ss { color: #19177C } /* Literal.String.Symbol */
+.scala .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.scala .vc { color: #19177C } /* Name.Variable.Class */
+.scala .vg { color: #19177C } /* Name.Variable.Global */
+.scala .vi { color: #19177C } /* Name.Variable.Instance */
+.scala .il { color: #666666 } /* Literal.Number.Integer.Long */
@@ -16,51 +16,60 @@ You'll need to PGP sign your artifacts for the Sonatype repository. Don't worry
To publish to a maven repository, you'll need to configure a few settings so that the correct metadata is generated.
- publishMavenStyle := true
+{% highlight scala %}
+publishMavenStyle := true
+{% endhighlight %}
is used to ensure POMs are generated and pushed. Next, you have to set up the repositories you wish to push too. Luckily, Sonatype's OSSRH uses the same URLs for everyone:
- publishTo <<= version { (v: String) =>
- val nexus = "https://oss.sonatype.org/"
- if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
- else Some("releases" at nexus + "service/local/staging/deploy/maven2")
- }
+{% highlight scala %}
+publishTo <<= version { (v: String) =>
+ val nexus = "https://oss.sonatype.org/"
+ if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
+ else Some("releases" at nexus + "service/local/staging/deploy/maven2")
+}
+{% endhighlight %}
Another good idea is to not publish your test artifacts:
- publishArtifact in Test := false
+{% highlight scala %}
+publishArtifact in Test := false
+{% endhighlight %}
## Third - POM Metadata ##
Now, we want to control what's available in the `pom.xml` file. This file describes our project in the maven repository and is used by indexing services for search and discover. This means it's important that `pom.xml` should have all information we wish to advertise as well as required info!
First, let's make sure no repositories show up in the POM file. To publish on maven-central, all *required* artifacts must also be hosted on maven central. However, sometimes we have optional dependencies for special features. If that's the case, let's remove the repositories for optional dependencies in our artifact:
- pomIncludeRepository := { x => false },
+{% highlight scala %}
+pomIncludeRepository := { x => false },
+{% endhighlight %}
Next, the POM metadata that isn't generated by SBT must be added. This is done through the `pomExtra` configuration option:
- pomExtra := (
- <url>http://jsuereth.com/scala-arm</url>
- <licenses>
- <license>
- <name>BSD-style</name>
- <url>http://www.opensource.org/licenses/bsd-license.php</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
- <scm>
- <url>git@github.com:jsuereth/scala-arm.git</url>
- <connection>scm:git:git@github.com:jsuereth/scala-arm.git</connection>
- </scm>
- <developers>
- <developer>
- <id>jsuereth</id>
- <name>Josh Suereth</name>
- <url>http://jsuereth.com</url>
- </developer>
- </developers>)
-
+{% highlight xml %}
+pomExtra := (
+ <url>http://jsuereth.com/scala-arm</url>
+ <licenses>
+ <license>
+ <name>BSD-style</name>
+ <url>http://www.opensource.org/licenses/bsd-license.php</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <scm>
+ <url>git@github.com:jsuereth/scala-arm.git</url>
+ <connection>scm:git:git@github.com:jsuereth/scala-arm.git</connection>
+ </scm>
+ <developers>
+ <developer>
+ <id>jsuereth</id>
+ <name>Josh Suereth</name>
+ <url>http://jsuereth.com</url>
+ </developer>
+ </developers>)
+{% endhighlight %}
Specifically, the `url`, `license`, `scm.url`, `scm.connection` and `developer` sections are required. The above is an example from the [scala-arm](http://jsuereth.com/scala-arm) project.
@@ -70,7 +79,9 @@ Specifically, the `url`, `license`, `scm.url`, `scm.connection` and `developer`
The credentails for your Sonatype OSSRH account need to be added somewhere. Common convention is a `~/.sbt/sonatype.sbt` file with the following:
- credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", "<your username>", "<your password>")
+{% highlight scala %}
+credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", "<your username>", "<your password>")
+{% endhighlight %}
*Note: The first two strings **must** be `"Sonatype Nexus Repository Manager"` and `"oss.sonatype.org"` for Ivy to use the credentials.*

0 comments on commit 1f499af

Please sign in to comment.