Skip to content

Commit

Permalink
Merge pull request #14 from 47deg/sbt-microsite-publish-settings
Browse files Browse the repository at this point in the history
JP - Adds publish settings and more
  • Loading branch information
juanpedromoreno authored Sep 12, 2016
2 parents 9869134 + 83e1f87 commit 91711bf
Show file tree
Hide file tree
Showing 18 changed files with 654 additions and 381 deletions.
2 changes: 2 additions & 0 deletions .scalafmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--style defaultWithAlign
--maxColumn 100
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2016 47 Degrees, LLC. <http://www.47deg.com>

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.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ micrositeImgDirectory := (resourceDirectory in Compile).value / "site" / "images
micrositeImgDirectory := (resourceDirectory in Compile).value / "site" / "styles"
```

- `micrositeExtratMdFiles` setting could be handy if you want to include additional markdown files in your site, and these files are not located in the same place of your `tut` directory. By default, the setting is set up as a empty list. You could override it, in this way:
- `micrositeExtratMdFiles` setting could be handy if you want to include additional markdown files in your site, and these files are not located in the same place of your `tut` directory. By default, the setting is set up as a empty map. You could override it, in this way:
```
micrositeExtratMdFiles := Seq(file("CONTRIBUTING.md"))
micrositeExtratMdFiles := Map(file("README.md") -> "index.md", file("CONTRIBUTING.md") -> "contributing.md")
```

- Style uses essentially 8 colors which palette can be set through the setting `micrositePalette` as below:
Expand Down
38 changes: 28 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
organization := "com.fortysevendeg"
name := "sbt-microsites"
version := "1.0.1-SNAPSHOT"
sbtPlugin := true
import sbt.Keys._
import de.heikoseeberger.sbtheader.license.Apache2_0

lazy val main = (project in file("."))
lazy val artifactSettings = Seq(
name := "sbt-microsites",
organization := "com.fortysevendeg",
organizationName := "47 Degrees",
organizationHomepage := Some(new URL("http://47deg.com")),
headers := Map(
"scala" -> Apache2_0("2016", "47 Degrees, LLC. <http://www.47deg.com>")
)
)

lazy val commonSettings = Seq(
sbtPlugin := true,
scalaVersion in ThisBuild := "2.10.6",
resolvers += Resolver.sonatypeRepo("releases"),
libraryDependencies += "com.lihaoyi" %% "scalatags" % "0.6.0",
scalafmtConfig in ThisBuild := Some(file(".scalafmt"))
) ++ reformatOnCompileSettings

lazy val allSettings = commonSettings ++ artifactSettings ++ tutSettings

lazy val `sbt-microsites` = (project in file("."))
.settings(moduleName := "sbt-microsites")
.settings(allSettings: _*)
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3"))
.settings(addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.3"))
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0"))
.settings(tutSettings :_*)
.settings(libraryDependencies += "com.lihaoyi" %% "scalatags" % "0.6.0")
.enablePlugins(JavaServerAppPackaging, UniversalPlugin, JekyllPlugin)
.settings(addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.3"))
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0"))
.enablePlugins(JavaServerAppPackaging, UniversalPlugin, JekyllPlugin, AutomateHeaderPlugin)
7 changes: 5 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.6.0")
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.3.1")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
46 changes: 46 additions & 0 deletions publish.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
lazy val gpgFolder = sys.env.getOrElse("GPG_FOLDER", ".")
lazy val publishSnapshot = taskKey[Unit]("Publish only if the version is a SNAPSHOT")

pgpPassphrase := Some(sys.env.getOrElse("GPG_PASSPHRASE", "").toCharArray)
pgpPublicRing := file(s"$gpgFolder/pubring.gpg")
pgpSecretRing := file(s"$gpgFolder/secring.gpg")

credentials += Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
sys.env.getOrElse("PUBLISH_USERNAME", ""),
sys.env.getOrElse("PUBLISH_PASSWORD", "")
)

scmInfo := Some(
ScmInfo(url("https://github.com/47deg/sbt-microsites"),
"https://github.com/47deg/sbt-microsites.git"))
licenses := Seq(
"Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := Function.const(false)

publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("Snapshots" at nexus + "content/repositories/snapshots")
else
Some("Releases" at nexus + "service/local/staging/deploy/maven2")
}
publishSnapshot := Def.taskDyn {
if (isSnapshot.value) Def.task {
PgpKeys.publishSigned.value
} else Def.task(println("Actual version is not a Snapshot. Skipping publish."))
}.value

pomExtra :=
<developers>
<developer>
<name>47 Degrees (twitter: @47deg)</name>
<email>hello@47deg.com</email>
</developer>
<developer>
<name>47 Degrees</name>
</developer>
</developers>
53 changes: 37 additions & 16 deletions src/main/scala/microsites/MicrositeKeys.scala
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
/*
* Copyright 2016 47 Degrees, LLC. <http://www.47deg.com>
*
* 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.
*/

package microsites

import sbt._

trait MicrositeKeys {
val makeMicrosite = taskKey[Unit]("Main Task to build a Microsite")
val microsite = taskKey[Seq[File]]("Create microsite files")
val micrositeConfig = taskKey[Unit]("Copy microsite config to the site folder")
val micrositeName = settingKey[String]("Microsite name")
val micrositeDescription = settingKey[String]("Microsite description")
val micrositeAuthor = settingKey[String]("Microsite author")
val micrositeHomepage = settingKey[String]("Microsite homepage")
val micrositeTwitter = settingKey[String]("Microsite twitter")
val micrositeBaseUrl = settingKey[String]("Microsite site base url")
val makeMicrosite = taskKey[Unit]("Main Task to build a Microsite")
val microsite = taskKey[Seq[File]]("Create microsite files")
val micrositeConfig = taskKey[Unit]("Copy microsite config to the site folder")
val micrositeName = settingKey[String]("Microsite name")
val micrositeDescription = settingKey[String]("Microsite description")
val micrositeAuthor = settingKey[String]("Microsite author")
val micrositeHomepage = settingKey[String]("Microsite homepage")
val micrositeTwitter = settingKey[String]("Microsite twitter")
val micrositeBaseUrl = settingKey[String]("Microsite site base url")
val micrositeDocumentationUrl = settingKey[String]("Microsite site documentation url")
val micrositeHighlightTheme = settingKey[String]("Microsite Highlight Theme")
val micrositeImgDirectory = settingKey[File]("Optional. Microsite images directory. By default, it'll be the resourcesDirectory + '/microsite/img'")
val micrositeCssDirectory = settingKey[File]("Optional. Microsite CSS directory. By default, it'll be the resourcesDirectory + '/microsite/css'")
val micrositeExtratMdFiles = settingKey[Seq[File]]("Optional. Additional document files located in a different place from the tutSourceDirectory. By default, it's empty")
val micrositePalette = settingKey[Map[String, String]]("Microsite palette")
val micrositeHighlightTheme = settingKey[String]("Microsite Highlight Theme")
val micrositeImgDirectory = settingKey[File](
"Optional. Microsite images directory. By default, it'll be the resourcesDirectory + '/microsite/img'")
val micrositeCssDirectory = settingKey[File](
"Optional. Microsite CSS directory. By default, it'll be the resourcesDirectory + '/microsite/css'")
val micrositeExtratMdFiles = settingKey[Map[File, String]](
"Optional. The key is related with the source file, the map value corresponds with the target relative file path. " +
"This keys is useful for those document files that are located in a different places from the tutSourceDirectory. " +
"By default, it's empty")
val micrositePalette = settingKey[Map[String, String]]("Microsite palette")
val micrositeGithubOwner = settingKey[String]("Microsite Github owner")
val micrositeGithubRepo = settingKey[String]("Microsite Github repo")
val micrositeGithubRepo = settingKey[String]("Microsite Github repo")
}
object MicrositeKeys extends MicrositeKeys
object MicrositeKeys extends MicrositeKeys
19 changes: 0 additions & 19 deletions src/main/scala/microsites/MicrositeSettings.scala

This file was deleted.

Loading

0 comments on commit 91711bf

Please sign in to comment.