Reputation: 9336
I am building my own first Gem. After I created some functionality I ordered all the files like to the best practice of gem building.
I moved all the files to right folders.
The executable is in bin/boss-mailer
, the rest is put all in the lib
folder like:
The executable is simple. I just set the executable to ruby and try to require the boss_mailer.rb
in the lib file.
This cannot load my file. I can require it by using require "./boss_mailer"
beginning to pointing the current path.
But in other Gems on Github I see that people just use require "filename"
to reference to loading file. Like here: gli gem
Do I have to pre-build the gem or something else to require my files without to point to the current path?
What do I have to do require the file lib/boss_mailer'
without using ./
?
Upvotes: 0
Views: 714
Reputation: 31477
Are you using Bundler? I would recommend that. Then running your binary would be simply as:
bundle exec ./bin/boss_mailer.rb
Please make sure that you configure the $LOAD_PATH
correctly in your boss-mailer.gemspec
correctly, but if you've followed the best practices you've probably already done that.
Upvotes: 1