Last active
August 29, 2015 13:57
-
-
Save motemen/9519772 to your computer and use it in GitHub Desktop.
`rails runner` in Play framework http://motemen.hatenablog.com/entry/2014/03/13/Play_Framework_%E3%81%A7_%60rails_runner%60_%E7%9A%84%E3%81%AA%E3%81%93%E3%81%A8%E3%82%92%E5%AE%9F%E7%8F%BE%E3%81%99%E3%82%8B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… | |
lazy val root = project in file(".") | |
lazy val tasks = project in file("tasks") dependsOn(root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tasks/cliTask.scala | |
// run as: sbt 'tasks/runMain cliTask {args}' | |
import play.api.Play | |
import play.api.Play.current | |
object cliTask extends play.core.StaticApplication(new java.io.File(".")) { | |
def main(args: Array[String]) { | |
try { | |
… | |
} finally { | |
Play.stop() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment