Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rake tasks at different plugin path disappearing after rails update

#3507

I added this line to my environment.rb to add a new path for my plugins.

   config.plugin_paths << File.join(Rails.root, 'vendor', 'new_folder')

After that, i created a plugin in that folder. Everything is fine to this point but when i create a rake file in my tasks folder, i cannot see it when i "rake -T".

Reported by İ. Emre Kutlu · November 24th, 2009 @ 08:35 AM

State: wontfix
Milestone: none
Assigned to: Rohit Arondekar Rohit Arondekar
Importance: Low

Activity

  1. İ. Emre Kutlu
    İ. Emre Kutlu

    ... and I am using Rails 2.3.4

    November 25th, 2009 @ 09:58 AM

  2. MatthewRudy
    MatthewRudy

    yeah,
    I looked at this before.
    but the problem seems to be that there is no way to load this information without loading up the Rails Environment.

    And, understandably, we don't want to load up the environment every time we run a rake any rake task...

    So, only files in vendor/plugins and lib/tasks get loaded up,

    therefore the hack is to place a file in you lib/tasks which just loads your extra rake files.

    eg,

    # lib/tasks/custom_plugin_tasks.rake
    Dir.glob("/../../vendor/new_folder/*/tasks/.rake").each do |rake_file|
      require rake_file
    end
    
    ... didnt test this

    November 28th, 2009 @ 06:22 PM

  3. tvdeyen
    tvdeyen
    • Tag set to engines, plugins, rake
    • Title changed from rake tasks at different plugin path to rake tasks at different plugin path disappearing after rails update

    It should be:

    Dir.glob(File.dirname(__FILE__) + "/../../vendor/new_folder/**/tasks/*.rake").each do |rake_file|
      require rake_file
    end
    

    but this is not working for me:

    rake aborted!
    no such file to load -- FILENAME
    

    The File exists. Strange. But maybe this is only a local problem at my machine. What could this be? Anyone any clues?


    Any new updates on this? I used Rails 2.1.2 for along time now with engines plugin and all rake tasks from my special folders worked fine. Now i updated my app to Rails 2.3.5 and all the rake tasks disappeared.

    January 28th, 2010 @ 08:22 PM

  4. tvdeyen
    tvdeyen

    I've got it!

    It should be import instead of require.
    So, the rake file for including custom rakefiles in folders different from vendor/plugins/ should look like:

    # RAILS_ROOT/lib/tasks/custom_plugins_tasks.rake
    Dir.glob(File.dirname(__FILE__) + "/../../vendor/new_folder/**/tasks/*.rake").each do |rake_file|
      import rake_file
    end
    

    January 28th, 2010 @ 08:59 PM

  5. David Trasbo
    David Trasbo
    • Assigned user set to Rohit Arondekar

    I think this can be marked as wontfix. It's a quite minor bug that very few people will stumble upon, and those who does can fix it themselves as described above.

    September 7th, 2010 @ 02:42 PM

  6. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to wontfix
    • Importance changed from to Low

    September 7th, 2010 @ 03:05 PM