Skip to content

Require relative symlink#2359

Merged
dbussink merged 2 commits intorubinius:masterfrom
LTe:require_relative_symlink
May 27, 2013
Merged

Require relative symlink#2359
dbussink merged 2 commits intorubinius:masterfrom
LTe:require_relative_symlink

Conversation

@LTe
Copy link
Copy Markdown
Contributor

@LTe LTe commented May 24, 2013

When rubinius try to execute require_relative with symlinked path
File#dirname will not recognize symlink and returns wrong path. But
File#realdirpath will follow symlink and return proper path for
require_relative.

Fix #2336

@dbussink
Copy link
Copy Markdown
Contributor

So the issue here is that Rubyspec also needs to work on Windows. On Windows, there are no symlinks, so we can't commit a symlink for a fixture directly. We need to guard the specs with a platform guard and setup the symlink in a before step so it only is specced on platforms supporting symlinks.

@LTe
Copy link
Copy Markdown
Contributor Author

LTe commented May 25, 2013

@dbussink now spec will be executed only on non-windows platforms.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanest way is probably to do use fixtures for the files, but to use a before and after block for creating and removing the symlink. Now the spec contains a lot of setup code that makes it less clear.

@badosu
Copy link
Copy Markdown
Contributor

badosu commented May 25, 2013

Cool!

@LTe
Copy link
Copy Markdown
Contributor Author

LTe commented May 25, 2013

@dbussink I used fixtures and before/after block.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guard needs to be moved up, guarding the whole describe block so it is properly scoped. We also don't use context as a description, but "describe" everywhere.

LTe added 2 commits May 27, 2013 20:08
When rubinius try to execute require_relative with symlinked path
File#dirname will not recognize symlink and returns wrong path. But
File#realdirpath will follow symlink and return proper path for
require_relative.
dbussink added a commit that referenced this pull request May 27, 2013
@dbussink dbussink merged commit 2267d8a into rubinius:master May 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling require_relative from symlinked file doesn't pick up the right base path.

3 participants