Spec-Zone.ru › Homebrew

Module: Utils::Svn Private

Extended by:
SystemCommand::Mixin, Output::Mixin
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

  • .available? ⇒ Boolean private
  • .invalid_cert_flags ⇒ Array<String> private
  • .remote_exists?(url) ⇒ Boolean private
  • .version ⇒ String? private

Methods included from Output::Mixin

issue_reporting_message, odebug, odeprecated, odie, odisabled, ofail, oh1, oh1_title, ohai, ohai_title, onoe, opoo, opoo_outside_github_actions, opoo_without_github_actions_annotation, pretty_deprecated, pretty_disabled, pretty_duration, pretty_install_status, pretty_installed, pretty_uninstalled, pretty_upgradable, pretty_warning

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)


15
16
17
# File 'utils/svn.rb', line 15

def available?
  version.present?
end

.invalid_cert_flags ⇒ Array<String>

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:

  • (Array<String>)


41
42
43
44
45
46
47
48
# File 'utils/svn.rb', line 41

def invalid_cert_flags
  opoo "Ignoring Subversion certificate errors!"
  args = ["--non-interactive", "--trust-server-cert"]
  if Version.new(version || "-1") >= Version.new("1.9")
    args << "--trust-server-cert-failures=expired,not-yet-valid"
  end
  args
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:

  • url (String)

Returns:

  • (Boolean)


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

def remote_exists?(url)
  return true unless available?

  args = ["ls", url, "--depth", "empty"]
  _, stderr, status = system_command("svn", args:, print_stderr: false).to_a
  return !!status.success? unless stderr.include?("certificate verification failed")

  # OK to unconditionally trust here because we're just checking if a URL exists.
  system_command("svn", args: args.concat(invalid_cert_flags), print_stderr: false).success?
end

.version ⇒ String?

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:

  • (String, nil)


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

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

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

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Utils/Svn.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API