aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua McKinney2017-03-18 18:57:04 -0500
committerJoshua McKinney2017-03-19 13:14:16 -0500
commit3703ef1885ba4afce1ed4ae531dcb7ddc573b3c2 (patch)
treef1aa60a112cfc5aaf637dc1f558e20f9c3e6724a
parent367fdb971839c0b3686ca23a6de76da75cc80580 (diff)
downloadbrew-3703ef1885ba4afce1ed4ae531dcb7ddc573b3c2.tar.bz2
Show messages when (un)installing Casks
Addresses an issue where it can be unclear at times exactly which part of the (un|re)installation processes is reporting an error. See https://github.com/caskroom/homebrew-cask/issues/30968
-rw-r--r--Library/Homebrew/cask/lib/hbc/installer.rb4
-rw-r--r--Library/Homebrew/test/cask/cli/install_spec.rb14
-rw-r--r--Library/Homebrew/test/cask/cli/reinstall_spec.rb23
-rw-r--r--Library/Homebrew/test/cask/cli/uninstall_spec.rb17
4 files changed, 57 insertions, 1 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb
index 6f6957574..69113e9fc 100644
--- a/Library/Homebrew/cask/lib/hbc/installer.rb
+++ b/Library/Homebrew/cask/lib/hbc/installer.rb
@@ -85,6 +85,8 @@ module Hbc
print_caveats
fetch
uninstall_if_neccessary
+
+ oh1 "Installing Cask #{@cask}"
stage
install_artifacts
enable_accessibility_access
@@ -322,7 +324,7 @@ module Hbc
end
def uninstall
- odebug "Hbc::Installer#uninstall"
+ oh1 "Uninstalling Cask #{@cask}"
disable_accessibility_access
uninstall_artifacts
purge_versioned_files
diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb
index 5a40017e8..fef0b2824 100644
--- a/Library/Homebrew/test/cask/cli/install_spec.rb
+++ b/Library/Homebrew/test/cask/cli/install_spec.rb
@@ -1,4 +1,18 @@
describe Hbc::CLI::Install, :cask do
+ it "displays the installation progress" do
+ output = Regexp.new <<-EOS.undent
+ ==> Downloading file:.*/caffeine.zip
+ ==> Verifying checksum for Cask local-caffeine
+ ==> Installing Cask local-caffeine
+ ==> Moving App 'Caffeine.app' to '.*/Caffeine.app'.
+ 🍺 local-caffeine was successfully installed!
+ EOS
+
+ expect {
+ Hbc::CLI::Install.run("local-caffeine")
+ }.to output(output).to_stdout
+ end
+
it "allows staging and activation of multiple Casks at once" do
shutup do
Hbc::CLI::Install.run("local-transmission", "local-caffeine")
diff --git a/Library/Homebrew/test/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb
index e573a3470..7f3c60bc4 100644
--- a/Library/Homebrew/test/cask/cli/reinstall_spec.rb
+++ b/Library/Homebrew/test/cask/cli/reinstall_spec.rb
@@ -1,4 +1,27 @@
describe Hbc::CLI::Reinstall, :cask do
+ it "displays the reinstallation progress" do
+ caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
+
+ shutup do
+ Hbc::Installer.new(caffeine).install
+ end
+
+ output = Regexp.new <<-EOS.undent
+ ==> Downloading file:.*/caffeine.zip
+ Already downloaded: .*/local-caffeine--1.2.3.zip
+ ==> Verifying checksum for Cask local-caffeine
+ ==> Uninstalling Cask local-caffeine
+ ==> Removing App '.*/Caffeine.app'.
+ ==> Installing Cask local-caffeine
+ ==> Moving App 'Caffeine.app' to '.*/Caffeine.app'.
+ 🍺 local-caffeine was successfully installed!
+ EOS
+
+ expect {
+ Hbc::CLI::Reinstall.run("local-caffeine")
+ }.to output(output).to_stdout
+ end
+
it "allows reinstalling a Cask" do
shutup do
Hbc::CLI::Install.run("local-transmission")
diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb
index fb196ee72..714e652c7 100644
--- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb
+++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb
@@ -1,4 +1,21 @@
describe Hbc::CLI::Uninstall, :cask do
+ it "displays the uninstallation progress" do
+ caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
+
+ shutup do
+ Hbc::Installer.new(caffeine).install
+ end
+
+ output = Regexp.new <<-EOS.undent
+ ==> Uninstalling Cask local-caffeine
+ ==> Removing App '.*/Caffeine.app'.
+ EOS
+
+ expect {
+ Hbc::CLI::Uninstall.run("local-caffeine")
+ }.to output(output).to_stdout
+ end
+
it "shows an error when a bad Cask is provided" do
expect {
Hbc::CLI::Uninstall.run("notacask")