You could achieve this by using the play test:console
command at the root of your app. First you could probably move the code into a main method rather than extending App
:
class InsertJogosCSV {
def main(args: Array[String]) {
val dao = new DAO()
val application = FakeApplication()
def insertJogos(csv: CSV)(implicit s: Session) = {....}
....
}
}
then run the play test:console
command and do the following
scala> import scripts.InsertJogosCSV
import scripts.InsertJogosCSV
scala> val insert = new InsertJogosCSV()
insert: scripts.InsertJogosCSV = scripts.InsertJogosCSV@7d5f9d2b
scala> insert.main
res0: .....
The play test:console
by default adds everything from the app folder to your class path as well as the FakeApplication
context that you need for your script. Hope that helps.
Similar question: https://stackoverflow.com/a/11297578/2556428