Make rake tasks of a plugin accessible to the app?

Hi all

I want to add some rake tasks to my app using a plugin. So I added some
tasks to vendor/plugins/my-plugin/Rakefile, but it seems that the tasks
in a plugin’s Rakefile are not available to access from the application
root, but you have to change directory to vendor/plugins/my-plugin. Is
that correct?
I’d really like to make my rake tasks from the plugin accessible by the
whole application. How can I achieve this?

Thanks a lot for help,
Josh

Rails automatically loads vendor/plugins/my-plugin/lib/tasks/.rake
(following Rake’s auto-loading of lib/tasks/
.rake)

So put the tasks you want showing up in a .rake file and you’re good to
go.

Jason

Jason R. wrote:

Rails automatically loads vendor/plugins/my-plugin/lib/tasks/.rake
(following Rake’s auto-loading of lib/tasks/
.rake)

So put the tasks you want showing up in a .rake file and you’re good to
go.

Jason

Thanks a lot =)

This is true unless you want to run the rake task from cron. For some
reason, when run from cron, it isnt looking in the vendor directory for
the rake tasks. Im looking for a way to fix it.

When I run Rake -T from a cron job I get the rake tasks including the
ones in lib/task, but not the ones from the vendor directory. Any clue
how to fix this?

Joshua M. wrote:

Jason R. wrote:

Rails automatically loads vendor/plugins/my-plugin/lib/tasks/.rake
(following Rake’s auto-loading of lib/tasks/
.rake)

So put the tasks you want showing up in a .rake file and you’re good to
go.

Jason

Thanks a lot =)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs