如何将 Ruby 与 Mercurial (Python) 连接?
我希望将 Mercurial 集成到我的 Rails 站点中。我想运行基本命令,例如状态、摘要、日志,甚至克隆。我想直接与 Mercurial 库交互,并避免通过正则表达式进行任何命令行解析。
Mercurial 是用 Python 编写的;我正在使用红宝石。所以,我需要 Mercurial Ruby 绑定。然而,似乎没有。因此,B 计划是采用类似 Ruby/Python(在 Ruby 中嵌入 Python 解释器的扩展库)或 rubypython (Ruby 和 Python 之间的 C 桥梁,具有 Ruby 接口)。
你们都明白为什么这些图书馆之一不能为我提供我想要的东西吗?
有人有其他想法吗?
I'm hoping to integrate Mercurial into my Rails site. I want to run basic commands like status, summary, log, and maybe even clone. I'd like to interface directly with the Mercurial libraries and avoid doing any command line parsing via regex.
Mercurial is written in Python; I am using Ruby. So, I need Mercurial Ruby bindings. It seems, however, that there are none. So, plan B would be to go with something like Ruby/Python (an extension library to embed the Python interpreter in Ruby) or rubypython (a C bridge between Ruby and Python with a Ruby interface).
Do you all see any reason why one of these libraries won't provide me what I am wanting?
Does anyone have any alternative ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会查看 redmine 代码,并执行他们所做的任何操作。
I would look at the redmine code, and do whatever they do.
你是对的。但是,还有比 Ruby 绑定到 Python Mercurial 实现更好的东西:一个Ruby(加上一点点C)Mercurial 实现!
You are right. But there is something even better than a Ruby binding to the Python Mercurial implementation: a Ruby (plus little bits of C) Mercurial implementation!
查看 Beanstalk 团队发布的 Mercurial-Ruby gem。
https://github.com/iSabanin/mercurial-ruby
Check out the Mercurial-Ruby gem, released by the team at Beanstalk.
https://github.com/iSabanin/mercurial-ruby