5

I think I am fundamentally missing something. I am learning ruby, and have been playing with Lita lately, and wrote(my first) a simple little gem to get some directions/distance from the bot. The problem I am having is where to put a gem dependency in my gem. To work, my gem requires the 'rest-client' gem. Where do I put this in my code so that it is available to my Directions class? Currently, to get it to run, I am requiring the gem in my bots actual gemfile. And when I bundle exec lita, it apparently becomes available for my gem to use... but if I remove it from there, I can't get it to work anywhere in my gem.. what am I missing? It is here if anyone wants to read the code and tell me where I should be adding it:

https://github.com/cashman04/lita-directions

EDIT: I added the dependency like spickermann suggested. Then had to add require 'rest-client'to my directions.rb. Not entirely sure if this is the correct way, but it works now. Thanks for the help spickermann

Jimmy
  • 35,686
  • 13
  • 80
  • 98
cashman04
  • 1,134
  • 2
  • 13
  • 27

1 Answers1

5

Put the following line into your lita-directions.gemspec right next to the one that defines the dependency on lita:

spec.add_runtime_dependency 'rest-client'
spickermann
  • 100,941
  • 9
  • 101
  • 131
  • Ok. I had tested that at one point, but I think I had the >= "1.0" after. I was just guessing at that point. Testing it now though. – cashman04 Jan 28 '15 at 02:53