Skip to content

Commit

Permalink
Merge pull request #35 from 47deg/jp-removes-sbt-native-packager
Browse files Browse the repository at this point in the history
sbt-native-packager is not being used for now
  • Loading branch information
juanpedromoreno authored Sep 26, 2016
2 parents 6f3517a + 8fa2211 commit 4562c57
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ 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.

Regarding the use of a piece of code from the sbt-native-packager plugin by Joshua Suereth:

Copyright (c) 2012, Joshua Suereth All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ lazy val `sbt-microsites` = (project in file("."))
.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(JavaServerAppPackaging, UniversalPlugin, JekyllPlugin, AutomateHeaderPlugin)
.enablePlugins(JekyllPlugin, AutomateHeaderPlugin)

lazy val docs = (project in file("docs"))
.settings(commonSettings: _*)
Expand Down
11 changes: 5 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")
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")
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")
libraryDependencies <+= sbtVersion("org.scala-sbt" % "scripted-plugin" % _)
Expand Down
11 changes: 3 additions & 8 deletions src/main/scala/microsites/MicrositesPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ package microsites
import com.typesafe.sbt.SbtGhPages.GhPagesKeys._
import com.typesafe.sbt.SbtGhPages.ghpages
import com.typesafe.sbt.SbtGit.git
import com.typesafe.sbt.SbtNativePackager
import com.typesafe.sbt.SbtNativePackager.Universal
import com.typesafe.sbt.packager.MappingsHelper._
import com.typesafe.sbt.packager.NativePackagerKeys
import com.typesafe.sbt.packager.universal.UniversalPlugin
import com.typesafe.sbt.site.SitePlugin.autoImport._
import com.typesafe.sbt.site.jekyll.JekyllPlugin
import microsites.domain.MicrositeSettings
Expand All @@ -33,14 +28,14 @@ import sbt._
import sbt.plugins.IvyPlugin
import tut.Plugin._

object MicrositesPlugin extends AutoPlugin with NativePackagerKeys {
object MicrositesPlugin extends AutoPlugin {

object autoImport extends MicrositeKeys

import MicrositesPlugin.autoImport._
import com.typesafe.sbt.site.jekyll.JekyllPlugin.autoImport._

override def requires = IvyPlugin && SbtNativePackager && JekyllPlugin && UniversalPlugin
override def requires = IvyPlugin && JekyllPlugin

override def trigger = allRequirements

Expand All @@ -51,7 +46,7 @@ object MicrositesPlugin extends AutoPlugin with NativePackagerKeys {
ghpages.settings ++
Seq(
git.remoteRepo := s"git@github.com:${micrositeGithubOwner.value}/${micrositeGithubRepo.value}.git",
mappings in Universal ++= directory("src/main/resources/microsite"),
mappings in Jekyll ++= micrositeHelper.value.directory("src/main/resources/microsite"),
sourceDirectory in Jekyll := resourceManaged.value / "main" / "jekyll",
tutSourceDirectory := sourceDirectory.value / "main" / "tut",
tutTargetDirectory := resourceManaged.value / "main" / "jekyll"
Expand Down
15 changes: 15 additions & 0 deletions src/main/scala/microsites/util/MicrositeHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package microsites.util

import java.io.File

import microsites.domain.MicrositeSettings
import microsites.layouts._
import microsites.util.FileHelper._
Expand Down Expand Up @@ -111,4 +113,17 @@ class MicrositeHelper(config: MicrositeSettings) {

copyFilesRecursively(s"${sourceDir.getAbsolutePath}/_config.yml", targetFile.getAbsolutePath)
}

/*
* This method has been extracted from the sbt-native-packager plugin:
*
* https://github.com/sbt/sbt-native-packager/blob/b5e2bb9027d08c00420476e6be0d876cf350963a/src/main/scala/com/typesafe/sbt/packager/MappingsHelper.scala#L21
*
*/
def directory(sourceDirPath: String): Seq[(File, String)] = {
val sourceDir = file(sourceDirPath)
Option(sourceDir.getParentFile)
.map(parent => sourceDir.*** pair relativeTo(parent))
.getOrElse(sourceDir.*** pair basic)
}
}

0 comments on commit 4562c57

Please sign in to comment.