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:



67
68
69
70
71
72
73
74
# File 'install_steps.rb', line 67

def initialize(default_base: nil, default_source_base: nil, default_target_base: nil)
  @default_base = default_base
  @default_source_base = default_source_base
  @default_target_base = default_target_base
  @steps = ::T.let([], Steps)
  @guards = ::T.let([], PathSpecs)
  @next_guard_id = ::T.let(0, ::Integer)
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:



77
78
79
# File 'install_steps.rb', line 77

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:



108
109
110
111
112
# File 'install_steps.rb', line 108

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:

Returns:



147
148
149
150
151
152
153
154
155
# File 'install_steps.rb', line 147

def self.normalise_steps(steps)
  steps.map do |step|
    step = step.to_h do |key, value|
      key = key.to_s
      [key, normalise_step_value(key, value)]
    end
    compact_step(step)
  end
end

Instance Method Details

#compile_gsettings_schemasvoid

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.



462
463
464
# File 'install_steps.rb', line 462

def compile_gsettings_schemas
  add_rebuild_action("compile_gsettings_schemas", "share/glib-2.0/schemas")
end

#copy(source, target, source_base: nil, target_base: nil, recursive: false, overwrite: true, source_glob: 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:



287
288
289
290
291
292
293
294
295
# File 'install_steps.rb', line 287

def copy(source, target, source_base: nil, target_base: nil, recursive: false, overwrite: true,
         source_glob: false)
  add_step("copy",
           "source"      => path_spec(source, base: source_base, default_base: @default_source_base),
           "target"      => path_spec(target, base: target_base, default_base: @default_target_base),
           "recursive"   => recursive,
           "overwrite"   => overwrite,
           "source_glob" => source_glob)
end

#delete_keychain_certificate(name, matching_certificate: nil, 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:



498
499
500
501
502
503
# File 'install_steps.rb', line 498

def delete_keychain_certificate(name, matching_certificate: nil, base: nil)
  add_step("delete_keychain_certificate",
           "name"                 => name,
           "matching_certificate" => (path_spec(matching_certificate, base:, default_base: nil) if
             matching_certificate))
end

#formula_nameString

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:



86
87
88
# File 'install_steps.rb', line 86

def formula_name
  "{{formula_name}}"
end

#gdk_pixbuf_query_loadersvoid

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.



472
473
474
# File 'install_steps.rb', line 472

def gdk_pixbuf_query_loaders
  add_step("gdk_pixbuf_query_loaders")
end

#gio_querymodulesvoid

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.



467
468
469
# File 'install_steps.rb', line 467

def gio_querymodules
  add_rebuild_action("gio_querymodules", "lib/gio/modules")
end

#gtk_update_icon_cachevoid

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.



477
478
479
# File 'install_steps.rb', line 477

def gtk_update_icon_cache
  add_rebuild_action("gtk_update_icon_cache", "share/icons/hicolor")
end

#if_path_exists(path, base: nil, &block) ⇒ 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:



121
122
123
# File 'install_steps.rb', line 121

def if_path_exists(path, base: nil, &block)
  with_guard(path_spec(path, base:, default_base: @default_base).merge("condition" => "if_exists"), &block)
end

#init_data_dir(path, using:, base: nil, locale: 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:



454
455
456
457
458
459
# File 'install_steps.rb', line 454

def init_data_dir(path, using:, base: nil, locale: nil)
  add_step("init_data_dir",
           "path"   => path_spec(path, base:, default_base: @default_base),
           "using"  => using.to_s,
           "locale" => locale)
end

#inreplace(path, before, after, base: nil, audit_result: true, global: true) ⇒ 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:



327
328
329
330
331
332
333
334
335
336
# File 'install_steps.rb', line 327

def inreplace(path, before, after, base: nil, audit_result: true, global: true)
  add_step("inreplace",
           "path"           => path_spec(path, base:, default_base: @default_base),
           "before"         => before.is_a?(::Regexp) ? before.source : before,
           "after"          => after,
           "regexp"         => before.is_a?(::Regexp),
           "regexp_options" => (before.options if before.is_a?(::Regexp)),
           "skip_audit"     => !audit_result,
           "first_only"     => !global)
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:



422
423
424
425
426
427
428
# File 'install_steps.rb', line 422

def link_children(source, target = nil, source_base: nil, target_base: :homebrew_prefix, prefix: "", suffix: "")
  add_step("link_children",
           "source" => path_spec(source, base: source_base, default_base: @default_source_base),
           "target" => path_spec(target || source, base: target_base, default_base: @default_target_base),
           "prefix" => prefix,
           "suffix" => suffix)
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:



406
407
408
409
410
# File 'install_steps.rb', line 406

def link_dir(source, target, source_base: nil, target_base: :homebrew_prefix)
  add_step("link_dir",
           "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

#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:



377
378
379
380
# File 'install_steps.rb', line 377

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:



393
394
395
396
# File 'install_steps.rb', line 393

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.

odeprecated

Parameters:



214
215
216
# File 'install_steps.rb', line 214

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:



219
220
221
# File 'install_steps.rb', line 219

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, source_glob: 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:



238
239
240
241
242
243
244
# File 'install_steps.rb', line 238

def move(source, target, source_base: nil, target_base: nil, force: false, source_glob: 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,
           "source_glob" => source_glob)
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:



256
257
258
259
260
# File 'install_steps.rb', line 256

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

#move_contents(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:



270
271
272
273
274
# File 'install_steps.rb', line 270

def move_contents(source, target, source_base: nil, target_base: nil)
  add_step("move_contents",
           "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

#nameString

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.

odeprecated

Returns:



81
82
83
# File 'install_steps.rb', line 81

def name
  "{{name}}"
end

#on_linux(&block) ⇒ 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:

  • block (::T.proc.void)


142
143
144
# File 'install_steps.rb', line 142

def on_linux(&block)
  with_guard({ "condition" => "on", "value" => "linux" }, &block)
end

#on_macos(&block) ⇒ 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:

  • block (::T.proc.void)


137
138
139
# File 'install_steps.rb', line 137

def on_macos(&block)
  with_guard({ "condition" => "on", "value" => "macos" }, &block)
end

#remove(paths, base: nil, recursive: false, sudo: false, symlink_target_contains: nil, content_contains: 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:

  • paths (Paths)
  • base (::T.nilable(::T.any(::String, ::Symbol))) (defaults to: nil)
  • recursive (::T::Boolean) (defaults to: false)
  • sudo (::T.any(::T::Boolean, ::Symbol)) (defaults to: false)
  • symlink_target_contains (::T.nilable(::String)) (defaults to: nil)
  • content_contains (::T.nilable(::String)) (defaults to: nil)


307
308
309
310
311
312
313
314
315
# File 'install_steps.rb', line 307

def remove(paths, base: nil, recursive: false, sudo: false, symlink_target_contains: nil,
           content_contains: nil)
  add_step("remove",
           "paths"                   => path_specs(paths, base:, default_base: @default_base),
           "recursive"               => recursive,
           "sudo"                    => sudo.is_a?(::Symbol) ? sudo.to_s : sudo,
           "symlink_target_contains" => symlink_target_contains,
           "content_contains"        => content_contains)
end

#set_ownership(paths, user: nil, group: "staff", base: nil, recursive: true) ⇒ 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:



529
530
531
532
533
534
535
# File 'install_steps.rb', line 529

def set_ownership(paths, user: nil, group: "staff", base: nil, recursive: true)
  add_step("set_ownership",
           "paths"         => path_specs(paths, base:, default_base: @default_base),
           "user"          => user,
           "group"         => group,
           "non_recursive" => !recursive)
end

#set_permissions(paths, permissions, base: nil, recursive: true) ⇒ 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:



513
514
515
516
517
518
# File 'install_steps.rb', line 513

def set_permissions(paths, permissions, base: nil, recursive: true)
  add_step("set_permissions",
           "paths"         => path_specs(paths, base:, default_base: @default_base),
           "permissions"   => permissions,
           "non_recursive" => !recursive)
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:



352
353
354
355
356
357
358
359
360
361
362
363
# File 'install_steps.rb', line 352

def symlink(source, target, source_base: nil, target_base: nil, source_formula: nil, target_formula: nil,
            force: false, uninstall: false, source_glob: false, sudo: 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,
           "source_glob" => source_glob,
           "sudo"        => sudo.is_a?(::Symbol) ? sudo.to_s : sudo)
end

#tokenString

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:



91
92
93
# File 'install_steps.rb', line 91

def token
  "{{token}}"
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:



224
225
226
# File 'install_steps.rb', line 224

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

#unless_path_exists(path, base: nil, &block) ⇒ 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:



132
133
134
# File 'install_steps.rb', line 132

def unless_path_exists(path, base: nil, &block)
  with_guard(path_spec(path, base:, default_base: @default_base).merge("condition" => "unless_exists"), &block)
end

#update_desktop_databasevoid

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.



487
488
489
# File 'install_steps.rb', line 487

def update_desktop_database
  add_rebuild_action("update_desktop_database", "share/applications")
end

#update_mime_databasevoid

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.



482
483
484
# File 'install_steps.rb', line 482

def update_mime_database
  add_rebuild_action("update_mime_database", "share/mime")
end

#versionTemplateVersion

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:

  • (TemplateVersion)


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

def version
  TEMPLATE_VERSION
end

#write(path, content, base: nil, overwrite: 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:



438
439
440
441
442
443
444
# File 'install_steps.rb', line 438

def write(path, content, base: nil, overwrite: false)
  content = "#{content}\n" unless content.end_with?("\n")
  add_step("write",
           "path"      => path_spec(path, base:, default_base: @default_base),
           "content"   => content,
           "overwrite" => overwrite)
end