Module: Utils::Svn Private

Extended by:
SystemCommand::Mixin, T::Sig
Defined in:
utils/svn.rb

Overview

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Helper functions for querying SVN information.

Class Method Summary collapse

Methods included from SystemCommand::Mixin

system_command, system_command!

Class Method Details

.available?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


17
18
19
# File 'utils/svn.rb', line 17

def available?
  version.present?
end

.clear_version_cacheObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



38
39
40
# File 'utils/svn.rb', line 38

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

.remote_exists?(url) ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Boolean)


30
31
32
33
34
35
36
# File 'utils/svn.rb', line 30

def remote_exists?(url)
  return true unless available?

  # OK to unconditionally trust here because we're just checking if a URL exists.
  system_command("svn", args: ["ls", url, "--depth", "empty",
                               "--non-interactive", "--trust-server-cert"], print_stderr: false).success?
end

.versionString?

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



22
23
24
25
26
27
# File 'utils/svn.rb', line 22

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