Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redo cross-referencing #362

Merged
merged 2 commits into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target/
/test/applet/NetLogo.jar
/test/applet/NetLogoLite.jar
/test/benchmarks/firebig*.csv
/index.txt
/index.conf
/Alternative Visualizations/Ethnocentrism - Alternative Visualization.png
/Alternative Visualizations/Flocking - Alternative Visualizations.png
/Alternative Visualizations/Heat Diffusion - Alternative Visualization.png
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ libraryDependencies ++= Seq(
"com.github.wookietreiber" %% "scala-chart" % "0.5.1",
"com.googlecode.java-diff-utils" % "diffutils" % "1.2" % "test",
"org.jfree" % "jfreesvg" % "3.0",
"com.typesafe" % "config" % "1.3.1" % "test",
"com.vladsch.flexmark" % "flexmark" % "0.20.0" % "test",
"com.vladsch.flexmark" % "flexmark-ext-autolink" % "0.20.0" % "test",
"com.vladsch.flexmark" % "flexmark-util" % "0.20.0" % "test"
Expand Down
55 changes: 55 additions & 0 deletions crossReference.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
org.nlogo.models.crossReference.singleModels: [
{ source: "Sample Models/Biology/AIDS.nlogo", referenceIn: "Sample Models/Social Science" }
{ source: "Sample Models/Biology/Simple Birth Rates.nlogo", referenceIn: "Sample Models/Social Science" }

{ source: "Sample Models/Biology/Evolution/Altruism.nlogo", referenceIn: "Sample Models/Social Science" }
{ source: "Sample Models/Biology/Evolution/Cooperation.nlogo", referenceIn: "Sample Models/Social Science" }

{ source: "Sample Models/Biology/Evolution/Unverified/Divide The Cake.nlogo",
referenceIn: "Sample Models/Social Science/Unverified" }

{ source: "Sample Models/Biology/Evolution/Altruism.nlogo", referenceIn: "Curricular Models/EACH" }
{ source: "Sample Models/Biology/Evolution/Cooperation.nlogo", referenceIn: "Curricular Models/EACH" }

{ source: "Sample Models/Biology/Evolution/Unverified/Divide The Cake.nlogo",
referenceIn: "Curricular Models/EACH/Unverified" }

{ source: "Sample Models/Networks/Team Assembly.nlogo", referenceIn: "Sample Models/Social Science" }

{ source: "Code Examples/Extensions Examples/vid/Video Camera Example.nlogo", referenceIn: "Code Examples/Extension Examples/bitmap" }

// BEAGLE curricular models
{ source: "Sample Models/Biology/Wolf Sheep Predation.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Evolution/Genetic Drift/GenDrift T interact.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Evolution/Bug Hunt Speeds.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Evolution/Bug Hunt Camouflage.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "HubNet Activities/Unverified/Guppy Spots HubNet.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Daisyworld.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Evolution/Mimicry.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Evolution/Altruism.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "Sample Models/Biology/Evolution/Cooperation.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution" }
{ source: "HubNet Activities/Bug Hunters Camouflage HubNet.nlogo", referenceIn: "Curricular Models/BEAGLE Evolution/HubNet Activities" }

// copy BEAGLE HubNet models to hubnet activities
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Bird Breeders HubNet.nlogo", referenceIn: "HubNet Activities" }
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Bug Hunters Competition HubNet.nlogo", referenceIn: "HubNet Activities" }
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Critter Designers HubNet.nlogo", referenceIn: "HubNet Activities" }
{ source: "Curricular Models/BEAGLE Evolution/HubNet Activities/Fish Spotters HubNet.nlogo", referenceIn: "HubNet Activities" }

// Oil Cartel HubNet to HubNet Activities
{ source: "Sample Models/Social Science/Oil Cartel HubNet.nlogo", referenceIn: "HubNet Activities" }

// IABM Textbook models duplicated in Sample Models and Code Examples
{ source: "IABM Textbook/chapter 3/El Farol Extensions/El Farol.nlogo", referenceIn: "Sample Models/Social Science" }
{ source: "IABM Textbook/chapter 3/DLA extensions/DLA Simple.nlogo", referenceIn: "Sample Models/Chemistry & Physics/Diffusion Limited Aggregation" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is producing an error. Should it be (capitalize "extensions"):

{ source: "IABM Textbook/chapter 3/DLA Extensions/DLA Simple.nlogo", referenceIn: "Sample Models/Chemistry & Physics/Diffusion Limited Aggregation" }

I assume that means this new method is case-sensitive while the old was not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is case-sensitive. My tests should have caught this :/. I'll push up changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now updated.

{ source: "IABM Textbook/chapter 8/Arduino Example.nlogo", referenceIn: "Code Examples/Extensions Examples/arduino" }
]

org.nlogo.models.crossReference.directories: [
{ sourceDir: "Sample Models/Mathematics/Probability/ProbLab", referenceIn: "Curricular Models/ProbLab", recursive: false }
{ sourceDir: "Sample Models/Mathematics/Probability/ProbLab/Unverified",
referenceIn: "Curricular Models/ProbLab", recursive: false }

{ sourceDir: "Sample Models/Chemistry & Physics/GasLab", referenceIn: "Curricular Models/GasLab", recursive: true }
{ sourceDir: "Sample Models/Chemistry & Physics/MaterialSim", referenceIn: "Curricular Models/MaterialSim", recursive: true }
]
31 changes: 31 additions & 0 deletions src/test/scala/org/nlogo/models/CrossReferenceTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.nlogo.models

import java.io.File
import java.nio.file.{ Files, Paths }

import com.typesafe.config.{ Config, ConfigFactory }

import org.scalatest.FunSuite

import scala.collection.JavaConverters._

class CrossReferenceTests extends FunSuite {

val crossReference = ConfigFactory.parseFile(new File("crossReference.conf"))

test("all cross-referenced single models exist") {
val modelRefs = crossReference.getConfigList("org.nlogo.models.crossReference.singleModels").asScala
modelRefs.foreach { ref =>
val source = ref.getString("source")
assert(Files.isRegularFile(Paths.get(source)), s"expected to find a nlogo file at $source, but couldn't find it!")
}
}

test("all cross-referenced directories exist and are directories") {
val directoryRefs = crossReference.getConfigList("org.nlogo.models.crossReference.directories").asScala
directoryRefs.foreach { ref =>
val source = ref.getString("sourceDir")
assert(Files.isDirectory(Paths.get(source)), s"expected find a directory at $source, but couldn't find it!")
}
}
}