diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..01385ec --- /dev/null +++ b/build.sbt @@ -0,0 +1,8 @@ +name := "data_report" + +version := "0.1" + +scalaVersion := "2.12.4" + +libraryDependencies += + "org.scala-lang.modules" %% "scala-xml" % "1.0.6" diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000..5517665 --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version = 1.1.1 \ No newline at end of file diff --git a/src/main/scala/uk/org/floop/ons/data_report/CreateReport.scala b/src/main/scala/uk/org/floop/ons/data_report/CreateReport.scala new file mode 100644 index 0000000..420d7d6 --- /dev/null +++ b/src/main/scala/uk/org/floop/ons/data_report/CreateReport.scala @@ -0,0 +1,37 @@ +package uk.org.floop.ons.data_report + +import java.io.{File, PrintWriter} + +import scala.io.Source +import scala.xml.PrettyPrinter + +object CreateReport extends App { + + val dataDir = new File("in") + val table = { + for { + d <- dataDir.listFiles + if d.isDirectory + f <- d.listFiles + if f.isFile + } yield { + val lines = Source.fromFile(f).getLines.size + + + + + + } + }
+ {d.getName} + + {f.getName} + + {lines} +
+ val pp = new PrettyPrinter(80, 2) + val pw = new PrintWriter(new File("report.xml")) + pw.write(pp.format(
{table}
)) + pw.close + +}