316 Commits

Author SHA1 Message Date
Xu Cheng
028d155e97 Pathname#version: only parse version from file basename
i.e. Ignoring the file's directory for version parsing.

Closes Homebrew/homebrew#50568.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-03-31 17:10:22 +08:00
Xu Cheng
bd7e8543b3 deprecate SHA1 2016-03-20 14:55:58 +08:00
Mike McQuaid
0578ba0f42 install_renamed: handle recursive installs.
Closes Homebrew/homebrew#49845.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-08 13:47:29 +08:00
Dominyk Tiller
ff4d16deeb pathname: add append_lines method
* Blocks writing of new files via accidental typos, etc, which the normal open("blah", "a") doesn't.
* Where files don't exist they should ideally be using `(buildpath/"dog").write` instead of open("blah", "a") already.
* It's a bit less cluttered looking if you need several writes to different files in the formula, IMO.
2016-02-21 04:22:23 +00:00
Dominyk Tiller
abd4c699d1 pathname: remove redundant spacing 2016-01-03 19:08:10 +00:00
Dominyk Tiller
7e7838b5ba pathname: become less introspective
These self references are unnecessary.
2016-01-03 19:07:55 +00:00
Mike McQuaid
0bca7ad9c3 pathname: don't try to calculate symlink size.
Closes https://github.com/Homebrew/homebrew/issues/47532
Closes https://github.com/Homebrew/homebrew-dupes/issues/542
2015-12-30 19:46:23 +00:00
Xu Cheng
24224dc896 pathname: improve compute_disk_usage
* 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.
2015-12-30 16:27:15 +08:00
Mike McQuaid
482481d24c pathname: fix use of find on Ruby 1.8. 2015-12-30 08:23:57 +00:00
Rakesh
e4f2a1e0ef pathname: store file count and disk usage.
especially for directory instances of `Pathname` class and all
instances of `Keg` class.
2015-12-30 08:11:23 +00:00
Xu Cheng
d108bf0a55 move more deprecated methods to compat folder 2015-11-17 18:52:00 +08:00
Xu Cheng
646f94adfe move mach.rb to os/mac/mach.rb 2015-10-18 22:57:42 +08:00
Xu Cheng
235c5b6bfa ObserverPathnameExtension: only puts first 100 operations
Fixes https://github.com/Homebrew/homebrew/issues/44320#issuecomment-143951973

Closes Homebrew/homebrew#44440.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-08 16:12:01 +08:00
Mike McQuaid
2c959a7d58 More API documentation.
And remove the documented stuff from the `example-formula.rb`.

Closes Homebrew/homebrew#43241.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-29 15:43:16 +01:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
fd7f3b9496 Pathname#abv: handle the case du returns empty string
This can happen when read permission is denied.

Fixes Homebrew/homebrew#41925.

Closes Homebrew/homebrew#42011.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-22 20:35:01 +08:00
Xu Cheng
f2d0a88292 remove Pathname#find_formula
Closes Homebrew/homebrew#40486.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-11 15:28:30 +08:00
Xu Cheng
31ca2831f3 Revert "Pathname#version: support bottle version"
This reverts commit 02fba8ce25f1e34c981cb30197e2b4711f88b266.
2015-06-07 23:51:15 +08:00
Xu Cheng
ef7eb0750c Pathname#version: support bottle version
Closes Homebrew/homebrew#40365.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-04 20:05:43 +08:00
Misty De Meo
8fe0b56810 Add support for extracting LHA archives 2015-04-26 11:11:56 -07:00
Dominyk Tiller
2fa87369b3 pathname: prune unnecessary whitespace
Closes Homebrew/homebrew#38413.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-04-07 18:32:29 +01:00
Shaun Jackman
6ca42964cb pathname: remove hyphen from BOTTLE_EXTNAME_RX
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.

Closes Homebrew/homebrew#38235.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-03-31 18:53:26 +01:00
Shaun Jackman
1ad0de8660 pathname: Add [-0-9] to BOTTLE_EXTNAME_RX
Change [a-z_]+(32)? to [-a-z0-9_]+
The Linuxbrew bottle tag is x86_64-linux.

Closes Homebrew/homebrew#32687.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-03-31 15:07:46 +01:00
Jack Nagel
96f7a8015f Pass around only pathname objects 2015-03-26 22:22:45 -04:00
Jack Nagel
3721e0be6f Always yield a path from install_p extension 2015-03-26 22:22:45 -04:00
Jack Nagel
380b8ce46d Combine assignments 2015-03-25 20:26:04 -04:00
Jack Nagel
1351f67e91 Make install_p and install_symlink_p private 2015-03-24 21:08:12 -04:00
Jack Nagel
ab3d622da2 Always pass basename to install_symlink_p 2015-03-24 21:06:19 -04:00
Jack Nagel
6f0efd6f3d Always pass basename to install_p
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.
2015-03-24 21:03:45 -04:00
Jack Nagel
86006ba36b Go through regular logic when installing a file 2015-03-23 21:01:50 -04:00
Xu Cheng
144453368e test-bot pathname: use Utils.popen_read instead of backticks
Closes Homebrew/homebrew#37418.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-03-06 22:19:24 +08:00
Xu Cheng
328fa80f41 pathname: skip directory in env_script_all_files
Closes Homebrew/homebrew#37180.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-02-25 20:17:22 +08:00
Jack Nagel
120bd43f87 Buffer 16K at a time 2015-01-05 10:45:05 -05:00
Jack Nagel
1a69ceaf7e Recognize rpm file magic 2014-12-09 01:22:55 -05:00
Jack Nagel
0578f1ff5a Pull initialization code out of begin block 2014-11-09 18:17:10 -06:00
Jack Nagel
2d16f8c202 Make Pathname#atomic_write truly atomic
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.
2014-09-20 17:11:16 -05:00
Mike McQuaid
58cb4444da etc.install: handle recursive directory installs.
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.

Closes Homebrew/homebrew#26145.
2014-08-26 08:30:47 +01:00
Adam Vandenberg
fbee511eba Pathname.binread 2014-07-29 07:25:27 -07:00
Adam Vandenberg
5af3d319d6 backport binwrite from Ruby 2.1+ 2014-07-27 16:21:35 -07:00
Adam Vandenberg
8e96ce0aa5 Rename write_binary to binwrite 2014-07-27 15:30:46 -07:00
Adam Vandenberg
10e5fea01d add Pathname.write_binary 2014-07-27 11:14:51 -07:00
Adam Vandenberg
12fe7e2771 nudge formatting
Needed for Emacs' ruby highlighting to work past this point in the file.
2014-07-13 12:04:45 -07:00
Jack Nagel
c259866517 Raise Errno::ENOENT instead of RuntimeError from Pathname#install 2014-07-10 22:00:43 -05:00
Jack Nagel
284389a6bd Make comment in Pathname#install more accurate 2014-07-10 15:39:55 -05:00
Jack Nagel
cf4080a9e0 Remove a RUBY_VERSION check, add a FIXME comment 2014-07-05 16:01:09 -05:00
Jack Nagel
c73baa39cb Add explicit mkpath to Pathname#write_env_script 2014-06-17 21:51:45 -05:00
Jack Nagel
5cbc5437f5 Add explicit mkpath to Pathname#write_jar_script 2014-06-17 21:51:45 -05:00
Jack Nagel
d96f15e324 Add explicit mkpath to Pathname#write_exec_script 2014-06-17 21:51:45 -05:00
Jack Nagel
b2c42fc63c Make signature of Pathname#write compatible with Ruby 2.1+ 2014-06-17 12:14:51 -05:00
Jack Nagel
96195295a3 Deprecate Pathname#cp and Pathname#chmod_R
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.

Closes Homebrew/homebrew#30081.
2014-06-12 09:00:58 -05:00