Class: Cask::Artifact::AppImage Private

Inherits:
Moved show all
Defined in:
cask/artifact/appimage.rb

Overview

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.

Artifact corresponding to the app_image stanza.

Constant Summary

Constants inherited from AbstractArtifact

Cask::Artifact::AbstractArtifact::DirectivesType

Instance Attribute Summary

Attributes inherited from AbstractArtifact

#cask

Instance Method Summary collapse

Methods inherited from Moved

#backup_copy_args, english_description, #summarize_installed

Methods included from OS::Linux::Cask::Artifact::Moved

#backup_copy_args

Methods included from OS::Mac::Cask::Artifact::Moved

#backup_copy_args, #undeletable?

Methods inherited from Relocated

#add_altname_metadata, from_args, #initialize, #source, #summarize, #target, #to_a

Methods included from OS::Linux::Cask::Artifact::Relocated

#add_altname_metadata

Methods inherited from AbstractArtifact

#cask_sandbox, #config, dirmethod, dsl_key, english_article, english_name, #initialize, read_script_arguments, #run_cask_sandbox, #sort_order, #staged_path_join_executable, #summarize, #to_args

Methods included from Utils::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_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning

Constructor Details

This class inherits a constructor from Cask::Artifact::Relocated

Instance Method Details

#install_phase(adopt: false, auto_updates: false, force: false, verbose: false, predecessor: nil, successor: nil, reinstall: false, command: SystemCommand) ⇒ 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:

  • adopt (Boolean) (defaults to: false)
  • auto_updates (Boolean, nil) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • predecessor (Cask, nil) (defaults to: nil)
  • successor (Cask, nil) (defaults to: nil)
  • reinstall (Boolean) (defaults to: false)
  • command (T.class_of(SystemCommand)) (defaults to: SystemCommand)


27
28
29
30
31
32
33
34
35
36
37
38
# File 'cask/artifact/appimage.rb', line 27

def install_phase(adopt: false, auto_updates: false, force: false, verbose: false, predecessor: nil,
                  successor: nil, reinstall: false, command: SystemCommand)
  super

  return if target.executable?

  if target.writable?
    FileUtils.chmod "+x", target
  else
    command.run!("chmod", args: ["+x", target], sudo: true)
  end
end

#resolve_target(target, base_dir: nil) ⇒ Pathname

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:



11
12
13
# File 'cask/artifact/appimage.rb', line 11

def resolve_target(target, base_dir: nil)
  Pathname.new("#{config.appimagedir}/#{target}")
end

#uninstall_phase(skip: false, force: false, adopt: false, verbose: false, successor: nil, upgrade: false, reinstall: false, command: SystemCommand) ⇒ 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:

  • skip (Boolean) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • adopt (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • successor (Cask, nil) (defaults to: nil)
  • upgrade (Boolean) (defaults to: false)
  • reinstall (Boolean) (defaults to: false)
  • command (T.class_of(SystemCommand)) (defaults to: SystemCommand)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'cask/artifact/appimage.rb', line 52

def uninstall_phase(skip: false, force: false, adopt: false, verbose: false, successor: nil, upgrade: false,
                    reinstall: false, command: SystemCommand)
  # Migration shim for the `Symlinked` -> `Moved` transition.
  # Old installs have the real AppImage in the versioned Caskroom `source`
  # and a symlink at `target` pointing back to it,
  # which `Moved#move_back` cannot reverse
  # (a non-forced uninstall errors; a skipping one leaves the target behind).
  # The old layout is identified by `target` being that back-symlink
  # (in the new layout, `target` is the real file),
  # regardless of whether `source` still exists:
  # the very breakage this stanza fixes
  # is a self-updater having already deleted the versioned `source`,
  # leaving `target` dangling. Reverse the old layout directly instead.
  # This can be removed once pre-transition installs have aged out.
  if target.symlink? && target.dirname.join(target.readlink) == source
    Utils.gain_permissions_remove(target, command:)
    # Preserve `source` during an upgrade
    # so that it is captured in the staged-directory backup
    # that `revert_upgrade` restores (and reinstalls from)
    # if the new install fails;
    # a successful upgrade purges that backup afterwards.
    Utils.gain_permissions_remove(source, command:) unless upgrade
    return
  end

  super
end