Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
f3355b2a
Commit
f3355b2a
authored
7 years ago
by
L. E. Segovia
Browse files
Options
Downloads
Patches
Plain Diff
Stage to a different directory if upgrading Casks w/version :latest
parent
10a0662d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
+2
-2
2 additions, 2 deletions
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
Library/Homebrew/cask/lib/hbc/installer.rb
+30
-2
30 additions, 2 deletions
Library/Homebrew/cask/lib/hbc/installer.rb
with
32 additions
and
4 deletions
Library/Homebrew/cask/lib/hbc/cli/upgrade.rb
+
2
−
2
View file @
f3355b2a
...
...
@@ -55,14 +55,14 @@ module Hbc
new_cask_installer
.
fetch
new_cask_installer
.
stage
# Move the old Cask's artifacts back to staging
old_cask_installer
.
start_upgrade
# And flag it so in case of error
started_upgrade
=
true
# Install the new Cask
new_cask_installer
.
stage
new_cask_installer
.
install_artifacts
new_artifacts_installed
=
true
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/cask/lib/hbc/installer.rb
+
30
−
2
View file @
f3355b2a
...
...
@@ -378,10 +378,26 @@ module Hbc
disable_accessibility_access
uninstall_artifacts
backup
if
version_is_latest?
end
def
backup
@cask
.
staged_path
.
rename
backup_path
(
@cask
.
staged_path
)
end
def
restore_backup
path
=
backup_path
(
@cask
.
staged_path
)
return
unless
path
.
directory?
Pathname
.
new
(
@cask
.
staged_path
).
rmtree
if
@cask
.
staged_path
.
exist?
path
.
rename
@cask
.
staged_path
end
def
revert_upgrade
opoo
"Reverting upgrade for Cask
#{
@cask
}
"
restore_backup
if
version_is_latest?
install_artifacts
enable_accessibility_access
end
...
...
@@ -420,6 +436,14 @@ module Hbc
purge_caskroom_path
end
def
backup_path
(
path
)
Pathname
.
new
"
#{
path
}
.upgrading"
unless
path
.
nil?
end
def
version_is_latest?
@cask
.
versions
.
include?
(
"latest"
)
end
def
gain_permissions_remove
(
path
)
Utils
.
gain_permissions_remove
(
path
,
command:
@command
)
end
...
...
@@ -428,11 +452,15 @@ module Hbc
ohai
"Purging files for version
#{
@cask
.
version
}
of Cask
#{
@cask
}
"
# versioned staged distribution
gain_permissions_remove
(
@cask
.
staged_path
)
if
!
@cask
.
staged_path
.
nil?
&&
@cask
.
staged_path
.
exist?
staged_path
=
version_is_latest?
?
backup_path
(
@cask
.
staged_path
)
:
@cask
.
staged_path
gain_permissions_remove
(
staged_path
)
if
!
staged_path
.
nil?
&&
staged_path
.
exist?
# Homebrew-Cask metadata
if
@cask
.
metadata_versioned_path
.
respond_to?
(
:children
)
&&
@cask
.
metadata_versioned_path
.
exist?
@cask
.
metadata_versioned_path
.
exist?
&&
!
version_is_latest?
@cask
.
metadata_versioned_path
.
children
.
each
do
|
subdir
|
unless
PERSISTENT_METADATA_SUBDIRS
.
include?
(
subdir
.
basename
)
gain_permissions_remove
(
subdir
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment