1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Find configuration file in XDG Base Directory

Find configuration file in XDG Base Directory only if `PRYRC` is not
set, and `~/.pryrc` does not exist, therefore not confusing current
users. Note that cache file path is not modified.
This commit is contained in:
Franklin Yu 2017-05-16 15:39:21 -04:00
parent baa29048cf
commit a0be0cc7b2

View file

@ -1,7 +1,18 @@
require 'pry/config'
class Pry
HOME_RC_FILE = ENV["PRYRC"] || "~/.pryrc"
HOME_RC_FILE =
if ENV.key?('PRYRC')
ENV['PRYRC']
elsif File.exist?(File.expand_path('~/.pryrc'))
'~/.pryrc'
elsif ENV.key?('XDG_CONFIG_HOME') && ENV['XDG_CONFIG_HOME'] != ''
# See XDG Base Directory Specification at
# https://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
ENV['XDG_CONFIG_HOME'] + '/pry/pryrc'
else
'~/.config/pry/config'
end
LOCAL_RC_FILE = "./.pryrc"
class << self