Skip to content
This repository was archived by the owner on Apr 11, 2022. It is now read-only.

Commit c37b2d5

Browse files
authored
Merge pull request #23 from mkurz/updates
Update webjars-locator-core
2 parents c148c85 + 5c66de7 commit c37b2d5

File tree

8 files changed

+18
-20
lines changed

8 files changed

+18
-20
lines changed

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
dist: trusty
22

3-
jdk: oraclejdk8
43
language: scala
54

5+
env:
6+
- TRAVIS_JDK=8
7+
8+
before_install: curl -Ls https://git.io/jabba | bash && . ~/.jabba/jabba.sh
69
install:
10+
- jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version
711
- nvm install 7.9.0
812

913
script: sbt +test

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ Some sample usage from Scala:
1414
```scala
1515
val engine = system.actorOf(Node.props(), "engine")
1616
val to = new File(new File("target"), "webjars")
17-
val cacheFile = new File(to, "extraction-cache")
1817

19-
val npm = new Npm(engine, NpmLoader.load(to, cacheFile, Main.getClass.getClassLoader))
18+
val npm = new Npm(engine, NpmLoader.load(to, Main.getClass.getClassLoader))
2019

2120
for (
2221
result <- npm.update() // Perform an "npm update"

build.sbt

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ organization := "com.typesafe"
22
name := "npm"
33

44
scalaVersion := "2.10.7"
5-
crossScalaVersions := Seq(scalaVersion.value, "2.11.12", "2.12.7")
5+
crossScalaVersions := Seq(scalaVersion.value, "2.11.12", "2.12.10")
66

77
libraryDependencies ++= {
88
val akkaVersion = scalaBinaryVersion.value match {
99
case "2.10" => "2.3.16"
10-
case "2.11" => "2.3.16"
11-
case "2.12" => "2.5.18"
10+
case "2.11" => "2.5.26"
11+
case "2.12" => "2.6.0"
1212
}
1313
Seq(
1414
"com.typesafe" %% "jse" % "1.2.4",
1515
"org.webjars" % "npm" % "5.0.0-2",
1616
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
17-
"org.webjars" % "webjars-locator-core" % "0.36",
17+
"org.webjars" % "webjars-locator-core" % "0.43",
1818
"commons-io" % "commons-io" % "2.6" % "test",
1919
"org.specs2" %% "specs2-core" % "3.10.0" % "test",
2020
"junit" % "junit" % "4.12" % "test"

npm-tester/src/main/scala/com/typesafe/npm/tester/Main.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ object Main {
2121

2222
val engine = system.actorOf(Node.props(), "engine")
2323
val to = new File(new File("target"), "webjars")
24-
val cacheFile = new File(to, "extraction-cache")
25-
val npm = new Npm(engine, NpmLoader.load(to, cacheFile, Main.getClass.getClassLoader))
24+
val npm = new Npm(engine, NpmLoader.load(to, Main.getClass.getClassLoader))
2625
for (
2726
result <- npm.update()
2827
) yield {

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.17
1+
sbt.version=0.13.18

src/main/scala/com/typesafe/npm/Npm.scala

+2-6
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,18 @@ class Npm(engine: ActorRef, npmFile: File, verbose: Boolean = false) {
4040
}
4141

4242

43-
import org.webjars.FileSystemCache
4443
import org.webjars.WebJarExtractor
4544

4645
object NpmLoader {
4746
/**
4847
* Extract the NPM WebJar to disk and return its main entry point.
4948
* @param to The directory to extract to.
50-
* @param cacheFile The file to use as a cache of extractions (we don't extract unless we need to).
5149
* @param classLoader The classloader that should be used to locate the Node related WebJars.
5250
* @return The main JavaScript entry point into NPM.
5351
*/
54-
def load(to: File, cacheFile: File, classLoader: ClassLoader): File = {
55-
val cache = new FileSystemCache(cacheFile)
56-
val extractor = new WebJarExtractor(cache, classLoader)
52+
def load(to: File, classLoader: ClassLoader): File = {
53+
val extractor = new WebJarExtractor(classLoader)
5754
extractor.extractAllNodeModulesTo(to)
58-
cache.save()
5955
new File(to, "npm" + File.separator + "lib" + File.separator + "npm.js")
6056
}
6157
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package com.typesafe.npm
22

33
import akka.actor.ActorSystem
4+
import scala.concurrent.Await
5+
import scala.concurrent.duration._
46

57
object AkkaCompat {
68
def terminate(system: ActorSystem): Unit = {
7-
system.shutdown()
8-
system.awaitTermination()
9+
Await.ready(system.terminate(), 10.seconds)
910
}
1011
}

src/test/scala/com/typesafe/npm/NpmSpec.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class NpmSpec extends Specification {
3131
FileUtils.deleteDirectory(new File("node_modules"));
3232

3333
val to = new File(new File("target"), "webjars")
34-
val cacheFile = new File(to, "extraction-cache")
35-
val npm = new Npm(engine, NpmLoader.load(to, cacheFile, this.getClass.getClassLoader), verbose = true)
34+
val npm = new Npm(engine, NpmLoader.load(to, this.getClass.getClassLoader), verbose = true)
3635
val pendingResult = npm.update()
3736

3837
val result = Await.result(pendingResult, timeout.duration)

0 commit comments

Comments
 (0)