Commit b624a499 authored by Muhammed Yavuz Nuzumlali's avatar Muhammed Yavuz Nuzumlali

Merge pull request #4527 from CocoaPods/yavuz/fix/stopCommandInsideSandbox

Prevent installer to be run from inside sandbox directory
parents b917ffd9 00170e0f
...@@ -17,7 +17,6 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -17,7 +17,6 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Marcelo Fabri](https://github.com/marcelofabri) [Marcelo Fabri](https://github.com/marcelofabri)
[#4487](https://github.com/CocoaPods/CocoaPods/pull/4487) [#4487](https://github.com/CocoaPods/CocoaPods/pull/4487)
* Improve `pod search` performance while using _`--full`_ flag
* Improve sorting algorithm for `pod search`. * Improve sorting algorithm for `pod search`.
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz) [Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[cocoapods-search#12](https://github.com/CocoaPods/cocoapods-search/issues/12) [cocoapods-search#12](https://github.com/CocoaPods/cocoapods-search/issues/12)
...@@ -76,6 +75,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -76,6 +75,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Prevent installer to be run from inside sandbox directory.
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
* Improve repo lint error message when no repo found with given name. * Improve repo lint error message when no repo found with given name.
[Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz) [Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
[#4142](https://github.com/CocoaPods/CocoaPods/issues/4142) [#4142](https://github.com/CocoaPods/CocoaPods/issues/4142)
......
...@@ -114,6 +114,12 @@ module Pod ...@@ -114,6 +114,12 @@ module Pod
end end
def prepare def prepare
# Raise if pwd is inside Pods
if Dir.pwd.start_with?(sandbox.root.to_path)
message = 'Command should be run from a directory outside Pods directory.'
message << "\n\n\tCurrent directory is #{UI.path(Pathname.pwd)}\n"
raise Informative, message
end
UI.message 'Preparing' do UI.message 'Preparing' do
sandbox.prepare sandbox.prepare
ensure_plugins_are_installed! ensure_plugins_are_installed!
......
...@@ -165,6 +165,20 @@ module Pod ...@@ -165,6 +165,20 @@ module Pod
UI.warnings.should.include 'deprecated in favor of AFNetworking' UI.warnings.should.include 'deprecated in favor of AFNetworking'
UI.warnings.should.include 'BlocksKit has been deprecated' UI.warnings.should.include 'BlocksKit has been deprecated'
end end
it 'does not raise if command is run outside sandbox directory' do
Dir.chdir(@installer.sandbox.root.parent) do
should.not.raise(Informative) { @installer.install! }
end
end
it 'raises if command is run in sandbox directory' do
Dir.chdir(@installer.sandbox.root) do
should.raise Informative do
@installer.install!
end.message.should.match /should.*run.*outside.*Pods directory.*Current directory.*\./m
end
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment