jruby 的 Sbt 插件
是否有一个 sbt 插件可以自动安装 JRuby 并添加一些钩子以在某些点(例如在编译之前)自动运行脚本。
背景:对于(提升)项目,我想使用 sass,或更具体地说,compass 作为生成 css 的工具。不幸的是,sass 的 Java 或 Scala 克隆还不够。
当然,手动生成 css 然后将它们放入存储库中根本不会有问题,而且没人需要关心它。
另一方面,为了简化多个系统上的开发,我宁愿在 sbt 内部有一个明确的依赖关系,它可以简单地完成工作。
有什么办法可以实现这一点吗?
或者一般来说:有没有办法从 Scala 内部运行 JRuby 脚本?
编辑 将 maven-2 添加到标签中。也许有一个 JRuby 的 Maven 存储库,它允许我以某种方式交付和使用它。
Is there a plugin for sbt available which automatically installs JRuby and adds some hooks to automatically run scripts at certain points (e.g. before compilation).
Background: For a (lift) project, I want to use sass, or more specifically, compass as a tool for generating the css. A Java or Scala clone of sass would not be enough, unfortunately.
Of course, It wouldn’t be a problem at all to just generate the css manually and then put both inside the repository and no-one ever needs to care about it.
On the other hand, to ease development on several systems, I’d rather have a clear dependency inside sbt which simply does the work.
Is there any way to achieve this?
Or generally: Is there a way to run JRuby scripts from inside Scala?
Edit Added maven-2 to the tags. Maybe there is a maven repo for JRuby which allows me to deliver and use it somehow.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然它可能不是最优雅的解决方案,但您始终可以使用 SBT 中的进程支持来调用外部脚本。
这里提供了有关外部流程支持的更多信息:http:// code.google.com/p/simple-build-tool/wiki/Process
While it's perhaps not the most elegant solution, you can always call external scripts using the Process support in SBT.
There's a bit more info about the external process support available here: http://code.google.com/p/simple-build-tool/wiki/Process
尝试我来自 github 的 sbt 插件。目前它还很简单,但它应该下载 jruby jar 并允许您在编译之前调用 .rb 文件。
该插件的内部结构非常简单:
实际上,它所做的就是使用您传入的 rb 文件的名称调用 jruby jar 文件。当然,将 jruby 本身添加为托管依赖项:
它还添加了一个“jirb”将命令发送到 Scala 控制台,使您进入 jiirb 会话。
Try my sbt plugin from github. It's very bare-bones for now, but it should download the jruby jar and allow you to call a .rb file before compiling.
The guts of the plugin are really simple:
Really all it's doing is calling the jruby jar file with the name of the rb file you've passed in. And of course adding jruby itself as a managed dependency:
It also adds a "jirb" command to the Scala console that puts you into a jirb session.