claui / homebrew-textmate

External Homebrew command and repo for TextMate bundles
14 stars 5 forks source link

Dealing with a TextMate-managed bundle that is already installed #4

Open claui opened 7 years ago

claui commented 7 years ago

Steps to reproduce

To reproduce this issue, follow these steps:

Preparation

  1. In TextMate, go to Preferences » Bundles.

  2. Ensure the Apache bundle is installed (i. e. the box is ticked):

image

  1. Tap into the with-managed-bundles branch temporarily. To do so, paste the following block into your Terminal, including the parentheses:
(
  set -ex
  brew untap claui/textmate
  brew tap --full claui/textmate
  cd $(brew --prefix)/Homebrew/Library/Taps/claui/homebrew-textmate
  git checkout with-managed-bundles
)
  1. Confirm that the repo now contains an tm-apache bundle:
$ brew tm search apache
==> Exact Match
tm-apache

Installing

  1. Run brew tm install apache and check the outcome.

Cleaning up

  1. After you have checked the result, run brew tm uninstall apache to uninstall. (This step can be skipped as soon as this issue is fixed.)

  2. Reset your tap to a clean state:

brew untap claui/textmate && brew tap claui/textmate
  1. Optionally, go to TextMate » Preferences » Bundles and untick the box to uninstall the TextMate-managed Apache bundle.

Expected behavior

I suggest that brew tm install should detect that a TextMate-managed bundle by the same UUID is already installed.

Approach 1: Just print a warning and carry on

One possible solution would be that brew tm install print a warning like this:

==> Installing Cask tm-apache Warning: This TextMate bundle will shadow another bundle already managed by TextMate. ==> Moving TextMate bundle 'apache.tmbundle- […]

but I’d not be satisfied with that as a user because the warning is not even actionable.

Approach 2: Auto-uninstall TextMate-managed bundle

What I’d prefer to have is that brew tm install automatically uninstall the TextMate-managed version:

==> Installing Cask tm-apache ==> Uninstalling bundle managed by TextMate ==> Moving TextMate bundle 'apache.tmbundle- […]

In particular, brew tm install should also untick the box in TextMate » Preferences » Bundles when it’s done removing the TextMate-managed bundle:

image

I’m still not really satisfied with this solution though. The user might still get confused as Preferences » Bundles still shows no signs of the bundles installed via brew tm.

Approach 3: Fully integrate brew-managed bundles in the Preferences » Bundles view

This approach would mean an integrated Preferences » Bundles view that would show all bundles that are installed by brew tm, in addition to those managed or installable by TextMate.

Implementing this might get hairy, and I’m not even sure if it’s technically even possible. From a user’s point of view, it might be one of the less confusing alternatives.

Actual behavior

The installation simply goes through. The managed bundle remains installed, and will be shadowed by the tm-apache bundle. TextMate seems to grant priority to the tm-apache bundle because it is not managed by TextMate. brew tm install is not aware of the conflict, and thus makes no attempt to inform the user of the situation.

==> Installing Cask tm-apache ==> Moving TextMate bundle 'apache.tmbundle- […]

Impact

This behavior poses a UX issue: the box in Preferences » Bundles is still ticked; however, the version managed by TextMate is actually inactive because it has been shadowed by the brew tm installed one.

Functionality is not affected.

Note that the issue has always existed; it also happens if you download Apache.tmbundle from GitHub and double-click it manually. I still wonder whether the user’s expectation is going to change when brew tm is brought into the game, and whether we should do something about it.

Discussion

Any thoughts?