diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cask.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/list.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/reinstall.rb | 12 | 
3 files changed, 9 insertions, 11 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 975d69d07..8b39bdfd5 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -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 diff --git a/Library/Homebrew/cask/lib/hbc/cli/list.rb b/Library/Homebrew/cask/lib/hbc/cli/list.rb index 5d7a58b93..51ca5dabe 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/list.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/list.rb @@ -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 diff --git a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb index 30d9b694c..c101c9235 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/reinstall.rb @@ -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  | 
