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

Config file placed at the project level at .config/irb/irbrc is not parsed. #904

Open
artur-intech opened this issue Mar 16, 2024 · 2 comments

Comments

@artur-intech
Copy link
Contributor

artur-intech commented Mar 16, 2024

The documentation states that:

The path to the configuration file is the first found among:
File +.config/irb/irbrc+ in the current directory, if it exists.

https://github.com/ruby/irb/blob/master/lib/irb.rb#L148

but there seems to be no code which would do this. Creating such file does nothing in reality as well: I have a project under ~/projects/notes and if I create a config file at ~/projects/notes/.config/irb/irbrc and put something like puts "test" there, nothing is printed when I run irb being at the project root.

current_dir = Dir.pwd

I really see beneficial to put a config file just under .config/irb/irbrc of my project instead of polluting project root, so I would like to double-check that it is a bug, rather than misleading documentation.

@artur-intech artur-intech changed the title Config file placed at the project level in .config/irb/irbrc is not parsed. Config file placed at the project level at .config/irb/irbrc is not parsed. Mar 16, 2024
@tompng
Copy link
Member

tompng commented Mar 16, 2024

The document is wrong.
$XDG_CONFIG_HOME/irb/irbrc and $HOME/.config/irb/irbrc part is based on XDG Base Directory Specification

$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

Project level config is a good idea, but I'd like to align with other tool's config directory name.
If project level ./.config/ is not so commonly used, I think it's too early to implement it.

@artur-intech
Copy link
Contributor Author

artur-intech commented Mar 19, 2024

My .irbrc has require_relative 'app' (where app is a file in the project root), so in my case it is crucial to have project-specific config since I couldn't find any other option so solve it another way.

I haven't done proper research on this topic yet, but the same approach is already implemented in Rubocop.

I think it is worth removing misleading documentation until we sort out this issue.

P.S. I fixed the line number in my first comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants