diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 31f5c52ce2c56..03a97f56462fa 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,5 +1,26 @@ # CHANGELOG +## 0.34.0 + +* __Casks__ + - 19 Casks added (42 updated) by 39 contributors since 0.33.1 + - 1460 total Casks +* __Features__ + - [#2427][] Give the user help on checksum errors + - [#4169][] automatically transition to new Tap name/location + - [#4163][] update all references to new caskroom org home +* __Fixes__ + - none +* __Documentation__ + - none +* __Breaking Changes__ + - The repository has moved under the Caskroom organization. We expect this to + be a seamless transition for users. + +[#2427]: https://github.com/caskroom/homebrew-cask/issues/2427 +[#4169]: https://github.com/caskroom/homebrew-cask/issues/4169 +[#4163]: https://github.com/caskroom/homebrew-cask/issues/4163 + ## 0.33.1 * __Casks__ diff --git a/doc/man/brew-cask.1 b/doc/man/brew-cask.1 index 60b4f579373c4..d87e85538f18a 100644 --- a/doc/man/brew-cask.1 +++ b/doc/man/brew-cask.1 @@ -26,6 +26,10 @@ Install \fICask\fR\. Uninstall \fICask\fR\. . .TP +\fBreinstall\fR \fICask\fR +Reinstall \fICask\fR\. +. +.TP \fBsearch\fR \fItext\fR | /\fIregexp\fR/ Perform a substring search of Cask names for \fItext\fR\. If the text is delimited by slashes, it is interpreted as a Ruby regular expression\. . diff --git a/doc/src/brew-cask.1.md b/doc/src/brew-cask.1.md index 93a1cdc5232d2..21c7401ea294e 100644 --- a/doc/src/brew-cask.1.md +++ b/doc/src/brew-cask.1.md @@ -84,6 +84,9 @@ names, and other aspects of this manual are still subject to change. * `uninstall` or `rm` or `remove` : Uninstall . + * `reinstall` : + Reinstall . + * `search` or `-S`: Display all Casks available for install. diff --git a/lib/cask/cli.rb b/lib/cask/cli.rb index 8cbcdec4b0635..1345118e7ce70 100644 --- a/lib/cask/cli.rb +++ b/lib/cask/cli.rb @@ -15,6 +15,7 @@ class Cask::CLI; end require 'cask/cli/info' require 'cask/cli/install' require 'cask/cli/list' +require 'cask/cli/reinstall' require 'cask/cli/search' require 'cask/cli/uninstall' require 'cask/cli/update' diff --git a/lib/cask/cli/reinstall.rb b/lib/cask/cli/reinstall.rb new file mode 100644 index 0000000000000..eb7e83b271f6d --- /dev/null +++ b/lib/cask/cli/reinstall.rb @@ -0,0 +1,30 @@ +class Cask::CLI::Reinstall + def self.run(*args) + raise CaskUnspecifiedError if args.empty? + cask_names = args.reject { |a| a.chars.first == '-' } + force = args.include? '--force' + cask_names.each do |cask_name| + odebug "Reinstalling Cask #{cask_name}" + cask = Cask.load(cask_name) + begin + if cask + Cask::Installer.new(cask).uninstall + end + Cask::Installer.new(cask).install(force) + rescue CaskUnavailableError => e + exact_match, partial_matches, search_term = Cask::CLI::Search.search(cask_name) + errmsg = "#{cask_name}" + if exact_match + errmsg.concat(". Did you mean:\n#{exact_match}") + elsif !partial_matches.empty? + errmsg.concat(". Did you mean one of:\n#{stringify_columns(partial_matches.take(20))}\n") + end + raise CaskUnavailableError.new(errmsg) + end + end + end + + def self.help + "reinstalls the cask of the given name" + end +end diff --git a/lib/cask/version.rb b/lib/cask/version.rb index 9ea99c26e4001..0c92d3312c588 100644 --- a/lib/cask/version.rb +++ b/lib/cask/version.rb @@ -1 +1 @@ -HOMEBREW_CASK_VERSION = '0.33.1' +HOMEBREW_CASK_VERSION = '0.34.0'