152 Commits

Author SHA1 Message Date
Xu Cheng
3f601e0e7f keg: mkpath for fish related directories
Fixes Homebrew/homebrew#41742.

Closes Homebrew/homebrew#41849.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-18 16:48:41 +08:00
Johannes Wienke
de43ac7503 Add support for fish shell completions
* Library/Homebrew/caveats.rb: add caveats comparable to other shells
* Library/Homebrew/formula.rb: define completion directory along the
  conventions explained in the fish documentation for
  $fish_complete_path
* Library/Homebrew/keg.rb: add fish shell to check function for
  installed completions

Closes Homebrew/homebrew#39828.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-06-02 10:09:10 +01:00
Xu Cheng
c14794baa8 keg: add rack method 2015-05-27 13:53:41 +08:00
Ben Morgan
1795599d88 keg: explicitly create cmake dir under lib
Packages supporting CMake may install configuration files for use
with CMake's find_package command. A recommended location for these
is `<prefix>/lib/cmake` which is not unique across packages. This
may cause issues for Formula using this location when their Keg
is linked.

As with pkg-config, explicitly create the `lib/cmake` folder when
linking a Keg that has installed folders/files to this location.

Also add testcase.

Closes Homebrew/homebrew#38005.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-03-29 22:01:21 +08:00
Jack Nagel
0a41cbcd9c Always create real directories under lib/ruby
Fixes Homebrew/homebrew#37685.
Closes Homebrew/homebrew#37704.
2015-03-15 23:23:14 -04:00
Jack Nagel
dd90030213 Fix "possible reference to past scope" warnings on 2.2 2014-12-26 11:58:09 -05:00
Baptiste Fontaine
278b77e6c5 Quote path in conflict error rm command
Fixes Homebrew/homebrew#35143.
Closes Homebrew/homebrew#35239.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-12-24 12:16:16 -05:00
Tim D. Smith
daabf4f5dc keg: add python_pth_files_installed? helper 2014-11-02 10:33:34 -08:00
Jack Nagel
044393641e Less code in begin block 2014-10-20 17:07:54 -05:00
Jack Nagel
55e0f40d02 Handle broken symlinks in resolve_any_conflicts
Fixes Homebrew/homebrew#33328.
2014-10-20 17:07:54 -05:00
Jack Nagel
05ba3f0e34 Return early from resolve_any_conflicts for non-symlinks 2014-10-20 17:07:53 -05:00
Jack Nagel
4fd78c9690 Provide more information about link errors
References Homebrew/homebrew#32046.
2014-09-09 14:26:36 -05:00
Jack Nagel
3451c2d67f Handle nonexistent files when constructing ConflictError
Closes Homebrew/homebrew#31051.
2014-07-30 16:29:10 -05:00
Jack Nagel
8076f3340a Fix typo 2014-07-12 20:15:57 -05:00
Jack Nagel
1eafe3bc35 Handle conflicts where links point at symlinks
Fixes Homebrew/homebrew#30664.
2014-07-12 19:56:58 -05:00
Jack Nagel
7b26c885bd Always link symlinks directly 2014-07-12 19:56:58 -05:00
Jack Nagel
84372e570e Use a regular conditional instead of next unless ... 2014-07-04 19:40:18 -05:00
Jack Nagel
810b5838b2 Simpler "use the correct symlink" checks
When determining whether to remove a symlink during unlinking, we check
three things:

  (a) Is the destination a symlink?
  (b) Does the destination exist?
  (c) Does the destination resolve to the source path?

However, since we know that the source path exists, (b) is guaranteed if
(a) and (c) are true. Thus checking (b) is unnecessary.

Similarly, when creating a new symlink during linking, we first check to
see if the link already exists by checking the same three criteria.
Again, checking (b) is unnecessary here.

See also the expanded test coverage in b52b579b.

Addendum: although we know that the source path exists during unlinking,
it doesn't matter. If the source path does not exist, then we still know
we have a broken symlink pointing into the keg we are unlinking, and
removing that symlink is still safe.
2014-07-04 17:46:52 -05:00
Jack Nagel
07e00061a7 Pass relative paths into link exceptions 2014-07-02 10:48:18 -05:00
Jack Nagel
c2228c0d0f Remove default argument from make_relative_symlink
All callers of this method now pass a mode object.
2014-06-30 22:14:18 -05:00
Jack Nagel
4ea3997d9c Pass the mode through the optlink method 2014-06-30 22:14:09 -05:00
Jack Nagel
548d66be59 Simplify optlink method
delete/unlink on a directory is the same operation as rmdir.
2014-06-30 22:14:07 -05:00
Jack Nagel
d792b64655 Add methods for manipulating the opt record 2014-06-30 20:31:13 -05:00
Jack Nagel
0744ed9410 Store the opt record so we don't have to keep reconstructing it 2014-06-30 20:30:50 -05:00
Jack Nagel
30e273c2d1 Group methods that operate on the linked keg record 2014-06-30 20:30:02 -05:00
Jack Nagel
58e5ac6835 Implement directory? on keg
Fixes Homebrew/homebrew#30484.
2014-06-28 19:43:52 -05:00
Jack Nagel
982a165e52 Use the keg object to manipulate the linked keg record 2014-06-27 16:20:17 -05:00
Jack Nagel
c5fcdb1f21 Convert to pathname before calling relative_path_from
Fixes Homebrew/homebrew#30494.
2014-06-27 14:45:20 -05:00
Jack Nagel
de81350b42 Keg no longer inherits from Pathname 2014-06-26 20:07:11 -05:00
Jack Nagel
62b29e7686 Give Keg#link_dir parameter a more descriptive name 2014-06-26 18:49:08 -05:00
Jack Nagel
64d5aef0bc Fix keg method visibility
Only link_dir needs to be protected
2014-06-26 18:45:34 -05:00
Jack Nagel
2f2f9f185f Deprecate Keg#fname 2014-06-26 16:10:15 -05:00
Jack Nagel
3d69e5ab7b Rename Keg#fname to Keg#name 2014-06-24 19:09:09 -05:00
Jack Nagel
b98f7277a4 Keg#unlink only removes a linked keg entry *for that keg* 2014-06-23 22:55:23 -05:00
Jack Nagel
cf19ccb436 The linked keg entry is foremost a symlink 2014-06-23 22:55:23 -05:00
Jack Nagel
892e763b0b Initialize linked_keg_record in the Keg constructor 2014-06-23 22:55:23 -05:00
Jack Nagel
76e86891e4 Remove opt link in Keg#uninstall 2014-06-23 22:34:41 -05:00
Jack Nagel
bcfc9d8cf7 Remove linked kegs directory when empty 2014-06-23 22:34:41 -05:00
Jack Nagel
e3f082c294 Stop joining symbols to pathnames
Ruby 2.2's native Pathname#/ accepts only string-like objects.
2014-06-09 14:57:21 -05:00
Jack Nagel
c6c7623591 Prefer Dir[] to Dir.glob when not passing a block 2014-05-30 12:41:12 -05:00
Jack Nagel
6b5e92ac47 Raise AlreadyLinkedError when a keg is already linked 2014-04-21 12:43:06 -05:00
Jack Nagel
b2e8c4e79a Only unlink after a LinkError 2014-04-21 12:43:06 -05:00
Jack Nagel
727f204760 Raise useful errors from make_relative_symlink 2014-04-21 12:43:06 -05:00
Jack Nagel
d3ab439b7c Rework make_relative_symlink error handling and move it into keg 2014-04-21 12:43:06 -05:00
Jack Nagel
90574a6a4b Drop conditional that is always false 2014-04-06 14:01:06 -05:00
Jack Nagel
8c88d48af7 More correct "symlink already exists" check 2014-04-05 12:17:19 -05:00
Jack Nagel
ce1f598e98 Avoid realpath where it is not necessary
Symlinks in opt and LinkedKegs point directly at a keg in the cellar, so
only resolving one symlink should suffice, and make it clear what path
we are actually interested in.
2014-04-05 12:17:19 -05:00
Jack Nagel
d88c79f3cf Use resolved_path instead of dirname and readlink directly 2014-03-31 22:39:41 -05:00
Jack Nagel
b29be4c9a5 Remove default value from Keg#link_dir mode parameter
Now that this is always called with an explicit mode argument, let's
make sure it stays that way.
2014-03-31 21:33:37 -05:00
Jack Nagel
75af625c17 Pass the link mode to resolve_any_conflicts 2014-03-31 21:33:37 -05:00