tlehman
tlehman

Reputation: 5167

Requiring files in executables in a gem

I am building a gem using ruby 1.9.3 and bundler 1.1.3. In my gemspec, I use the executables method to specify that `bin/curd" is executable:

Gem::Specification.new do |gem|
  ...
  gem.executables   = ["curd"]
  ...
end

The gem source directory has a bin and a lib directory:

bin/
  curd
lib/
  curd.rb

The bin/curd file uses code defined in lib/curd, but I haven't been able to properly require it.

How can I require the lib/curd file so that when the gem is installed, bin/curd can see it?

Upvotes: 1

Views: 109

Answers (1)

NARKOZ
NARKOZ

Reputation: 27961

Add to bin/curd:

require 'curd'

This will require curd gem after installation.

Upvotes: 3

Related Questions