Skip to content

Commit

Permalink
Merge pull request #65 from 47deg/integrates-sbt-catalysts-ext
Browse files Browse the repository at this point in the history
Integrates sbt-catalyst-ext Plugin
  • Loading branch information
juanpedromoreno authored Oct 21, 2016
2 parents 013ac00 + 40fc9e9 commit 45ac5aa
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 112 deletions.
4 changes: 2 additions & 2 deletions .scalafmt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--style defaultWithAlign
--maxColumn 100
style = defaultWithAlign
maxColumn = 100
70 changes: 22 additions & 48 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import sbt.Keys._
import de.heikoseeberger.sbtheader.license.Apache2_0
import catext.Dependencies._

val dev = Seq(Dev("47 Degrees (twitter: @47deg)", "47 Degrees"))
val gh = GitHubSettings("com.fortysevendeg", "sbt-microsites", "47 Degrees", apache)
val vAll = Versions(versions, libraries, scalacPlugins)

lazy val artifactSettings = Seq(
name := "sbt-microsites",
organization := "com.fortysevendeg",
organizationName := "47 Degrees",
name := gh.proj,
organization := gh.org,
organizationName := gh.publishOrg,
homepage := Option(url("http://www.47deg.com")),
organizationHomepage := Some(new URL("http://47deg.com")),
headers := Map(
Expand All @@ -20,13 +25,11 @@ lazy val pluginSettings = Seq(
"jgit-repo" at "http://download.eclipse.org/jgit/maven"
),
libraryDependencies ++= Seq(
"com.lihaoyi" %% "scalatags" % "0.6.0",
"org.scalactic" %% "scalactic" % "3.0.0",
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.2" % "test"
"com.lihaoyi" %% "scalatags" % "0.6.0",
"org.scalactic" %% "scalactic" % "3.0.0"
),
scalafmtConfig in ThisBuild := Some(file(".scalafmt"))
) ++ reformatOnCompileSettings
) ++ reformatOnCompileSettings ++ addTestLibs(vAll, "scalatest", "scalacheck")

lazy val micrositeSettings = Seq(
micrositeName := "sbt-microsites",
Expand All @@ -38,57 +41,28 @@ lazy val micrositeSettings = Seq(
includeFilter in makeSite := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.md"
)

lazy val testSettings =
ScriptedPlugin.scriptedSettings ++ Seq(
scriptedDependencies <<= (compile in Test) map { (analysis) =>
Unit
},
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq(
"-Xmx2048M",
"-XX:MaxPermSize=512M",
"-XX:ReservedCodeCacheSize=256m",
"-XX:+UseConcMarkSweepGC",
"-Dplugin.version=" + version.value,
"-Dscala.version=" + scalaVersion.value
)
}
)

lazy val noPublishSettings = Seq(
publish := (),
publishLocal := (),
publishArtifact := false
)

lazy val buildInfoSettings = Seq(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "microsites"
)

lazy val miscSettings = Seq(
shellPrompt := { s: State =>
val c = scala.Console
val blue = c.RESET + c.BLUE + c.BOLD
val white = c.RESET + c.BOLD

val projectName = Project.extract(s).currentProject.id

s"$blue$projectName$white>${c.RESET}"
}
)

lazy val commonSettings = artifactSettings ++ miscSettings
lazy val allSettings = pluginSettings ++ commonSettings ++ tutSettings ++ testSettings
lazy val allSettings = pluginSettings ++
commonSettings ++
tutSettings ++
testScriptedSettings ++
sharedReleaseProcess ++
pgpSettings ++
credentialSettings ++
sharedPublishSettings(gh, dev)

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.4"))
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0"))
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4"))
.settings(addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.4"))
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.0.0"))
.settings(addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4"))
.enablePlugins(JekyllPlugin, AutomateHeaderPlugin)

lazy val docs = (project in file("docs"))
Expand Down
10 changes: 2 additions & 8 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.4")
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")
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4")
addSbtPlugin("com.fortysevendeg" % "sbt-catalysts-ext" % "0.0.2")
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.4.7")
libraryDependencies <+= sbtVersion("org.scala-sbt" % "scripted-plugin" % _)
// Plugin inception dependency to be able to generate the sbt-microsites' microsite
addSbtPlugin("com.fortysevendeg" % "sbt-microsites" % "0.2.5")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")
46 changes: 0 additions & 46 deletions publish.sbt

This file was deleted.

22 changes: 14 additions & 8 deletions src/main/scala/microsites/layouts/DocsLayout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,23 @@ class DocsLayout(config: MicrositeSettings) extends Layout(config) {
div(cls := "brand-wrapper", style := "background:url('{{site.baseurl}}/img/sidebar_brand.png') no-repeat", span(config.name))
)
),
"{% if site.data.menu.options %}",
"{% assign items = site.data.menu.options %} {% for x in items %} ",
li(
a(href := s"$baseUrl{{x.url}}", cls := "{% if x.title == page.title %} active {% endif %}", "{{x.title}}"),
"{% if x.nested_options %} ",
ul(cls := "sub_section",
"{% for sub in x.nested_options %} ",
li(a(href := s"$baseUrl{{sub.url}}", cls := "{% if sub.title == page.title and x.section == page.section %} active {% endif %}", "{{sub.title}}")),
"{% endfor %}"
),
"{% endif %} {% endfor %}"
))
"{% if x.nested_options %} ",
ul(cls := "sub_section",
"{% for sub in x.nested_options %} ",
li(a(href := s"$baseUrl{{sub.url}}", cls := "{% if sub.title == page.title and x.section == page.section %} active {% endif %}", "{{sub.title}}")),
"{% endfor %}"
),
"{% endif %} {% endfor %}",
"{% else %}",
"{% assign items = site.pages | sort: 'weight' %} {% for x in items %} {% if x.section == page.section %}",
li(a(href := "{{ site.baseurl }}{{x.url}}", cls := "{% if x.title == page.title %} active {% endif %}", "{{x.title}}")),
"{% endif %} {% endfor %}",
"{% endif %}"
))
}

def scriptsDocs: List[TypedTag[String]] = scripts ++
Expand Down

0 comments on commit 45ac5aa

Please sign in to comment.