Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Change brew linkapps to use the global /Applications folder #22378

Closed
wants to merge 7 commits into from

Conversation

ELLIOTTCABLE
Copy link
Contributor

(As per @adamv's request, re-requesting this pull, here. I'll keep this rebased as necessary as the discussion continues.)

This has been heavily discussed elsewhere. I'll simply re-list the reasons for this change, here:

  • Less surprising to everyday users
  • Unlike other ‘global’ directories, won't munge up the system, as it's a ‘global’ directory that everyday users generally modify

In addition, of some relevance, it seems that ~/Applications doesn't even exist by default in Mavericks, which suggests to me that Apple has realized that very few people have any use for it, and has concluded that it does very little except cause user-confusion amongst those who don't know how/why to create it. That seems in-line with the argument I've been making.

Also, it seems to be the majority request, here. At an informal reading of #8699 and #17643 (and please, forgive me, or let me know, if I mis-read your intentions, posters), the following are for the global /Applications being the default, with the user-~/Applications being an optional flag: @hced, @dysinger, @zhouyan, @mxcl, @thecontrarian, @iainbeeston, @demure, and @vilhalmer. As far as I can tell, the only person categorically against it, is @adamv. )'=

Other relevant Issues / Pull Requests: #12619, #18196.

Further commentary welcome. Also, if any of my changes to the code are unacceptable, please let me know; CONTRIBUTING.md was rather unhelpful to someone modifying Homebrew itself, ironically. (=


(I'll be forthcoming with additional patches, not dependent on this one, that respectively add documentation of this feature, since there seems to be none [#22380]; and another controversial one wherein I suggest that we move apps, not symlink them, into whichever folder we decide upon here [#22379].)

TARGET_DIR = ARGV.include?("--system") ? "/Applications" : File.expand_path("~/Applications")

unless File.exist? TARGET_DIR
opoo "#{TARGET_DIR} does not exist, stopping."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a local link, this existence check still needs to be done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix that up and push a new commit.

@ELLIOTTCABLE
Copy link
Contributor Author

I'm going to push the commit(s) from #22380 here, and leave some time for them to be reviewed in-full; then I'll squash and rebase on top of the latest master after a sign-off from one of you maintainers, so it's a one-click merge.

On Mavericks we need to explicitly include AvailabilityMacros.h to have
the version detection macros defined.

Fix 10.9 ruby framework detection and compilation

Mavericks ships with version 1.8 and 2.0 of the Ruby.framework, so we
must directly link the framework version matching the ruby-command.

This also means that ruby.h must no longer included via the framework
name, which has the nice side effect of allowing you to compile with
non-framework rubies, if you remove the formula's hardcoded RUBY_PATH.
@adamv
Copy link
Contributor

adamv commented Sep 10, 2013

@BrewTestBot test this please

@ghost ghost assigned adamv Sep 10, 2013
@adamv
Copy link
Contributor

adamv commented Sep 12, 2013

Looks fine; go ahead and add another commit that moves this from contributions to the main cmd folder too.

@ELLIOTTCABLE
Copy link
Contributor Author

@adamv is there any other changes necessary in the codebase to support that? I'm not familiar with how these are loaded. Is it entirely dynamic (i.e. just a git mv)?

I've pushed that change, let me know if I missed something.

Edit: Yeah, there's clearly more required. Maybe it's better than somebody else make this change, as I'm fairly swamped (unless it's something simple that I'm missing here):

> brew linkapps
Linking /usr/local/Cellar/macvim/7.4-71/MacVim.app
Error: /Applications/MacVim.app already exists, skipping.
Linking /usr/local/Cellar/python/2.7.5/Build Applet.app
Linking /usr/local/Cellar/python/2.7.5/IDLE.app
Linking /usr/local/Cellar/python/2.7.5/Python Launcher.app
Finished linking. Find the links under /Applications.
Error: undefined method `linkapps' for Homebrew:Module
Please report this bug:
    https://github.com/mxcl/homebrew/wiki/troubleshooting
/usr/local/Library/brew.rb:95:in `send'
/usr/local/Library/brew.rb:95

@adamv
Copy link
Contributor

adamv commented Sep 13, 2013

Ah, right, there's a difference in form. If you squash the original 4 commits into 1 or 2 commits, I can pull those then move it myself.

Otherwise, look at the files in Homebrew/cmd for the method naming convention.

@ELLIOTTCABLE
Copy link
Contributor Author

Okay, @adamv. I've rebased everything on top of the current master, and then squashed the relevant commits into a single one for you to cherry-pick:

ELLIOTTCABLE/homebrew@a4273ae

@adamv adamv closed this in 53d75d1 Sep 17, 2013
handyman5 pushed a commit to handyman5/homebrew that referenced this pull request Oct 7, 2013
Also adds support for a new `--local` flag, and documentation for the whole command.

Closes Homebrew#22378.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants