1

I am new to Ruby so forgive me if my question is obvious. I would really appreciate a little help here.

I have a project which I use as a library. It has 2 rake tasks which gives me a new file which is stored in a folder in the project. Let's say that this rake task serves as a parser and gives a JSON file.

This project can also be used as a gem. The .rake files are placed in the lib path of the project, so the rake tasks are publicly available.

I would like to call this rake tasks in my ruby code, in a new ROR application and have access to the outputed JSON file.

How I can run a rake tasks from a gem in my ROR application code and how I can have access to a file that is stored in the inner folder of the gem?

Ectoras
  • 1,297
  • 3
  • 13
  • 33
  • 1
    You can call rake tasks by calling `Rake::Task['your_task_name'].invoke(your,task,args)` – MrYoshiji May 05 '15 at 15:13
  • 1
    possible duplicate of [Ruby: Accessing rake task from a gem without Rails](http://stackoverflow.com/questions/13858495/ruby-accessing-rake-task-from-a-gem-without-rails) – fab May 05 '15 at 15:27
  • @MrYoshiji. The statement you wrote can also be used for the Rake Tasks of a Gem? Because the application where the gem is included does not have rake tasks. – Ectoras May 12 '15 at 07:51
  • Doesn't work for tasks inside of Gems – Jason FB May 31 '15 at 18:59

0 Answers0