Module: Gem

Defined in:
lib/bundler/rubygems_ext.rb

Defined Under Namespace

Modules: BetterPermissionError Classes: BasicSpecification, Dependency, NameTuple, Platform, Requirement, Specification, SpecificationPolicy, StubSpecification

Constant Summary collapse

VALIDATES_FOR_RESOLUTION =

Can be removed once RubyGems 3.5.14 support is dropped

Specification.new.respond_to?(:validate_for_resolution).freeze
FLATTENS_REQUIRED_PATHS =

Can be removed once RubyGems 3.3.15 support is dropped

Specification.new.respond_to?(:flatten_require_paths).freeze

Class Method Summary collapse

Class Method Details

.freebsd_platform?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/bundler/rubygems_ext.rb', line 28

def self.freebsd_platform?
  RbConfig::CONFIG["host_os"].to_s.include?("bsd")
end

.open_file_with_flock(path, &block) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bundler/rubygems_ext.rb', line 35

def self.open_file_with_flock(path, &block)
  flags = File.exist?(path) ? "r+" : "a+"

  File.open(path, flags) do |io|
    begin
      io.flock(File::LOCK_EX)
    rescue Errno::ENOSYS, Errno::ENOTSUP
    end
    yield io
  rescue Errno::ENOLCK # NFS
    if Thread.main != Thread.current
      raise
    else
      File.open(path, flags, &block)
    end
  end
end