exogenesis icon indicating copy to clipboard operation
exogenesis copied to clipboard

Should `update` remove things that are not marked to be installed anymore?

Open moonglum opened this issue 11 years ago • 4 comments

@bitboxer asked:

In the Font and Dotfiles classes, what do we do with the update task? I think it should do the same as the install task to make it actually possible to add the new fonts. But I need to remember what fonts I have installed to check if the font directory had changes and remove the now missing fonts from the ~/Library/Fonts . Where do I store that?

This question is in my opinion way broader. Let's take Homebrew as an example: If the user decides to remove one of the brews from his list, should the update task now remove this brew? I'm not really sure about that. It is not trivial to detect (just comparing the installed brews and the brews that should be installed doesn't do the trick because of dependencies) – and for other tasks it is almost impossible (Font comes to mind).

For Font the question has another facet: If you teardown Font, what should happen? Should it remove all fonts it knows? Because it can't detect which fonts it installed by just looking at the files.

I think this question needs some thought, and I guess until we found a solution, update should not remove brews, fonts, rubies or anything else.

moonglum avatar Mar 19 '13 10:03 moonglum

I think there should be a exo diff command in the future. It compares the installed packages with the packages from the configuration file.

  • Homebrew: brew leaves gives a list of all leaves in the dependency tree. This should be compared to the brews.
  • Dotfile: ls -a ~ | grep '^\.’ (not sure if that’s helpful)
  • Fonts: I don’t know
  • Git Repo: Impossible.
  • Python Eggs, Ruby Gems, NPM Packages: Not sure if that makes sense.
    • NPM: npm ls -g --depth=0 or even with the --json option (because the —parseable option is broken)
    • Ruby Gems: Only top level? Not sure.
    • Python: Only top level? Not sure.
  • rbenv: rbenv versions and filter those with a star
  • RVM: rvm list rubies
  • Vundle: I think that’s not necessary?

I think we should implement the diff method for those managers for which it makes sense. It should never remove packages automatically though IMHO. This should be done in the next milestone though. Moving it now.

moonglum avatar Feb 14 '14 10:02 moonglum

If you can detect which NPM Package/Gem has an executable installed, it would make sense to show them. But listing all NPMs/Gems is not very helpful.

bitboxer avatar Feb 14 '14 10:02 bitboxer

Btw: the rbenv version marked with a star is the current used one.

bitboxer avatar Feb 14 '14 10:02 bitboxer

For npm bin files:

  1. npm -g bin returns the bin dir where the executables are installed
  2. List that directory and get the link targets of the symbolic links
  3. Parse the package out of that directory name, eg ../lib/node_modules/bower/bin/bower is in the bower package

Could be little fragile but worth a shot.

bitboxer avatar Feb 14 '14 13:02 bitboxer