Permalink
Browse files

Default to either Podfile or *.podspec in the current working dir.

  • Loading branch information...
1 parent eed0a91 commit 4ff2ff3a0cbce2e0d5a783e082dd841cd3f9ba75 @alloy alloy committed Sep 17, 2011
Showing with 23 additions and 4 deletions.
  1. +2 −1 examples/Podfile
  2. +7 −1 lib/cocoa_pods/config.rb
  3. +14 −2 spec/unit/config_spec.rb
View
@@ -1,11 +1,12 @@
+#dependency 'doesnotexist'
dependency 'SSZipArchive', '>= 1'
#dependency 'ASIHTTPRequest', '1.8'
dependency 'ASIWebPageRequest', '= 1.8'
# is part of ASIHTTPRequest 1.8 and 1.8.1
-dependency 'Reachability' #, '>= 2.0'
+#dependency 'Reachability' #, '>= 2.0'
# is part of ASIHTTPRequest
#dependency 'ASIWebPageRequest', '>= 1.8'
@@ -31,7 +31,13 @@ def project_pods_root
end
def project_podfile
- project_root + 'Podfile'
+ unless @project_podfile
+ @project_podfile = project_root + 'Podfile'
+ unless @project_podfile.exist?
+ @project_podfile = project_root.glob('*.podspec').first
+ end
+ end
+ @project_podfile
end
module Mixin
@@ -19,12 +19,24 @@
end
describe "concerning a user's project, which is expected in the current working directory" do
+ extend SpecHelper::TemporaryDirectory
+
it "returns the path to the project root" do
config.project_root.should == Pathname.pwd
end
- it "returns the path to the project Podfile" do
- config.project_podfile.should == Pathname.pwd + 'Podfile'
+ it "returns the path to the project Podfile if it exists" do
+ (temporary_directory + 'Podfile').open('w') { |f| f << '# Yo' }
+ Dir.chdir(temporary_directory) do
+ config.project_podfile.should == Pathname.pwd + 'Podfile'
+ end
+ end
+
+ it "returns the path to an existing podspec file if a Podfile doesn't exist" do
+ (temporary_directory + 'Bananas.podspec').open('w') { |f| f << '# Yo' }
+ Dir.chdir(temporary_directory) do
+ config.project_podfile.should == Pathname.pwd + 'Bananas.podspec'
+ end
end
it "returns the path to the Pods directory that holds the dependencies" do

0 comments on commit 4ff2ff3

Please sign in to comment.