rubygems - Running Ruby gem exe file from outside the gem -


i'm having trouble figuring out how run executable i'm building gem. i've been able make progress, feels i'm doing wrong. have following structure.

my_gem |__ exe   |__ foo |__ lib   |__ commands      |__ foo          |__ actions.rb 

my exe/foo file has following

#!/usr/bin/env ruby  require 'commands/foo/actions'  mygem::commands::foo.start(argv) 

while inside my_gem directory, if execute bundle exec exe/foo, seems work fine. particular command generates rails app inside my_gem/the_app. works, i've noticed subtle problems command , newly generated rails app. i'd run command outside of gem directory. if execute my_gem/exe/foo, following error though:

/home/me/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- commands/foo/actions (loaderror). 

i same error if execute exe/foo inside my_gem folder well.

i've been able around running rake build , rake install. can run foo wherever want , picks installed version outside gem. however, it's pain build/install gem every time want test out.

is there way can execute development version of command outside gem directory?

i added following exe/foo , seemed help

lib = file.expand_path('../../lib', __file__) $load_path.unshift(lib) unless $load_path.include?(lib)


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo