Skip to content
Snippets Groups Projects
Commit ad7c2e54 authored by Markus Reiter's avatar Markus Reiter Committed by GitHub
Browse files

Merge pull request #2328 from reitermarkus/installed-caskfile

Add `#installed_caskfile` method to `Cask` class.
parents 159e35b4 9f7d86b9
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,11 @@ module Hbc
!versions.empty?
end
def installed_caskfile
installed_version = timestamped_versions.last
metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb")
end
def to_s
@token
end
......
......@@ -36,8 +36,7 @@ module Hbc
elsif @options[:versions]
puts format_versioned(cask)
else
installed_caskfile = cask.metadata_master_container_path.join(*cask.timestamped_versions.last, "Casks", "#{cask_token}.rb")
cask = Hbc.load(installed_caskfile)
cask = CaskLoader.load_from_file(cask.installed_caskfile)
list_artifacts(cask)
end
......
......@@ -17,16 +17,10 @@ module Hbc
if cask.installed?
# use copy of cask for uninstallation to avoid 'No such file or directory' bug
installed_cask = cask
latest_installed_version = installed_cask.timestamped_versions.last
unless latest_installed_version.nil?
latest_installed_cask_file = installed_cask.metadata_master_container_path
.join(latest_installed_version
.join(File::Separator),
"Casks", "#{cask_token}.rb")
# use the same cask file that was used for installation, if possible
installed_cask = CaskLoader.load_from_file(latest_installed_cask_file) if latest_installed_cask_file.exist?
# use the same cask file that was used for installation, if possible
if (installed_caskfile = installed_cask.installed_caskfile).exist?
installed_cask = CaskLoader.load_from_file(installed_caskfile)
end
# Always force uninstallation, ignore method parameter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment