operating_system.rb 756 B

123456789101112131415161718192021222324252627282930313233343536
  1. module Gem
  2. class << self
  3. ##
  4. # Detects --build-root option specified on command line.
  5. def opt_build_root?
  6. @opt_build_root ||= ARGV.include?('--build-root')
  7. end
  8. private :opt_build_root?
  9. ##
  10. # Regular user installs into user directory, except when --build-root is
  11. # specified during packaging.
  12. # TODO: check if we want to set --bindir to .local/bin
  13. remove_method :operating_system_defaults
  14. def operating_system_defaults
  15. unless opt_build_root?
  16. {'gem' => '--user-install'}
  17. else
  18. {}
  19. end
  20. end
  21. ##
  22. # Avoid duplicating install extensions in legacy location
  23. remove_method :install_extension_in_lib
  24. def install_extension_in_lib
  25. false
  26. end
  27. end
  28. end