* Avoid parallel assignment.
* Use Pathname#size instead of File#size
* Use Pathname#directory? instead of File#directory?
* Use basename to check `.DS_Store`. Original regex has poor
performance, and may match with incorrect file.
A hyphen is not a valid character in a Ruby symbol, and the bottle
tag should be a valid Ruby symbol for its use in the bottle stanza.
ClosesHomebrew/homebrew#38235.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Change [a-z_]+(32)? to [-a-z0-9_]+
The Linuxbrew bottle tag is x86_64-linux.
ClosesHomebrew/homebrew#32687.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Currently, when called with one argument, dst is set to self, i.e. the
directory into which the source file should be moved.
When called with a second argument (for renames), dst is the full path,
including the basename, to the moved file.
Instead, let's always pass the full path, which means we can remove the
branching logic around computing dst.
As we know, files cannot be moved across filesystems atomically. In that
case, FileUtils.mv will make a copy. But if we create the temp file in
the same directory as the target, we can avoid this and use File.rename
directly.
Additionally, the rename should be the absolute last step, so that the
original file is preserved if altering ownership and permissions fails.
We need to install the helper module not just on `etc` but also on all
subdirectories of it too. Also, handle the case where we install
a subdirectory with etc.install.
ClosesHomebrew/homebrew#26145.
As far as I can tell these methods have only ever been used in the test
suite.
Since Formula includes FileUtils, it is generally simpler (and in the
case of cp, more readable) to use the FileUtils methods directly.
ClosesHomebrew/homebrew#30081.
Ruby 2.2 will define Pathname#/ as a simple alias of Pathname#+.
In practice, this means that it will raise a TypeError unless the
argument responds to to_path or to_str.
Currently we blindly convert the argument to a string using to_s, so
deprecate this in the interest of matching the upstream behavior. In the
future we can replace this with
alias_method :/, :+ unless method_defined?(:/)
ClosesHomebrew/homebrew#30079.
Pathname#inspect on Ruby 2.0 throws away the encoding of the object's
underlying string and returns a string tagged as ASCII-8BIT.
If you simply write
puts Pathname.new("some string with non-ascii bytes").inspect
no error will be raised, because the implementation of Pathname#inspect
does not call into Object#inspect.
However, if you wrap that pathname object in an array first, then
puts [Pathname.new("some string with non-ascii bytes")].inspect
will raise Encoding::CompatibilityError: "inspected result must be ASCII
only or use the same encoding with default external".
Raising an error in this codepath is new in Ruby 2.0, and this specific
bug is fixed in Ruby 2.1. I've opened a bug upstream:
https://bugs.ruby-lang.org/issues/9915FixesHomebrew/homebrew#29947.