# Make rake tasks of a plugin accessible to the app?

**URL:** <https://www.ruby-forum.com/t/make-rake-tasks-of-a-plugin-accessible-to-the-app/90411>\
**Category:** Rails\
**Created:** [March 28, 2007, 3:20pm UTC](https://www.ruby-forum.com/t/make-rake-tasks-of-a-plugin-accessible-to-the-app/90411 "2007-03-28T15:20:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 28, 2007, 3:20pm UTC](https://www.ruby-forum.com/t/make-rake-tasks-of-a-plugin-accessible-to-the-app/90411/1 "2007-03-28T15:20:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 28, 2007, 3:55pm UTC](https://www.ruby-forum.com/t/make-rake-tasks-of-a-plugin-accessible-to-the-app/90411/2 "2007-03-28T15:55:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [March 28, 2007, 9:33pm UTC](https://www.ruby-forum.com/t/make-rake-tasks-of-a-plugin-accessible-to-the-app/90411/3 "2007-03-28T21:33:03Z")

</div>

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 =)

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [April 24, 2007, 5:29am UTC](https://www.ruby-forum.com/t/make-rake-tasks-of-a-plugin-accessible-to-the-app/90411/4 "2007-04-24T05:29:40Z")

</div>

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 =)
