diff options
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r-- | lib/bundler/settings.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 6ba739623f..b365d08c2b 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -44,6 +44,7 @@ module Bundler no_install no_prune only_update_to_newer_versions + path_relative_to_cwd path.system plugins prefer_gems_rb @@ -248,6 +249,20 @@ module Bundler path end + def base_path_relative_to_pwd + base_path = Pathname.new(self.base_path) + expanded_base_path = base_path.expand_path(Bundler.root) + relative_path = expanded_base_path.relative_path_from(Pathname.pwd) + if relative_path.to_s.start_with?("..") + relative_path = base_path if base_path.absolute? + else + relative_path = Pathname.new(File.join(".", relative_path)) + end + relative_path + rescue ArgumentError + expanded_base_path + end + def validate! return unless explicit_path && system_path path = Bundler.settings.pretty_values_for(:path) |