aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2016-09-24 21:42:02 +0100
committerGitHub2016-09-24 21:42:02 +0100
commit817bc2746e594761911edd78f743a640f089494f (patch)
tree87cf3404341853a6794b6d489e90d6704e80535f
parent96b1e232e9fd78a5f9f5507905f7fd22770d8b9a (diff)
parente767fd3df9d179fca0445cc0bc0fdc061ad857d6 (diff)
downloadbrew-1.0.4.tar.bz2
Merge pull request #1043 from msavy/mkdir_with_intermediates1.0.4
Alter mkdir wrapper use mkdir_p to create intermediate directories
-rw-r--r--Library/Homebrew/extend/fileutils.rb2
-rw-r--r--Library/Homebrew/test/test_pathname.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb
index 8b8d21da4..4f20d36a3 100644
--- a/Library/Homebrew/extend/fileutils.rb
+++ b/Library/Homebrew/extend/fileutils.rb
@@ -88,7 +88,7 @@ module FileUtils
# A version of mkdir that also changes to that folder in a block.
def mkdir(name, &_block)
- old_mkdir(name)
+ mkdir_p(name)
return unless block_given?
chdir name do
yield
diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb
index 492c09c67..2f6360719 100644
--- a/Library/Homebrew/test/test_pathname.rb
+++ b/Library/Homebrew/test/test_pathname.rb
@@ -257,4 +257,11 @@ class PathnameInstallTests < Homebrew::TestCase
@dst.install_symlink "foo" => "bar"
assert_equal Pathname.new("foo"), (@dst/"bar").readlink
end
+
+ def test_mkdir_creates_intermediate_directories
+ mkdir @dst/"foo/bar/baz" do
+ assert_predicate @dst/"foo/bar/baz", :exist?, "foo/bar/baz was not created"
+ assert_predicate @dst/"foo/bar/baz", :directory?, "foo/bar/baz was not a directory structure"
+ end
+ end
end