Class: Homebrew::InstallSteps::DSL Private

Inherits:
Object
  • Object
show all
Defined in:
install_steps.rb

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_base: nil, default_source_base: nil, default_target_base: nil) ⇒ void

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:



22
23
24
25
26
27
# File 'install_steps.rb', line 22

def initialize(default_base: nil, default_source_base: nil, default_target_base: nil)
  @default_base = ::T.let(default_base, ::T.nilable(::T.any(::String, ::Symbol)))
  @default_source_base = ::T.let(default_source_base, ::T.nilable(::T.any(::String, ::Symbol)))
  @default_target_base = ::T.let(default_target_base, ::T.nilable(::T.any(::String, ::Symbol)))
  @steps = ::T.let([], Steps)
end

Instance Attribute Details

#stepsSteps (readonly)

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:



30
31
32
# File 'install_steps.rb', line 30

def steps
  @steps
end

Class Method Details

.build(default_base: nil, default_source_base: nil, default_target_base: nil, &block) ⇒ Steps

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:



40
41
42
43
44
# File 'install_steps.rb', line 40

def self.build(default_base: nil, default_source_base: nil, default_target_base: nil, &block)
  dsl = new(default_base:, default_source_base:, default_target_base:)
  dsl.instance_eval(&block) if block
  dsl.steps
end

.normalise_steps(steps) ⇒ Steps

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:

  • steps (::T::Array[::T.untyped])

Returns:



47
48
49
50
51
# File 'install_steps.rb', line 47

def self.normalise_steps(steps)
  steps.map do |step|
    ::T.cast(::Utils.deep_stringify_symbols(step), Step)
  end
end

Instance Method Details

#ln_s(source, target, source_base: nil, target_base: nil, source_formula: nil, target_formula: nil, force: false, uninstall: false) ⇒ void

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.

This method returns an undefined value.

Parameters:



135
136
137
138
# File 'install_steps.rb', line 135

def ln_s(source, target, source_base: nil, target_base: nil, source_formula: nil, target_formula: nil,
         force: false, uninstall: false)
  symlink(source, target, source_base:, target_base:, source_formula:, target_formula:, force:, uninstall:)
end

#ln_sf(source, target, source_base: nil, target_base: nil, source_formula: nil, target_formula: nil, uninstall: false) ⇒ void

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.

This method returns an undefined value.

Parameters:



151
152
153
154
# File 'install_steps.rb', line 151

def ln_sf(source, target, source_base: nil, target_base: nil, source_formula: nil, target_formula: nil,
          uninstall: false)
  symlink(source, target, source_base:, target_base:, source_formula:, target_formula:, force: true, uninstall:)
end

#mkdir(path, base: nil) ⇒ void

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.

This method returns an undefined value.

Parameters:



54
55
56
# File 'install_steps.rb', line 54

def mkdir(path, base: nil)
  add_step("mkdir", "path" => path_spec(path, base:, default_base: @default_base))
end

#mkdir_p(path, base: nil) ⇒ void

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.

This method returns an undefined value.

Parameters:



59
60
61
# File 'install_steps.rb', line 59

def mkdir_p(path, base: nil)
  add_step("mkdir_p", "path" => path_spec(path, base:, default_base: @default_base))
end

#move(source, target, source_base: nil, target_base: nil, force: false) ⇒ void Also known as: mv

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.

This method returns an undefined value.

Parameters:



77
78
79
80
81
82
# File 'install_steps.rb', line 77

def move(source, target, source_base: nil, target_base: nil, force: false)
  add_step("move",
           "source" => path_spec(source, base: source_base, default_base: @default_source_base),
           "target" => path_spec(target, base: target_base, default_base: @default_target_base),
           "force"  => force)
end

#move_children(source, target, source_base: nil, target_base: nil) ⇒ void

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.

This method returns an undefined value.

Parameters:



94
95
96
97
98
# File 'install_steps.rb', line 94

def move_children(source, target, source_base: nil, target_base: nil)
  add_step("move_children",
           "source" => path_spec(source, base: source_base, default_base: @default_source_base),
           "target" => path_spec(target, base: target_base, default_base: @default_target_base))
end

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.

This method returns an undefined value.

Parameters:



112
113
114
115
116
117
118
119
120
121
# File 'install_steps.rb', line 112

def symlink(source, target, source_base: nil, target_base: nil, source_formula: nil, target_formula: nil,
            force: false, uninstall: false)
  add_step("symlink",
           "source"    => path_spec(source, base: source_base, formula: source_formula,
                                     default_base: @default_source_base),
           "target"    => path_spec(target, base: target_base, formula: target_formula,
                                     default_base: @default_target_base),
           "force"     => force,
           "uninstall" => uninstall)
end

#touch(path, base: nil) ⇒ void

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.

This method returns an undefined value.

Parameters:



64
65
66
# File 'install_steps.rb', line 64

def touch(path, base: nil)
  add_step("touch", "path" => path_spec(path, base:, default_base: @default_base))
end