Ruby Rake load tasks from a gem

前端 未结 1 747
萌比男神i
萌比男神i 2021-02-07 22:10

i have been trying to include a gem located on github to my current app. The gem has a rake file that i want to able to access from my app. But i keep getting load errors.

1条回答
  •  青春惊慌失措
    2021-02-07 22:50

    Okay, I found a solution for this problem if anyone is interested:

    # Rails.root/Rakefile
    
    spec = Gem::Specification.find_by_name 'test'
    load "#{spec.gem_dir}/tasks/deploy.rake"
    

    That's all I needed to say in my Rakefile!

    0 讨论(0)
提交回复
热议问题