bitcoin-atm

bitcoin atm for pyc inc.

git clone https://9o.is/git/bitcoin-atm.git

BuildSettings.scala

(4817B)


      1 import sbt._
      2 import sbt.Keys._
      3 
      4 import com.earldouglas.xsbtwebplugin.WebPlugin.{container, webSettings}
      5 import com.earldouglas.xsbtwebplugin.PluginKeys._
      6 import sbtbuildinfo.Plugin._
      7 import com.typesafe.sbteclipse.plugin.EclipsePlugin.EclipseKeys
      8 import ohnosequences.sbt.SbtS3Resolver._
      9 
     10 object BuildSettings {
     11   object Ver {
     12     val lift = "3.0-M1"
     13     val lift_edition = "3.0"
     14     val jetty = "9.1.4.v20140401"
     15   }
     16 
     17   // call grunt init - requires npm be installed
     18   val gruntInit = TaskKey[Int]("grunt-init", "Initialize project for grunt")
     19   def gruntInitTask = (baseDirectory in Compile) map { dir =>
     20     Process(Seq("npm", "install"), dir) !
     21   }
     22 
     23   // call grunt default
     24   val gruntDefault = TaskKey[Int]("grunt-default", "Call the grunt default command")
     25   def gruntDefaultTask = (baseDirectory in Compile, streams) map { (dir, s) =>
     26     val code: Int = Process(Seq("grunt", "default"), dir) ! s.log
     27     s.log.info("grunt-init: "+code.toString)
     28     if (code != 0) {
     29       sys.error("grunt-init failed.")
     30     }
     31     code
     32   }
     33 
     34   // call grunt build
     35   val gruntBuild = TaskKey[Int]("grunt-build", "Call the grunt build command")
     36   def gruntBuildTask = (baseDirectory in Compile) map { dir =>
     37     Process(Seq("grunt", "build"), dir) !
     38   }
     39 
     40   // call grunt test
     41   val gruntTest = TaskKey[Int]("grunt-test", "Call the grunt test command")
     42   def gruntTestTask = (baseDirectory in Compile) map { dir =>
     43     Process(Seq("grunt", "test"), dir) !
     44   }
     45 
     46   val buildTime = SettingKey[String]("build-time")
     47 
     48   val basicSettings = Defaults.defaultSettings ++ Seq(
     49     name := "chimera",
     50     version := "0.1-SNAPSHOT",
     51     organization := "inc.pyc",
     52     scalaVersion := "2.10.4",
     53     scalacOptions <<= scalaVersion map { sv: String =>
     54       if (sv.startsWith("2.10."))
     55         Seq("-deprecation", "-unchecked", "-feature", "-language:postfixOps", "-language:implicitConversions")
     56       else
     57         Seq("-deprecation", "-unchecked")
     58     },
     59     resolvers ++= Seq[Resolver](
     60         "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases",
     61         "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
     62         s3resolver.value("PYC Releases", s3("releases-pyc-inc")),
     63         s3resolver.value("PYC Snapshots", s3("snapshots-pyc-inc")),
     64         "clojars.org" at "http://clojars.org/repo"
     65     )
     66   )
     67 
     68   val gruntSettings = Seq(
     69     gruntInit <<= gruntInitTask,
     70     gruntDefault <<= gruntDefaultTask,
     71     gruntBuild <<= gruntBuildTask,
     72     gruntTest <<= gruntTestTask
     73   )
     74 
     75   val liftAppSettings = 
     76     basicSettings ++
     77     gruntSettings ++
     78     webSettings ++
     79     S3Resolver.defaults ++
     80     buildInfoSettings ++
     81     seq(
     82       buildTime := System.currentTimeMillis.toString,
     83 
     84       // build-info
     85       buildInfoKeys ++= Seq[BuildInfoKey](buildTime),
     86       buildInfoPackage := "inc.pyc.chimera",
     87       sourceGenerators in Compile <+= buildInfo,
     88 
     89       // eclipse
     90       EclipseKeys.withSource := true,
     91 
     92       // dependencies
     93       //compile in Compile <<= (compile in Compile) dependsOn gruntBuild,
     94       // (start in container.Configuration) <<= (start in container.Configuration) dependsOn gruntBuild,
     95       Keys.`package` <<= (Keys.`package` in Compile) dependsOn gruntDefault,
     96       Keys.`package` <<= (Keys.`package` in Test) dependsOn gruntDefault,
     97       test in Test <<= (test in Test) dependsOn gruntTest,
     98 
     99       // add javascript and css source files to the webapp, for development
    100       (webappResources in Compile) <+= (target in Compile) { _ / "grunt" / "build" / "css" },
    101 
    102       // add grunt generated resources to the classpath
    103       (unmanagedResourceDirectories in Compile) <+=
    104         (target in Compile) { _ / "grunt" / "resources" },
    105 
    106       // massage the war
    107       (warPostProcess in Compile) <<= (target in Compile) map { tgt =>
    108         val webapp = tgt / "webapp"
    109         val gdist = tgt / "grunt" / "dist"
    110         () => {
    111           // remove the frontend sources
    112           val files = Seq(webapp / "app", webapp / "assets", webapp / "less", webapp / "vendor")
    113           IO.delete(files)
    114           // copy the minified assets
    115           IO.copyDirectory(gdist, webapp)
    116         }
    117       },
    118 
    119       s3credentials := {
    120         Path.userHome / ".ivy2" / ".s3credentials"
    121       },
    122 
    123       licenses := Seq("Apache 2.0 License" -> url("http://www.apache.org/licenses/LICENSE-2.0.html")),
    124       pomExtra := (
    125         <url>https://bitbucket.org/pyd/chimera</url>
    126         <scm>
    127           <url>git@bitbucket.org:pyd/chimera.git</url>
    128           <connection>scm:git:git@bitbucket.org:pyd/chimera.git</connection>
    129         </scm>
    130         <developers>
    131           <developer>
    132             <id>jcabrra</id>
    133             <name>Julio Cabrera</name>
    134           </developer>
    135         </developers>
    136       )
    137     )
    138 
    139   lazy val noPublishing = seq(
    140     publish := (),
    141     publishLocal := ()
    142   )
    143 }
    144