Run ruby script from rake task -


i have small ruby script runs fine when run manually command line. uses 3 gems have installed using "gem install x" , @ top of script file have lines "require x". works fine.

now creating task in rake call ruby script. have tried both use

system("/tools/myscript.rb #{foo} #{bar}") 

and

`/tools/myscript.rb #{foo} #{bar}` 

but both give me error:

myscript.rb:2:in `require': no such file load -- ruby-audio (loaderror)

it seems gem not loaded. tried add gems gemfile of rails app after necessary gems had been added , ran bundle update ended in error mysql adapter not working script.

but since script works fine command line, thought there should easy way call within rake task.

any ideas?

use

bundle exec <script> 

to sure load bundled gems script want run


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -