Module: Utils::Svn Private

Defined in:
brew/Library/Homebrew/utils/svn.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper functions for querying SVN information.

Class Method Summary collapse

Class Method Details

.available?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


12
13
14
# File 'brew/Library/Homebrew/utils/svn.rb', line 12

def available?
  version.present?
end

.clear_version_cacheObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'brew/Library/Homebrew/utils/svn.rb', line 32

def clear_version_cache
  remove_instance_variable(:@version) if defined?(@version)
end

.remote_exists?(url) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'brew/Library/Homebrew/utils/svn.rb', line 23

def remote_exists?(url)
  return true unless available?

  # OK to unconditionally trust here because we're just checking if
  # a URL exists.
  quiet_system "svn", "ls", url, "--depth", "empty",
               "--non-interactive", "--trust-server-cert"
end

.versionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
# File 'brew/Library/Homebrew/utils/svn.rb', line 16

def version
  return @version if defined?(@version)

  stdout, _, status = system_command(HOMEBREW_SHIMS_PATH/"scm/svn", args: ["--version"], print_stderr: false)
  @version = status.success? ? stdout.chomp[/svn, version (\d+(?:\.\d+)*)/, 1] : nil
end