1

I am developing two gems, let's call them foo and bar. Also foo has a runtime dependency on bar. I am developing both these gems with bundler.

How can I specify bar as a dependency of foo and have bundler resolve that dependency to a local path, without polluting my Gemfile? At the moment the only way I can see to do this is to put gem "bar", path: "path/to/bar" in foo's Gemfile, and remove it once bar is on rubygems, but this solution is obviously unsatisfactory as it will break on anybody else's machine until that date.

originalproject
  • 107
  • 1
  • 4

2 Answers2

0

It is not clear if the dependency is runtime or compile time.

Have you tried installing bar using the local .gem file? Once installed in GEM_HOME, your foo gem should detect it

cd /path/to/bar
rake install

then

cd /path/to/foo
rake build
Litmus
  • 10,558
  • 6
  • 29
  • 44
0

You can specify the dependency as a git branch, and then map it to a local path using the instructions here: http://ryanbigg.com/2013/08/bundler-local-paths/

Tim Moore
  • 8,958
  • 2
  • 23
  • 34
  • I really don't want to pollute my Gemfile with references to specific git repos. Also, I should have clarified that I would ideally like people to be able to run the tests without a dependency on Bundler. Eternal-Learner's method means I can simply put my dependencies in the gemspec. – originalproject Nov 09 '13 at 19:24
  • Cool. That's a good solution, but I think it has the drawback that you will need to keep reinstalling gem bar every time you change it if you want gem foo to see the changes. – Tim Moore Nov 11 '13 at 03:34