Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix actual_root_path implementation #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

drewbug
Copy link

@drewbug drewbug commented Feb 10, 2016

No description provided.

@@ -46,7 +46,7 @@ def extension
protected :extension

def actual_root_path
root_path || Dir.pwd
root_path || File.dirname(File.realpath(__FILE__))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would this work? File.new(File.dirname(__FILE__)).realpath

I'm assuming we want to use File.dirname(__FILE__) over __dir__ for ruby version compatibility. too bad.

@kbrock
Copy link
Collaborator

kbrock commented Apr 21, 2016

Fix actual_root_path implementation

Hello @drewbug could you share what you are trying to do here?

@drewbug
Copy link
Author

drewbug commented Apr 21, 2016

@kbrock: The README says: By default, this class will look for a yml file named "countries.yml" in the same directory as the file.

I was just attempting to bring the actual implementation into line with this. I was bitten by this when starting a daemon from a different working directory. My easy workaround is: set_root_path __dir__, but this doesn't work on Ruby versions older than 2.0

@kbrock
Copy link
Collaborator

kbrock commented Apr 21, 2016

Thanks, that is helpful.

Using dir or filename will be the same result. The directory of this gem file, not the caller's dir. Maybe caller or caller_location may be of use?

I'll try and play with this...

@drewbug
Copy link
Author

drewbug commented Apr 25, 2016

You're right, @kbrock, I didn't even think about that. D'oh!

@kbrock
Copy link
Collaborator

kbrock commented Apr 25, 2016

@drewbug there may be a way to look at self.class.method(?).source_location or something?
I'm sure the answer is simple, just have to find it

@syguer syguer added the bug label Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants