This project is archived and is in readonly mode.

#3507 ✓wontfix
İ. Emre Kutlu

rake tasks at different plugin path disappearing after rails update

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

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".

Comments and changes to this ticket

  • İ. Emre Kutlu

    İ. Emre Kutlu November 25th, 2009 @ 09:58 AM

    ... and I am using Rails 2.3.4

  • MatthewRudy

    MatthewRudy November 28th, 2009 @ 06:22 PM

    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
  • tvdeyen

    tvdeyen January 28th, 2010 @ 08:22 PM

    • 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.

  • tvdeyen

    tvdeyen January 28th, 2010 @ 08:59 PM

    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
    
  • David Trasbo

    David Trasbo September 7th, 2010 @ 02:42 PM

    • 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.

  • Rohit Arondekar

    Rohit Arondekar September 7th, 2010 @ 03:05 PM

    • State changed from “new” to “wontfix”
    • Importance changed from “” to “Low”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages