#6 ✓resolved
James Adam

Absolute path created inside plugin assets directory

Reported by James Adam | April 20th, 2008 @ 12:24 PM | in 2.1.2

Originally posted on Trac by sergio@entrecables.com

Original Trac Ticket

Description

I'm using r671. Plugin assets directory is created correctly inside public/plugin_assets, but absolute path of plugin public directory is created inside public/plugin_assets too. For example, I have in /var/www/application:

vendor/plugins/lightwindow

|_ public

|_ javascripts

|_ stylesheets

And engines create this structure:

public/plugin_assets/lightwindow

|_ javascripts

|_ stylesheets

|_ var

|_ www

|_ application

|_ vendor

|_ plugins

|_ lightwindow

Trac Attachments

http://merb.devjavu.com/attachme...

Trac Comments

04/11/08 02:57:02 changed by sergio@entrecables.com


patch

    attachment engines_dont_create_absolute_path.patch added.

patch

    attachment engines_dont_create_absolute_path.patch added.
    
   

04/13/08 06:54:07 changed by lazyatom


Can you write a failing test in the test application (http://svn.rails-engines.org/tes...) ?

I'm curious as to why we've not seen this issue before.

Comments and changes to this ticket

  • James Adam

    James Adam April 28th, 2008 @ 06:59 AM

    • Milestone set to 2.1
  • James Adam

    James Adam April 28th, 2008 @ 07:04 AM

    • Assigned user set to “James Adam”
  • Yar Dmitriev

    Yar Dmitriev April 30th, 2008 @ 01:16 PM

    Hi. Please see http://github.com/yar/engines/tr... - I hope my test case against the bug and the fix do the job.

  • James Adam

    James Adam June 1st, 2008 @ 12:38 AM

    • Milestone changed from 2.1 to 2.1.2

    Nudging this slightly because I wanted to get a 2.1-compatible release available ASAP, but this is still a priority fix for me.

  • azimux

    azimux June 7th, 2008 @ 12:43 PM

    hi, I'm not sure if this has been addressed yet but here's the bug:

    (I'm not good with git yet so I'm not submitting a patch)

    in engines.rb line 146

    unless source_files.empty?

    base_target_dir = File.join(destination, File.dirname(source_files.first))

    FileUtils.mkdir_p(base_target_dir)

    end

    That should be File.basename not File.dirname, or even better since this chunk of code seems to do nothing would be to remove this unless block completely.

    This causes engines to not work on windows because when it tries to create C:\apppath\public\plugin_assets\C:\apppath\public\plugin_assets\plugin_name it fails because C: is not a valid directory name in windows. On unix this doesn't fail because reating the path leaves a valid path.

    On windows, it doesn't give an exception because the exception is gobbled up at assets.rb line 32 where it is logged but not reraised. So on windows the app runs without plugin_assets being copied over and on *nix systems it runs fine although it creates a pointless directory structure.

  • Paco Benavent

    Paco Benavent October 17th, 2008 @ 03:26 AM

    • Tag set to major, public_assets

    The solution is to change the line 147 in engines.rb from:

    base_target_dir = File.join(destination, File.dirname(source_files.first))

    to:

    base_target_dir = File.join(destination, file.dirname(source_files.first.gsub(source, '')))

    It seems that you fixed this in the next two blocks, when you create source_dirs and copy source_files.

    I also think this block is almost useless, the only need for it is when you have only files in the "assets" folder and no subdirs. In this case this block will create the "public/plugin_assets/PLUGIN_NAME" folder. In the rest of cases, the mkdir_p in the next block will take care of it.

    So maybe this block could be replaced by:

    FileUtils.mkdir_p(destination)

  • Paco Benavent

    Paco Benavent October 17th, 2008 @ 03:27 AM

    • Title changed from “Absoulte path created insed plugin assets directory” to “Absolute path created inside plugin assets directory”
  • azimux

    azimux October 17th, 2008 @ 10:50 AM

    Hi Paco, I submitted this exact patch ~2 months ago

    http://engines.lighthouseapp.com...

    As well as with a test

  • James Adam

    James Adam October 24th, 2008 @ 01:22 AM

    Resolved in http://github.com/lazyatom/engin...

    Sincere apologies for the delay guys.

  • James Adam

    James Adam October 24th, 2008 @ 01:22 AM

    • State changed from “new” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

The rails engines plugin itself

Shared Ticket Bins

Referenced by

Pages