Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 4ff2ff3a0cbce2e0d5a783e082dd841cd3f9ba75 1 parent eed0a91
Eloy Durán alloy authored
3  examples/Podfile
... ... @@ -1,3 +1,4 @@
  1 +#dependency 'doesnotexist'
1 2
2 3 dependency 'SSZipArchive', '>= 1'
3 4
@@ -5,7 +6,7 @@ dependency 'SSZipArchive', '>= 1'
5 6 dependency 'ASIWebPageRequest', '= 1.8'
6 7
7 8 # is part of ASIHTTPRequest 1.8 and 1.8.1
8   -dependency 'Reachability' #, '>= 2.0'
  9 +#dependency 'Reachability' #, '>= 2.0'
9 10
10 11 # is part of ASIHTTPRequest
11 12 #dependency 'ASIWebPageRequest', '>= 1.8'
8 lib/cocoa_pods/config.rb
@@ -31,7 +31,13 @@ def project_pods_root
31 31 end
32 32
33 33 def project_podfile
34   - project_root + 'Podfile'
  34 + unless @project_podfile
  35 + @project_podfile = project_root + 'Podfile'
  36 + unless @project_podfile.exist?
  37 + @project_podfile = project_root.glob('*.podspec').first
  38 + end
  39 + end
  40 + @project_podfile
35 41 end
36 42
37 43 module Mixin
16 spec/unit/config_spec.rb
@@ -19,12 +19,24 @@
19 19 end
20 20
21 21 describe "concerning a user's project, which is expected in the current working directory" do
  22 + extend SpecHelper::TemporaryDirectory
  23 +
22 24 it "returns the path to the project root" do
23 25 config.project_root.should == Pathname.pwd
24 26 end
25 27
26   - it "returns the path to the project Podfile" do
27   - config.project_podfile.should == Pathname.pwd + 'Podfile'
  28 + it "returns the path to the project Podfile if it exists" do
  29 + (temporary_directory + 'Podfile').open('w') { |f| f << '# Yo' }
  30 + Dir.chdir(temporary_directory) do
  31 + config.project_podfile.should == Pathname.pwd + 'Podfile'
  32 + end
  33 + end
  34 +
  35 + it "returns the path to an existing podspec file if a Podfile doesn't exist" do
  36 + (temporary_directory + 'Bananas.podspec').open('w') { |f| f << '# Yo' }
  37 + Dir.chdir(temporary_directory) do
  38 + config.project_podfile.should == Pathname.pwd + 'Bananas.podspec'
  39 + end
28 40 end
29 41
30 42 it "returns the path to the Pods directory that holds the dependencies" do

0 comments on commit 4ff2ff3

Please sign in to comment.
Something went wrong with that request. Please try again.