如何将 active_merchant 的 Raymond Law 分支包含在我的项目中?
我正在使用 Rails 3 开发一个基于订阅的网站,我需要使用 PayPal Express Checkout(英国)进行定期付款。我发现 ActiveMerchant 默认情况下不支持它,因此我看到了以下博客文章: http://rayvinly.com/articles/2009/02/20/paypal-recurring-billing-with-activemerchant-in-ruby-on- Rails/
作为 Rails 的新手,并遵循使用 Gemfile 和捆绑安装来安装其他第三方代码的方法,我尝试将其添加到 Gemfile:
gem 'active_merchant', :git => 'https://github.com/rayvinly/active_merchant.git'
然后运行捆绑安装。我收到以下错误:
Updating https://github.com/rayvinly/active_merchant.git
Fetching source index for http://rubygems.org/
Could not find gem 'active_merchant (>= 0)' in https://github.com/rayvinly/active_merchant.git (at master).
Source does not contain any versions of 'active_merchant (>= 0)'
我不确定这是将其纳入我的项目的正确方法。
我真正想做的是安装最新的 ActiveMerchant gem,然后添加 Raymond 创建的额外网关部分。但是,我似乎无法找出需要将文件放在项目中的位置,因为我不确定 ActiveMerchant 在哪里?
任何人都可以为我指明正确的方向吗?这可能是我错过的 Rails 101 事情,但我似乎看不到它。我还在摸索 Rails 的方式!来自使用 PHP 10 年。
预先感谢您的任何帮助。
I'm developing a subscription based website with Rails 3 and I need to use PayPal Express Checkout (UK) for recurring payments. I've found that it's not supported by default in ActiveMerchant and so I came across the folowing blog post: http://rayvinly.com/articles/2009/02/20/paypal-recurring-billing-with-activemerchant-in-ruby-on-rails/
Being very new to Rails and following the method for installing other third party code by using the Gemfile and bundle install, I tried to add this to the Gemfile:
gem 'active_merchant', :git => 'https://github.com/rayvinly/active_merchant.git'
and then ran bundle install. I get the following error:
Updating https://github.com/rayvinly/active_merchant.git
Fetching source index for http://rubygems.org/
Could not find gem 'active_merchant (>= 0)' in https://github.com/rayvinly/active_merchant.git (at master).
Source does not contain any versions of 'active_merchant (>= 0)'
I'm not sure that's the correct way to get this into my project.
What I really want to do is have the latest ActiveMerchant gem installed and then add just the extra Gateway part that Raymond has created. However I can't seem to find out where I'd need to put the file in my project as I'm not sure where ActiveMerchant IS?
Can any one point me in the right direction for this? this maybe a Rails 101 thing I've missed but I just can't seem to see it. I'm still getting my head around the Rails way! coming from 10 years with PHP.
Thanks in advance for any assistance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,如果存在
.gemspec
文件,则只能从git
存储库进行安装。大多数宝石大师档案都包含此内容,但有些出于某种原因不包含此内容,而是在构建宝石之前根据需要生成它。这样做的副作用是很难安装 gem 的“边缘”版本。您可以通过分叉该存储库并构建您自己的 active_merchant.gemspec 文件来解决此问题,这将使其可以从您的分支安装。
Generally you can only install from a
git
repo if there is a<gemname>.gemspec
file present. Most Gem master archives includes this, but some, for whatever reason, do not, instead generating it as required before building the gem. This has the side-effect of making it difficult to install the "edge" version of the gem.You can fix this by forking that repository and building your own active_merchant.gemspec file which will make it installable from your branch.
最新版本的 Shopify 存储库中有一个 .gemspec 文件,如果您将其拉入您的存储库,那么您的 gem 行需要如下所示:
注意 gem 名称中没有下划线。
There is a .gemspec file in the most recent version of the shopify repository, if you pull it into yours, then your gem line needs to look like the following:
Note no underscore in the gem name.