0

I'm building a mountable engine that is dependent on another 'core' (unmounted) engine that I have written.

In my container app's Gemfile I add the core engine and the optional engine's git repo's.

In my mountable engine, where should I add its dependencies on the 'core' engine to be used in the dummy app for testing? (rspec)

I tried adding this in the mountable engine's gemspec:

require "my_core"
...
s.add_dependency "my_core", :git => "https//github.com/me/my_core.git"
4

1 回答 1

2

我通过在引擎 Gemfile 中声明依赖项来做到这一点

if ENV['LOAD_GEMS_FROM_LOCAL'] == '1'
    gem 'my_core', path: File.expand_path("../../my_core", __FILE__)
else
    gem 'my_core', git: 'https//github.com/me/my_core.git'
end

LOAD_GEMS_FROM_LOCAL 让我可以从文件系统加载另一个引擎,因此我可以同时开发两个引擎。

于 2013-05-28T05:15:49.120 回答