Commit df38fc12 authored by Kyle Fuller's avatar Kyle Fuller

Merge branch 'fabio/specs-sources'

Conflicts:
	spec/unit/command_spec.rb
parents d0a06bf2 9dbcb7f7
# This configuration was generated by `rubocop --auto-gen-config` # This configuration was generated by `rubocop --auto-gen-config`
# on 2014-08-20 23:30:36 +0200 using RuboCop version 0.25.0. # on 2014-08-22 22:27:57 +0200 using RuboCop version 0.25.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 1
Lint/AmbiguousOperator:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Lint/BlockAlignment:
Enabled: false
# Offense count: 2 # Offense count: 2
# Configuration parameters: AlignWith, SupportedStyles. # Configuration parameters: AlignWith, SupportedStyles.
Lint/DefEndAlignment: Lint/DefEndAlignment:
Enabled: false Enabled: false
# Offense count: 2 # Offense count: 10
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
Enabled: false
# Offense count: 11
# Configuration parameters: AlignWith, SupportedStyles. # Configuration parameters: AlignWith, SupportedStyles.
Lint/EndAlignment: Lint/EndAlignment:
Enabled: false Enabled: false
# Offense count: 2
Lint/SpaceBeforeFirstArg:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false
# Offense count: 3 # Offense count: 3
Lint/UselessAccessModifier: Lint/UselessAccessModifier:
Enabled: false Enabled: false
...@@ -53,18 +30,18 @@ Metrics/BlockNesting: ...@@ -53,18 +30,18 @@ Metrics/BlockNesting:
# Offense count: 11 # Offense count: 11
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/ClassLength: Metrics/ClassLength:
Max: 326 Max: 334
# Offense count: 12 # Offense count: 12
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
Max: 9 Max: 9
# Offense count: 956 # Offense count: 961
# Configuration parameters: AllowURI. # Configuration parameters: AllowURI.
Metrics/LineLength: Metrics/LineLength:
Max: 1060 Max: 1060
# Offense count: 104 # Offense count: 106
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/MethodLength: Metrics/MethodLength:
Max: 39 Max: 39
...@@ -73,226 +50,69 @@ Metrics/MethodLength: ...@@ -73,226 +50,69 @@ Metrics/MethodLength:
Metrics/PerceivedComplexity: Metrics/PerceivedComplexity:
Max: 10 Max: 10
# Offense count: 2
# Cop supports --auto-correct.
Style/Alias:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AndOr:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BarePercentLiterals:
Enabled: false
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: PreferredMethods.
Style/CollectionMethods:
Enabled: false
# Offense count: 7 # Offense count: 7
# Configuration parameters: Keywords. # Configuration parameters: Keywords.
Style/CommentAnnotation: Style/CommentAnnotation:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/CommentIndentation:
Enabled: false
# Offense count: 1 # Offense count: 1
Style/DoubleNegation: Style/DoubleNegation:
Enabled: false Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
Style/EmptyLines:
Enabled: false
# Offense count: 17
# Cop supports --auto-correct.
Style/EmptyLinesAroundBody:
Enabled: false
# Offense count: 1 # Offense count: 1
# Configuration parameters: Exclude. # Configuration parameters: Exclude.
Style/FileName: Style/FileName:
Enabled: false Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/For:
Enabled: false
# Offense count: 6 # Offense count: 6
# Configuration parameters: AllowedVariables. # Configuration parameters: AllowedVariables.
Style/GlobalVars: Style/GlobalVars:
Enabled: false Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
Style/IndentArray:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/IndentationConsistency:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
Style/IndentationWidth:
Enabled: false
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/MethodCallParentheses:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MethodDefParentheses:
Enabled: false
# Offense count: 1
Style/MultilineIfThen:
Enabled: false
# Offense count: 1
Style/MultilineTernaryOperator:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/NegatedWhile:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/Not:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters. # Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters: Style/PercentLiteralDelimiters:
Enabled: false Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false
# Offense count: 12 # Offense count: 12
# Configuration parameters: MaxSlashes. # Configuration parameters: MaxSlashes.
Style/RegexpLiteral: Style/RegexpLiteral:
Enabled: false Enabled: false
# Offense count: 3
Style/SelfAssignment:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Enabled: false
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. Style/SelfAssignment:
Style/SpaceAfterControlKeyword:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces:
Enabled: false
# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces:
Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Enabled: false Enabled: false
# Offense count: 34 # Offense count: 28
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces: Style/SpaceInsideHashLiteralBraces:
Enabled: false Enabled: false
# Offense count: 1 # Offense count: 49
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false
# Offense count: 160
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals: Style/StringLiterals:
Enabled: false Enabled: false
# Offense count: 3 # Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false
# Offense count: 9
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma: Style/TrailingComma:
Enabled: false Enabled: false
# Offense count: 22 # Offense count: 17
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/TrailingWhitespace: Style/TrailingWhitespace:
Enabled: false Enabled: false
# Offense count: 4 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist. # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
Style/TrivialAccessors: Style/TrivialAccessors:
Enabled: false Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/VariableName:
Enabled: false
# Offense count: 1 # Offense count: 1
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/WordArray: Style/WordArray:
......
...@@ -18,6 +18,14 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -18,6 +18,14 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[#1668](https://github.com/CocoaPods/CocoaPods/pull/1668) [#1668](https://github.com/CocoaPods/CocoaPods/pull/1668)
[#731](https://github.com/CocoaPods/CocoaPods/pull/731) [#731](https://github.com/CocoaPods/CocoaPods/pull/731)
* Added specific repo sources support. Allows to specify in podfile
which sources should be used to retrieve specs from and the priority
order. Example: `source 'netbe'`, or source 'master'. 'master' being
default github cocoapods specs repo.
[François Benaiteau](https://github.com/netbe)
[#1143](https://github.com/CocoaPods/CocoaPods/pull/1143)
[Core#19](https://github.com/CocoaPods/Core/pull/19)
* Added hooks for plugins. Currently only the installer hook is supported. * Added hooks for plugins. Currently only the installer hook is supported.
A plugin can register itself to be activated after the installation with the A plugin can register itself to be activated after the installation with the
following syntax: following syntax:
...@@ -84,6 +92,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -84,6 +92,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Robert Zuber](https://github.com/z00b) [Robert Zuber](https://github.com/z00b)
[#1904](https://github.com/CocoaPods/CocoaPods/issues/1904) [#1904](https://github.com/CocoaPods/CocoaPods/issues/1904)
* Fixes an issue where version of a spec will not be locked when using multiple
subspecs of a podspec.
[Kyle Fuller](https://github.com/kylef)
[Fabio Pelosin](https://github.com/fabiopelosin)
[#2135](https://github.com/CocoaPods/CocoaPods/issues/2135)
* Fixes an issue using JSON podspecs from a repository.
[Kyle Fuller](https://github.com/kylef)
[#2320](https://github.com/CocoaPods/CocoaPods/issues/2320)
## 0.33.1 ## 0.33.1
...@@ -101,6 +119,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -101,6 +119,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Fabio Pelosin][FabioPelosin] [Fabio Pelosin][FabioPelosin]
[#34](https://github.com/CocoaPods/CLAide/issues/34) [#34](https://github.com/CocoaPods/CLAide/issues/34)
## 0.33.0 ## 0.33.0
##### Breaking ##### Breaking
......
PATH GIT
remote: . remote: https://github.com/CocoaPods/CLAide.git
revision: c4c75f833db97173fca7380890ed99affad2bbab
branch: master
specs: specs:
cocoapods (0.33.1) claide (0.6.1)
activesupport (>= 3.2.15, < 4)
claide (~> 0.6.1) GIT
cocoapods-core (= 0.33.1) remote: https://github.com/CocoaPods/Core.git
cocoapods-downloader (~> 0.6.1) revision: 2c5be5dbb1157c10e86ff75223a119b74d01ae7f
cocoapods-plugins (~> 0.2.0) branch: master
cocoapods-trunk (~> 0.1.4) specs:
cocoapods-try (~> 0.3.0) cocoapods-core (0.33.1)
colored (~> 1.2) activesupport (>= 3.2.15)
escape (~> 0.0.4) fuzzy_match (~> 2.0.4)
json_pure (~> 1.8) json_pure (~> 1.8)
nap (~> 0.8) nap (~> 0.8.0)
open4 (~> 1.3)
xcodeproj (~> 0.18.0)
GIT GIT
remote: https://github.com/CocoaPods/Xcodeproj.git remote: https://github.com/CocoaPods/Xcodeproj.git
revision: de62dd92e4f10b008711393a0a257dd5130ce948 revision: 8cebb41a5630053109da9720454a2ae3eecfee3c
branch: master branch: master
specs: specs:
xcodeproj (0.18.0) xcodeproj (0.18.0)
...@@ -27,54 +27,54 @@ GIT ...@@ -27,54 +27,54 @@ GIT
colored (~> 1.2) colored (~> 1.2)
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-try.git remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: 59a225cd4dd1868da4be7c4cc870cae427f04bf9 revision: a8710a42b1ce379fb2afe66ce9f98a08b58fb482
branch: master
specs:
cocoapods-try (0.3.0)
GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: 62bca8ec7073fc59d4137818bd78e0bbc8b1718f
branch: master branch: master
specs: specs:
cocoapods-trunk (0.1.4) cocoapods-downloader (0.6.1)
json_pure (~> 1.8)
nap (>= 0.8)
netrc
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-plugins.git remote: https://github.com/CocoaPods/cocoapods-plugins.git
revision: f1364dd91ea334e46b2f37455aef46147d14575a revision: 110d18e51f2db545096262832413d31a22e0461a
branch: master branch: master
specs: specs:
cocoapods-plugins (0.2.0) cocoapods-plugins (0.2.0)
nap nap
GIT GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: a8710a42b1ce379fb2afe66ce9f98a08b58fb482 revision: 62bca8ec7073fc59d4137818bd78e0bbc8b1718f
branch: master branch: master
specs: specs:
cocoapods-downloader (0.6.1) cocoapods-trunk (0.1.4)
json_pure (~> 1.8)
nap (>= 0.8)
netrc
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/cocoapods-try.git
revision: f557903817f29000819d4b1b754e6dd667587c30 revision: 59a225cd4dd1868da4be7c4cc870cae427f04bf9
branch: master branch: master
specs: specs:
cocoapods-core (0.33.1) cocoapods-try (0.3.0)
activesupport (>= 3.2.15)
fuzzy_match (~> 2.0.4)
json_pure (~> 1.8)
nap (~> 0.8.0)
GIT PATH
remote: https://github.com/CocoaPods/CLAide.git remote: .
revision: c4c75f833db97173fca7380890ed99affad2bbab
branch: master
specs: specs:
claide (0.6.1) cocoapods (0.33.1)
activesupport (>= 3.2.15, < 4)
claide (~> 0.6.1)
cocoapods-core (= 0.33.1)
cocoapods-downloader (~> 0.6.1)
cocoapods-plugins (~> 0.2.0)
cocoapods-trunk (~> 0.1.4)
cocoapods-try (~> 0.3.0)
colored (~> 1.2)
escape (~> 0.0.4)
json_pure (~> 1.8)
nap (~> 0.8)
open4 (~> 1.3)
xcodeproj (~> 0.18.0)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
...@@ -85,6 +85,8 @@ GEM ...@@ -85,6 +85,8 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
addressable (2.3.6) addressable (2.3.6)
ast (2.0.0) ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
awesome_print (1.2.0) awesome_print (1.2.0)
bacon (1.2.0) bacon (1.2.0)
clintegracon (0.5.2) clintegracon (0.5.2)
...@@ -137,7 +139,8 @@ GEM ...@@ -137,7 +139,8 @@ GEM
ffi (>= 0.5.0) ffi (>= 0.5.0)
rb-kqueue (0.2.3) rb-kqueue (0.2.3)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rubocop (0.25.0) rubocop (0.26.0)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.4, < 3.0) parser (>= 2.2.0.pre.4, < 3.0)
powerpack (~> 0.0.6) powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
......
REQUIRED_COMMANDS = %w[ git hg ]
# Task check_requirements
#-----------------------------------------------------------------------------#
desc 'Verifies that the required third-party commands are available'
task :check_requirements do
has_all_requirements = REQUIRED_COMMANDS.inject(true) do |has_requirements, required_command|
result = has_required_binary?(required_command)
puts red("Missing required command: #{required_command}. You may need to install it.") unless result
has_requirements && result
end
raise unless has_all_requirements
end
# Bootstrap task # Bootstrap task
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Initializes your working copy to run the specs" desc "Initializes your working copy to run the specs"
task :bootstrap, :use_bundle_dir? do |t, args| task :bootstrap, [:use_bundle_dir?] => [:check_requirements] do |t, args|
title "Environment bootstrap" title "Environment bootstrap"
puts "Updating submodules" puts "Updating submodules"
...@@ -113,7 +127,7 @@ begin ...@@ -113,7 +127,7 @@ begin
#--------------------------------------# #--------------------------------------#
desc "Run the integration spec" desc "Run the integration spec"
task :integration do task :integration => :check_requirements do
unless File.exists?('spec/cocoapods-integration-specs') unless File.exists?('spec/cocoapods-integration-specs')
$stderr.puts red("Integration files not checked out. Run `rake bootstrap`") $stderr.puts red("Integration files not checked out. Run `rake bootstrap`")
exit 1 exit 1
...@@ -128,7 +142,7 @@ begin ...@@ -128,7 +142,7 @@ begin
# The specs helper interfere with the integration 2 specs and thus they need # The specs helper interfere with the integration 2 specs and thus they need
# to be run separately. # to be run separately.
# #
task :all => :unpack_fixture_tarballs do task :all => [:unpack_fixture_tarballs, :check_requirements] do
ENV['GENERATE_COVERAGE'] = 'true' ENV['GENERATE_COVERAGE'] = 'true'
puts "\033[0;32mUsing #{`ruby --version`}\033[0m" puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
...@@ -300,3 +314,9 @@ end ...@@ -300,3 +314,9 @@ end
def red(string) def red(string)
"\033[0;31m#{string}\e[0m" "\033[0;31m#{string}\e[0m"
end end
def has_required_binary?(name)
`which #{name}`
$?.success?
end
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
1489BC7C65DCCDA21BD9C10D /* Pods-AFNetworking Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking Example.release.xcconfig"; path = "Pods/Pods-AFNetworking Example.release.xcconfig"; sourceTree = "<group>"; }; 53763FEA1CCF8658D4ACFFCE /* Pods-AFNetworking Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AFNetworking Example.debug.xcconfig"; sourceTree = "<group>"; };
206C0CA2FCD1CCE9783CC39F /* Pods-AFNetworking Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking Example.debug.xcconfig"; path = "Pods/Pods-AFNetworking Example.debug.xcconfig"; sourceTree = "<group>"; };
6935B1E417A24F0E958977ED /* libPods-AFNetworking Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AFNetworking Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 6935B1E417A24F0E958977ED /* libPods-AFNetworking Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AFNetworking Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
B304CCE7177D58DD00F4FC85 /* adn.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = adn.cer; sourceTree = SOURCE_ROOT; }; B304CCE7177D58DD00F4FC85 /* adn.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = adn.cer; sourceTree = SOURCE_ROOT; };
B3341CC0913DB5992CDCDDF6 /* Pods-AFNetworking Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-AFNetworking Example.release.xcconfig"; sourceTree = "<group>"; };
F8129BFB1591061B009BFE23 /* AFNetworking Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AFNetworking Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; F8129BFB1591061B009BFE23 /* AFNetworking Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AFNetworking Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
F8129BFF1591061B009BFE23 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; F8129BFF1591061B009BFE23 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
F8129C021591061B009BFE23 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; F8129C021591061B009BFE23 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
...@@ -54,6 +54,15 @@ ...@@ -54,6 +54,15 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
A052BC91C16D94336357A93A /* Pods */ = {
isa = PBXGroup;
children = (
53763FEA1CCF8658D4ACFFCE /* Pods-AFNetworking Example.debug.xcconfig */,
B3341CC0913DB5992CDCDDF6 /* Pods-AFNetworking Example.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
F8129BF01591061B009BFE23 = { F8129BF01591061B009BFE23 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -61,8 +70,7 @@ ...@@ -61,8 +70,7 @@
F8129C051591061B009BFE23 /* Classes */, F8129C051591061B009BFE23 /* Classes */,
F8129BFE1591061B009BFE23 /* Frameworks */, F8129BFE1591061B009BFE23 /* Frameworks */,
F8129BFC1591061B009BFE23 /* Products */, F8129BFC1591061B009BFE23 /* Products */,
206C0CA2FCD1CCE9783CC39F /* Pods-AFNetworking Example.debug.xcconfig */, A052BC91C16D94336357A93A /* Pods */,
1489BC7C65DCCDA21BD9C10D /* Pods-AFNetworking Example.release.xcconfig */,
); );
indentWidth = 4; indentWidth = 4;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -220,7 +228,7 @@ ...@@ -220,7 +228,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-AFNetworking Example-resources.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AFNetworking Example/Pods-AFNetworking Example-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
...@@ -298,7 +306,7 @@ ...@@ -298,7 +306,7 @@
}; };
F8129C1A1591061B009BFE23 /* Debug */ = { F8129C1A1591061B009BFE23 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 206C0CA2FCD1CCE9783CC39F /* Pods-AFNetworking Example.debug.xcconfig */; baseConfigurationReference = 53763FEA1CCF8658D4ACFFCE /* Pods-AFNetworking Example.debug.xcconfig */;
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
...@@ -312,7 +320,7 @@ ...@@ -312,7 +320,7 @@
}; };
F8129C1B1591061B009BFE23 /* Release */ = { F8129C1B1591061B009BFE23 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 1489BC7C65DCCDA21BD9C10D /* Pods-AFNetworking Example.release.xcconfig */; baseConfigurationReference = B3341CC0913DB5992CDCDDF6 /* Pods-AFNetworking Example.release.xcconfig */;
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
......
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
08ACA902EBEF3347432C3442 /* Pods-AFNetworking iOS Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking iOS Example.release.xcconfig"; path = "Pods/Pods-AFNetworking iOS Example.release.xcconfig"; sourceTree = "<group>"; };
17E95B75D4453CE0BA3028FF /* Pods-AFNetworking iOS Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking iOS Example.debug.xcconfig"; path = "Pods/Pods-AFNetworking iOS Example.debug.xcconfig"; sourceTree = "<group>"; };
2982AD3117107C0000FFF048 /* adn.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = adn.cer; sourceTree = SOURCE_ROOT; }; 2982AD3117107C0000FFF048 /* adn.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = adn.cer; sourceTree = SOURCE_ROOT; };
50ABD6EC159FC2CE001BE42C /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 50ABD6EC159FC2CE001BE42C /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
5628C4E1DE6DDC806B14CF8D /* Pods-AFNetworking iOS Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking iOS Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-AFNetworking iOS Example.release.xcconfig"; sourceTree = "<group>"; };
9D87F8FEDE4A4313B0D579A3 /* libPods-AFNetworking iOS Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AFNetworking iOS Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 9D87F8FEDE4A4313B0D579A3 /* libPods-AFNetworking iOS Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AFNetworking iOS Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
C3B414D5F7FCC5379A284B4E /* Pods-AFNetworking iOS Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AFNetworking iOS Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AFNetworking iOS Example.debug.xcconfig"; sourceTree = "<group>"; };
F8129C3815910830009BFE23 /* Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; }; F8129C3815910830009BFE23 /* Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; };
F8129C7215910C37009BFE23 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = SOURCE_ROOT; }; F8129C7215910C37009BFE23 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = SOURCE_ROOT; };
F8129C7315910C37009BFE23 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; }; F8129C7315910C37009BFE23 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; };
...@@ -88,6 +88,15 @@ ...@@ -88,6 +88,15 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
9CE17E7C344B0E75BC0723EA /* Pods */ = {
isa = PBXGroup;
children = (
C3B414D5F7FCC5379A284B4E /* Pods-AFNetworking iOS Example.debug.xcconfig */,
5628C4E1DE6DDC806B14CF8D /* Pods-AFNetworking iOS Example.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
F8DA09C61396AB690057D0CC /* Controllers */ = { F8DA09C61396AB690057D0CC /* Controllers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -131,8 +140,7 @@ ...@@ -131,8 +140,7 @@
F8E469ED1395812A00DB05C8 /* Images */, F8E469ED1395812A00DB05C8 /* Images */,
F8E469631395739D00DB05C8 /* Frameworks */, F8E469631395739D00DB05C8 /* Frameworks */,
F8E469611395739C00DB05C8 /* Products */, F8E469611395739C00DB05C8 /* Products */,
17E95B75D4453CE0BA3028FF /* Pods-AFNetworking iOS Example.debug.xcconfig */, 9CE17E7C344B0E75BC0723EA /* Pods */,
08ACA902EBEF3347432C3442 /* Pods-AFNetworking iOS Example.release.xcconfig */,
); );
indentWidth = 4; indentWidth = 4;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -287,7 +295,7 @@ ...@@ -287,7 +295,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Pods-AFNetworking iOS Example-resources.sh\"\n"; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-AFNetworking iOS Example/Pods-AFNetworking iOS Example-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
E4419DF1E8B742E49777FFE0 /* Check Pods Manifest.lock */ = { E4419DF1E8B742E49777FFE0 /* Check Pods Manifest.lock */ = {
...@@ -358,7 +366,7 @@ ...@@ -358,7 +366,7 @@
}; };
F8E469821395739D00DB05C8 /* Debug */ = { F8E469821395739D00DB05C8 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 17E95B75D4453CE0BA3028FF /* Pods-AFNetworking iOS Example.debug.xcconfig */; baseConfigurationReference = C3B414D5F7FCC5379A284B4E /* Pods-AFNetworking iOS Example.debug.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
...@@ -380,7 +388,7 @@ ...@@ -380,7 +388,7 @@
}; };
F8E469831395739D00DB05C8 /* Release */ = { F8E469831395739D00DB05C8 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 08ACA902EBEF3347432C3442 /* Pods-AFNetworking iOS Example.release.xcconfig */; baseConfigurationReference = 5628C4E1DE6DDC806B14CF8D /* Pods-AFNetworking iOS Example.release.xcconfig */;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
......
...@@ -59,7 +59,8 @@ module Pod ...@@ -59,7 +59,8 @@ module Pod
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, "6.0" # platform :ios, "6.0"
PLATFORM PLATFORM
for target in project.targets
project.targets.each do |target|
podfile << target_module(target) podfile << target_module(target)
end end
podfile << "\n" podfile << "\n"
......
...@@ -28,8 +28,9 @@ module Pod ...@@ -28,8 +28,9 @@ module Pod
end end
def run def run
require 'json'
spec = Specification.from_file(@path) spec = Specification.from_file(@path)
output_pipe.puts spec.to_json output_pipe.puts(JSON.pretty_generate(spec))
end end
end end
......
...@@ -17,8 +17,8 @@ module Pod ...@@ -17,8 +17,8 @@ module Pod
DESC DESC
self.arguments = [ self.arguments = [
CLAide::Argument.new('NAME', true), CLAide::Argument.new('NAME', true),
CLAide::Argument.new('TEMPLATE_URL', false) CLAide::Argument.new('TEMPLATE_URL', false),
] ]
def initialize(argv) def initialize(argv)
...@@ -29,8 +29,8 @@ module Pod ...@@ -29,8 +29,8 @@ module Pod
def validate! def validate!
super super
help! "A name for the Pod is required." unless @name help! 'A name for the Pod is required.' unless @name
help! "The Pod name cannot contain spaces." if @name.match(/\s/) help! 'The Pod name cannot contain spaces.' if @name.match(/\s/)
help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.' help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
end end
...@@ -50,9 +50,9 @@ module Pod ...@@ -50,9 +50,9 @@ module Pod
executable :git executable :git
executable :ruby executable :ruby
TEMPLATE_REPO = "https://github.com/CocoaPods/pod-template.git" TEMPLATE_REPO = 'https://github.com/CocoaPods/pod-template.git'
TEMPLATE_INFO_URL = "https://github.com/CocoaPods/pod-template" TEMPLATE_INFO_URL = 'https://github.com/CocoaPods/pod-template'
CREATE_NEW_POD_INFO_URL = "http://guides.cocoapods.org/making/making-a-cocoapod" CREATE_NEW_POD_INFO_URL = 'http://guides.cocoapods.org/making/making-a-cocoapod'
# Clones the template from the remote in the working directory using # Clones the template from the remote in the working directory using
# the name of the Pod. # the name of the Pod.
...@@ -61,7 +61,7 @@ module Pod ...@@ -61,7 +61,7 @@ module Pod
# #
def clone_template def clone_template
UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do
git!"clone '#{template_repo_url}' #{@name}" git! "clone '#{template_repo_url}' #{@name}"
end end
end end
...@@ -72,10 +72,10 @@ module Pod ...@@ -72,10 +72,10 @@ module Pod
def configure_template def configure_template
UI.section("Configuring #{@name} template.") do UI.section("Configuring #{@name} template.") do
Dir.chdir(@name) do Dir.chdir(@name) do
if File.exists? "configure" if File.exist?('configure')
system "./configure #{@name}" system("./configure #{@name}")
else else
UI.warn "Template does not have a configure file." UI.warn 'Template does not have a configure file.'
end end
end end
end end
...@@ -109,11 +109,11 @@ module Pod ...@@ -109,11 +109,11 @@ module Pod
DESC DESC
def self.options def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"], [['--quick', 'Lint skips checks that would require to download and build the spec'],
["--only-errors", "Lint validates even if warnings are present"], ['--only-errors', 'Lint validates even if warnings are present'],
["--subspec=NAME","Lint validates only the given subspec"], ['--subspec=NAME', 'Lint validates only the given subspec'],
["--no-subspecs", "Lint skips validation of subspecs"], ['--no-subspecs', 'Lint skips validation of subspecs'],
["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super) ['--no-clean', 'Lint leaves the build directory intact for inspection']].concat(super)
end end
def initialize(argv) def initialize(argv)
...@@ -153,7 +153,7 @@ module Pod ...@@ -153,7 +153,7 @@ module Pod
message = "#{validator.spec.name} did not pass validation." message = "#{validator.spec.name} did not pass validation."
if @clean if @clean
message << "\nYou can use the `--no-clean` option to inspect " \ message << "\nYou can use the `--no-clean` option to inspect " \
"any issue." 'any issue.'
end end
raise Informative, message raise Informative, message
end end
...@@ -173,19 +173,20 @@ module Pod ...@@ -173,19 +173,20 @@ module Pod
# @raise If multiple podspecs are found. # @raise If multiple podspecs are found.
# #
def podspecs_to_lint def podspecs_to_lint
if !@podspecs_paths.empty? then if !@podspecs_paths.empty?
Array(@podspecs_paths) Array(@podspecs_paths)
else else
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}') podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}')
raise Informative, "Unable to find a podspec in the working directory" if podspecs.count.zero? if podspecs.count.zero?
raise Informative, 'Unable to find a podspec in the working ' \
'directory'
end
podspecs podspecs
end end
end end
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
end end
end end
end end
...@@ -23,7 +23,7 @@ module Pod ...@@ -23,7 +23,7 @@ module Pod
def run def run
update_if_necessary! update_if_necessary!
sets = SourcesManager.all_sets sets = SourcesManager.aggregate.all_sets
sets.each { |set| UI.pod(set, :name_and_version) } sets.each { |set| UI.pod(set, :name_and_version) }
UI.puts "\n#{sets.count} pods were found" UI.puts "\n#{sets.count} pods were found"
end end
...@@ -47,7 +47,7 @@ module Pod ...@@ -47,7 +47,7 @@ module Pod
days = [1, 2, 3, 5, 8] days = [1, 2, 3, 5, 8]
dates, groups = {}, {} dates, groups = {}, {}
days.each { |d| dates[d] = Time.now - 60 * 60 * 24 * d } days.each { |d| dates[d] = Time.now - 60 * 60 * 24 * d }
sets = SourcesManager.all_sets sets = SourcesManager.aggregate.all_sets
statistics_provider = Config.instance.spec_statistics_provider statistics_provider = Config.instance.spec_statistics_provider
creation_dates = statistics_provider.creation_dates(sets) creation_dates = statistics_provider.creation_dates(sets)
......
...@@ -75,7 +75,8 @@ module Pod ...@@ -75,7 +75,8 @@ module Pod
class Update < Command class Update < Command
include Project include Project
self.summary = 'Update outdated project dependencies and create new Podfile.lock' self.summary = 'Update outdated project dependencies and create new ' \
'Podfile.lock'
self.description = <<-DESC self.description = <<-DESC
Updates the Pods identified by the specified `POD_NAMES`. If no Updates the Pods identified by the specified `POD_NAMES`. If no
...@@ -101,12 +102,19 @@ module Pod ...@@ -101,12 +102,19 @@ module Pod
verify_lockfile_exists! verify_lockfile_exists!
# Check if all given pods are installed # Check if all given pods are installed
missing_pods = @pods.select { |pod| !config.lockfile.pod_names.include?(pod) } missing_pods = @pods.select do |pod|
!config.lockfile.pod_names.include?(pod)
end
if missing_pods.length > 0 if missing_pods.length > 0
raise Informative, (missing_pods.length > 1 \ if missing_pods.length > 1
? 'Pods %s are not installed and cannot be updated' \ message = "Pods `#{missing_pods.join('`, `')}` are not " \
: 'Pod %s is not installed and cannot be updated' 'installed and cannot be updated'
) % missing_pods.map { |p| "`#{p}`" }.join(', ') else
message = "The `#{missing_pods.first}` Pod is not installed " \
'and cannot be updated'
end
raise Informative, message
end end
run_install_with_update(:pods => @pods) run_install_with_update(:pods => @pods)
......
...@@ -17,7 +17,7 @@ module Pod ...@@ -17,7 +17,7 @@ module Pod
def self.options def self.options
[ [
['--no-shallow', 'Clone full history so push will work'], ['--no-shallow', 'Clone full history so push will work'],
['--push', 'Use this option to enable push access once granted'], ['--push', 'Use this option to enable push access once granted'],
].concat(super) ].concat(super)
end end
...@@ -51,16 +51,17 @@ module Pod ...@@ -51,16 +51,17 @@ module Pod
# @!group Setup steps # @!group Setup steps
# Migrates any repos from the old directory structure to the new directory # Migrates any repos from the old directory structure to the new
# structure. # directory structure.
#
# @todo: Remove by 1.0
# #
# @return [void]
def migrate_repos def migrate_repos
config.repos_dir.mkpath config.repos_dir.mkpath
Dir.foreach old_master_repo_dir.parent do |repo_dir| Dir.foreach old_master_repo_dir.parent do |repo_dir|
source_repo_dir = old_master_repo_dir.parent + repo_dir source_repo_dir = old_master_repo_dir.parent + repo_dir
target_repo_dir = config.repos_dir + repo_dir target_repo_dir = config.repos_dir + repo_dir
if not repo_dir =~ /\.+/ and source_repo_dir != config.repos_dir if repo_dir !~ /\.+/ && source_repo_dir != config.repos_dir
FileUtils.mv source_repo_dir, target_repo_dir FileUtils.mv source_repo_dir, target_repo_dir
end end
end end
......
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
DESC DESC
self.arguments = [ self.arguments = [
CLAide::Argument.new(%w(NAME https://github.com/USER/REPO), false) CLAide::Argument.new(%w(NAME https://github.com/USER/REPO), false),
] ]
def initialize(argv) def initialize(argv)
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
def validate! def validate!
super super
help! "A pod name or repo URL is required." unless @name_or_url help! 'A pod name or repo URL is required.' unless @name_or_url
end end
def run def run
...@@ -63,11 +63,11 @@ module Pod ...@@ -63,11 +63,11 @@ module Pod
] ]
def self.options def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"], [['--quick', 'Lint skips checks that would require to download and build the spec'],
["--only-errors", "Lint validates even if warnings are present"], ['--only-errors', 'Lint validates even if warnings are present'],
["--subspec=NAME","Lint validates only the given subspec"], ['--subspec=NAME', 'Lint validates only the given subspec'],
["--no-subspecs", "Lint skips validation of subspecs"], ['--no-subspecs', 'Lint skips validation of subspecs'],
["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super) ['--no-clean', 'Lint leaves the build directory intact for inspection']].concat(super)
end end
def initialize(argv) def initialize(argv)
...@@ -102,10 +102,10 @@ module Pod ...@@ -102,10 +102,10 @@ module Pod
count = podspecs_to_lint.count count = podspecs_to_lint.count
UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n" UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n"
if invalid_count == 0 if invalid_count == 0
lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : "All the specs passed validation." lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : 'All the specs passed validation.'
UI.puts lint_passed_message.green << "\n\n" UI.puts lint_passed_message.green << "\n\n"
else else
raise Informative, count == 1 ? "The spec did not pass validation." : "#{invalid_count} out of #{count} specs failed validation." raise Informative, count == 1 ? 'The spec did not pass validation.' : "#{invalid_count} out of #{count} specs failed validation."
end end
podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist? podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist?
end end
...@@ -114,32 +114,32 @@ module Pod ...@@ -114,32 +114,32 @@ module Pod
def podspecs_to_lint def podspecs_to_lint
@podspecs_to_lint ||= begin @podspecs_to_lint ||= begin
files = [] files = []
@podspecs_paths << '.' if @podspecs_paths.empty? @podspecs_paths << '.' if @podspecs_paths.empty?
@podspecs_paths.each do |path| @podspecs_paths.each do |path|
if path =~ /https?:\/\// if path =~ /https?:\/\//
require 'open-uri' require 'open-uri'
output_path = podspecs_tmp_dir + File.basename(path) output_path = podspecs_tmp_dir + File.basename(path)
output_path.dirname.mkpath output_path.dirname.mkpath
open(path) do |io| open(path) do |io|
output_path.open('w') { |f| f << io.read } output_path.open('w') { |f| f << io.read }
end
files << output_path
else if (pathname = Pathname.new(path)).directory?
files += Pathname.glob(pathname + '**/*.podspec{.json,}')
raise Informative, "No specs found in the current directory." if files.empty?
else
files << (pathname = Pathname.new(path))
raise Informative, "Unable to find a spec named `#{path}'." unless pathname.exist? && path.include?('.podspec')
end end
files << output_path
else if (pathname = Pathname.new(path)).directory?
files += Pathname.glob(pathname + '**/*.podspec{.json,}')
raise Informative, 'No specs found in the current directory.' if files.empty?
else
files << (pathname = Pathname.new(path))
raise Informative, "Unable to find a spec named `#{path}'." unless pathname.exist? && path.include?('.podspec')
end end
end end
end
files files
end end
end end
def podspecs_tmp_dir def podspecs_tmp_dir
Pathname.new(File.join(Pathname.new('/tmp').realpath, '/CocoaPods/Lint_podspec')) Pathname(File.join(Pathname.new('/tmp').realpath, '/CocoaPods/Lint_podspec'))
end end
end end
...@@ -153,11 +153,13 @@ module Pod ...@@ -153,11 +153,13 @@ module Pod
DESC DESC
self.arguments = [ self.arguments = [
CLAide::Argument.new('NAME', false) CLAide::Argument.new('NAME', false),
] ]
def self.options def self.options
[["--show-all", "Print all versions of the given podspec"]].concat(super) [
['--show-all', 'Print all versions of the given podspec'],
].concat(super)
end end
def initialize(argv) def initialize(argv)
...@@ -169,7 +171,7 @@ module Pod ...@@ -169,7 +171,7 @@ module Pod
def validate! def validate!
super super
help! "A podspec name is required." unless @spec help! 'A podspec name is required.' unless @spec
end end
def run def run
...@@ -187,11 +189,11 @@ module Pod ...@@ -187,11 +189,11 @@ module Pod
DESC DESC
self.arguments = [ self.arguments = [
CLAide::Argument.new('NAME', false) CLAide::Argument.new('NAME', false),
] ]
def self.options def self.options
[["--show-all", "Pick from all versions of the given podspec"]].concat(super) [['--show-all', 'Pick from all versions of the given podspec']].concat(super)
end end
def initialize(argv) def initialize(argv)
...@@ -203,14 +205,14 @@ module Pod ...@@ -203,14 +205,14 @@ module Pod
def validate! def validate!
super super
help! "A podspec name is required." unless @spec help! 'A podspec name is required.' unless @spec
end end
def run def run
filepath = if @show_all filepath = if @show_all
specs = get_path_of_spec(@spec, @show_all).split(/\n/) specs = get_path_of_spec(@spec, @show_all).split(/\n/)
index = choose_from_array(specs, "Which spec would you like to print [1-#{ specs.count }]? ") index = choose_from_array(specs, "Which spec would you like to print [1-#{ specs.count }]? ")
specs[index] specs[index]
else else
get_path_of_spec(@spec) get_path_of_spec(@spec)
end end
...@@ -229,11 +231,12 @@ module Pod ...@@ -229,11 +231,12 @@ module Pod
DESC DESC
self.arguments = [ self.arguments = [
CLAide::Argument.new('NAME', false) CLAide::Argument.new('NAME', false),
] ]
def self.options def self.options
[["--show-all", "Pick which spec to edit from all available versions of the given podspec"]].concat(super) [['--show-all', 'Pick which spec to edit from all available' \
'versions of the given podspec']].concat(super)
end end
def initialize(argv) def initialize(argv)
...@@ -245,19 +248,20 @@ module Pod ...@@ -245,19 +248,20 @@ module Pod
def validate! def validate!
super super
help! "A podspec name is required." unless @spec help! 'A podspec name is required.' unless @spec
end end
def run def run
filepath = if @show_all if @show_all
specs = get_path_of_spec(@spec, @show_all).split(/\n/) specs = get_path_of_spec(@spec, @show_all).split(/\n/)
index = choose_from_array(specs, "Which spec would you like to edit [1-#{ specs.count }]? ") message = "Which spec would you like to edit [1-#{specs.count}]? "
specs[index] index = choose_from_array(specs, message)
filepath = specs[index]
else else
get_path_of_spec(@spec) filepath = get_path_of_spec(@spec)
end end
exec_editor(filepath.to_s) if File.exists? filepath exec_editor(filepath.to_s) if File.exist? filepath
raise Informative, "#{ filepath } doesn't exist." raise Informative, "#{ filepath } doesn't exist."
end end
...@@ -284,7 +288,7 @@ module Pod ...@@ -284,7 +288,7 @@ module Pod
raise Informative, "Failed to open editor. Set your 'EDITOR' environment variable." raise Informative, "Failed to open editor. Set your 'EDITOR' environment variable."
end end
def exec_editor *args def exec_editor(*args)
return if args.to_s.empty? return if args.to_s.empty?
safe_exec(which_editor, *args) safe_exec(which_editor, *args)
end end
...@@ -292,7 +296,7 @@ module Pod ...@@ -292,7 +296,7 @@ module Pod
def safe_exec(cmd, *args) def safe_exec(cmd, *args)
# This buys us proper argument quoting and evaluation # This buys us proper argument quoting and evaluation
# of environment variables in the cmd parameter. # of environment variables in the cmd parameter.
exec "/bin/sh", "-i", "-c", cmd + ' "$@"', "--", *args exec('/bin/sh', '-i', '-c', cmd + ' "$@"', '--', *args)
end end
end end
...@@ -337,7 +341,7 @@ module Pod ...@@ -337,7 +341,7 @@ module Pod
elsif sets.map(&:name).include?(spec) elsif sets.map(&:name).include?(spec)
set = sets.find { |s| s.name == spec } set = sets.find { |s| s.name == spec }
else else
names = sets.collect(&:name) * ', ' names = sets.map(&:name) * ', '
raise Informative, "More than one spec found for '#{ spec }':\n#{ names }" raise Informative, "More than one spec found for '#{ spec }':\n#{ names }"
end end
...@@ -346,19 +350,19 @@ module Pod ...@@ -346,19 +350,19 @@ module Pod
return pathname_from_spec(best_spec, spec_source) return pathname_from_spec(best_spec, spec_source)
end end
return all_paths_from_set(set) all_paths_from_set(set)
end end
# @return [Pathname] the absolute path of the given spec and source # @return [Pathname] the absolute path of the given spec and source
# #
def pathname_from_spec(spec, source) def pathname_from_spec(spec, _source)
Pathname(spec.defined_in_file) Pathname(spec.defined_in_file)
end end
# @return [String] of spec paths one on each line # @return [String] of spec paths one on each line
# #
def all_paths_from_set(set) def all_paths_from_set(set)
paths = "" paths = ''
sources = set.sources sources = set.sources
...@@ -384,18 +388,18 @@ module Pod ...@@ -384,18 +388,18 @@ module Pod
sources.each do |source| sources.each do |source|
versions = source.versions(set.name) versions = source.versions(set.name)
versions.each do |version| versions.each do |version|
if !best_version or version > best_version if !best_version || version > best_version
best_source = source best_source = source
best_version = version best_version = version
end end
end end
end end
if !best_source or !best_version if !best_source || !best_version
raise Informative, "Unable to locate highest known specification for `#{ set.name }'" raise Informative, "Unable to locate highest known specification for `#{ set.name }'"
end end
return best_source.specification(set.name, best_version), best_source [best_source.specification(set.name, best_version), best_source]
end end
#--------------------------------------# #--------------------------------------#
...@@ -427,7 +431,7 @@ module Pod ...@@ -427,7 +431,7 @@ module Pod
data[:name] = repo['name'] data[:name] = repo['name']
data[:summary] = (repo['description'] || '').gsub(/["]/, '\"') data[:summary] = (repo['description'] || '').gsub(/["]/, '\"')
data[:homepage] = (repo['homepage'] && !repo['homepage'].empty? ) ? repo['homepage'] : repo['html_url'] data[:homepage] = (repo['homepage'] && !repo['homepage'].empty?) ? repo['homepage'] : repo['html_url']
data[:author_name] = user['name'] || user['login'] data[:author_name] = user['name'] || user['login']
data[:author_email] = user['email'] || 'email@address.com' data[:author_email] = user['email'] || 'email@address.com'
data[:source_url] = repo['clone_url'] data[:source_url] = repo['clone_url']
...@@ -436,18 +440,18 @@ module Pod ...@@ -436,18 +440,18 @@ module Pod
end end
def suggested_ref_and_version(repo) def suggested_ref_and_version(repo)
tags = GitHub.tags(repo['html_url']).map {|tag| tag["name"]} tags = GitHub.tags(repo['html_url']).map { |tag| tag['name'] }
versions_tags = {} versions_tags = {}
tags.each do |tag| tags.each do |tag|
clean_tag = tag.gsub(/^v(er)? ?/,'') clean_tag = tag.gsub(/^v(er)? ?/, '')
versions_tags[Gem::Version.new(clean_tag)] = tag if Gem::Version.correct?(clean_tag) versions_tags[Gem::Version.new(clean_tag)] = tag if Gem::Version.correct?(clean_tag)
end end
version = versions_tags.keys.sort.last || '0.0.1' version = versions_tags.keys.sort.last || '0.0.1'
data = {:version => version} data = { :version => version }
if version == '0.0.1' if version == '0.0.1'
branches = GitHub.branches(repo['html_url']) branches = GitHub.branches(repo['html_url'])
master_name = repo['master_branch'] || 'master' master_name = repo['master_branch'] || 'master'
master = branches.find {|branch| branch['name'] == master_name } master = branches.find { |branch| branch['name'] == master_name }
data[:ref_type] = ':commit' data[:ref_type] = ':commit'
data[:ref] = master['commit']['sha'] data[:ref] = master['commit']['sha']
else else
...@@ -458,7 +462,7 @@ module Pod ...@@ -458,7 +462,7 @@ module Pod
end end
def spec_template(data) def spec_template(data)
return <<-SPEC <<-SPEC
# #
# Be sure to run `pod spec lint #{data[:name]}.podspec' to ensure this is a # Be sure to run `pod spec lint #{data[:name]}.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec. # valid spec and to remove all comments including this before submitting the spec.
...@@ -513,7 +517,7 @@ Pod::Spec.new do |s| ...@@ -513,7 +517,7 @@ Pod::Spec.new do |s|
# Specify a social_media_url where others can refer to, for example a twitter # Specify a social_media_url where others can refer to, for example a twitter
# profile URL. # profile URL.
# #
s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" } s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" }
# Or just: s.author = "#{data[:author_name]}" # Or just: s.author = "#{data[:author_name]}"
# s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" } # s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" }
...@@ -599,7 +603,7 @@ end ...@@ -599,7 +603,7 @@ end
end end
def semantic_versioning_notice(repo_id, repo) def semantic_versioning_notice(repo_id, repo)
return <<-EOS <<-EOS
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed} #{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
......
module Pod module Pod
# Stores the global configuration of CocoaPods. # Stores the global configuration of CocoaPods.
# #
class Config class Config
# The default settings for the configuration. # The default settings for the configuration.
# #
# Users can specify custom settings in `~/.cocoapods/config.yaml`. # Users can specify custom settings in `~/.cocoapods/config.yaml`.
...@@ -35,18 +33,18 @@ module Pod ...@@ -35,18 +33,18 @@ module Pod
# performed actions. # performed actions.
# #
attr_accessor :verbose attr_accessor :verbose
alias_method :verbose?, :verbose alias_method :verbose?, :verbose
# @return [Bool] Whether CocoaPods should produce not output. # @return [Bool] Whether CocoaPods should produce not output.
# #
attr_accessor :silent attr_accessor :silent
alias_method :silent?, :silent alias_method :silent?, :silent
# @return [Bool] Whether a message should be printed when a new version of # @return [Bool] Whether a message should be printed when a new version of
# CocoaPods is available. # CocoaPods is available.
# #
attr_accessor :new_version_message attr_accessor :new_version_message
alias_method :new_version_message?, :new_version_message alias_method :new_version_message?, :new_version_message
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -55,19 +53,18 @@ module Pod ...@@ -55,19 +53,18 @@ module Pod
# @return [Bool] Whether the installer should clean after the installation. # @return [Bool] Whether the installer should clean after the installation.
# #
attr_accessor :clean attr_accessor :clean
alias_method :clean?, :clean alias_method :clean?, :clean
# @return [Bool] Whether CocoaPods should integrate a user target and build # @return [Bool] Whether CocoaPods should integrate a user target and build
# the workspace or just create the Pods project. # the workspace or just create the Pods project.
# #
attr_accessor :integrate_targets attr_accessor :integrate_targets
alias_method :integrate_targets?, :integrate_targets alias_method :integrate_targets?, :integrate_targets
# @return [Bool] Whether the installer should skip the repos update. # @return [Bool] Whether the installer should skip the repos update.
# #
attr_accessor :skip_repo_update attr_accessor :skip_repo_update
alias_method :skip_repo_update?, :skip_repo_update alias_method :skip_repo_update?, :skip_repo_update
public public
...@@ -115,13 +112,13 @@ module Pod ...@@ -115,13 +112,13 @@ module Pod
# files are stored. # files are stored.
# #
def home_dir def home_dir
@home_dir ||= Pathname.new(ENV['CP_HOME_DIR'] || "~/.cocoapods").expand_path @home_dir ||= Pathname.new(ENV['CP_HOME_DIR'] || '~/.cocoapods').expand_path
end end
# @return [Pathname] the directory where the CocoaPods sources are stored. # @return [Pathname] the directory where the CocoaPods sources are stored.
# #
def repos_dir def repos_dir
@repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || "~/.cocoapods/repos").expand_path @repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || '~/.cocoapods/repos').expand_path
end end
attr_writer :repos_dir attr_writer :repos_dir
...@@ -129,7 +126,7 @@ module Pod ...@@ -129,7 +126,7 @@ module Pod
# @return [Pathname] the directory where the CocoaPods templates are stored. # @return [Pathname] the directory where the CocoaPods templates are stored.
# #
def templates_dir def templates_dir
@templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || "~/.cocoapods/templates").expand_path @templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || '~/.cocoapods/templates').expand_path
end end
# @return [Pathname] the root of the CocoaPods installation where the # @return [Pathname] the root of the CocoaPods installation where the
...@@ -138,7 +135,7 @@ module Pod ...@@ -138,7 +135,7 @@ module Pod
def installation_root def installation_root
current_path = Pathname.pwd current_path = Pathname.pwd
unless @installation_root unless @installation_root
while(!current_path.root?) until current_path.root?
if podfile_path_in_dir(current_path) if podfile_path_in_dir(current_path)
@installation_root = current_path @installation_root = current_path
unless current_path == Pathname.pwd unless current_path == Pathname.pwd
...@@ -155,7 +152,7 @@ module Pod ...@@ -155,7 +152,7 @@ module Pod
end end
attr_writer :installation_root attr_writer :installation_root
alias :project_root :installation_root alias_method :project_root, :installation_root
# @return [Pathname] The root of the sandbox. # @return [Pathname] The root of the sandbox.
# #
...@@ -164,7 +161,7 @@ module Pod ...@@ -164,7 +161,7 @@ module Pod
end end
attr_writer :sandbox_root attr_writer :sandbox_root
alias :project_pods_root :sandbox_root alias_method :project_pods_root, :sandbox_root
# @return [Sandbox] The sandbox of the current project. # @return [Sandbox] The sandbox of the current project.
# #
...@@ -215,7 +212,7 @@ module Pod ...@@ -215,7 +212,7 @@ module Pod
# @return [Pathname] # @return [Pathname]
# #
def default_podfile_path def default_podfile_path
@default_podfile_path ||= templates_dir + "Podfile.default" @default_podfile_path ||= templates_dir + 'Podfile.default'
end end
# Returns the path of the default Podfile test pods. # Returns the path of the default Podfile test pods.
...@@ -225,7 +222,7 @@ module Pod ...@@ -225,7 +222,7 @@ module Pod
# @return [Pathname] # @return [Pathname]
# #
def default_test_podfile_path def default_test_podfile_path
@default_test_podfile_path ||= templates_dir + "Podfile.test" @default_test_podfile_path ||= templates_dir + 'Podfile.test'
end end
# @return [Pathname] The file to use a cache of the statistics provider. # @return [Pathname] The file to use a cache of the statistics provider.
...@@ -234,7 +231,7 @@ module Pod ...@@ -234,7 +231,7 @@ module Pod
cache_root + 'statistics.yml' cache_root + 'statistics.yml'
end end
# @return [Pathname] The file to use to cache the search data. # @return [Pathname] The file to use to cache the search data.
# #
def search_index_file def search_index_file
cache_root + 'search_index.yaml' cache_root + 'search_index.yaml'
...@@ -262,7 +259,7 @@ module Pod ...@@ -262,7 +259,7 @@ module Pod
# @return [Pathname] The path of the file which contains the user settings. # @return [Pathname] The path of the file which contains the user settings.
# #
def user_settings_file def user_settings_file
home_dir + "config.yaml" home_dir + 'config.yaml'
end end
# Sets the values of the attributes with the given hash. # Sets the values of the attributes with the given hash.
...@@ -275,7 +272,7 @@ module Pod ...@@ -275,7 +272,7 @@ module Pod
def configure_with(values_by_key) def configure_with(values_by_key)
return unless values_by_key return unless values_by_key
values_by_key.each do |key, value| values_by_key.each do |key, value|
self.instance_variable_set("@#{key}", value) instance_variable_set("@#{key}", value)
end end
end end
...@@ -327,8 +324,8 @@ module Pod ...@@ -327,8 +324,8 @@ module Pod
# #
# @return [void] # @return [void]
# #
def self.instance=(instance) class << self
@instance = instance attr_writer :instance
end end
# Provides support for accessing the configuration instance in other # Provides support for accessing the configuration instance in other
......
...@@ -78,7 +78,7 @@ module Pod ...@@ -78,7 +78,7 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
# Helper class that allows to write to an {IO} instance taking into account # Helper class that allows to write to an {IO} instance taking into account
# the UI indentation lever. # the UI indentation level.
# #
class Indenter < ::Array class Indenter < ::Array
# @return [Fixnum] The indentation level of the UI. # @return [Fixnum] The indentation level of the UI.
......
...@@ -97,11 +97,19 @@ module Pod ...@@ -97,11 +97,19 @@ module Pod
def pre_download(sandbox) def pre_download(sandbox)
title = "Pre-downloading: `#{name}` #{description}" title = "Pre-downloading: `#{name}` #{description}"
UI.titled_section(title, :verbose_prefix => '-> ') do UI.titled_section(title, :verbose_prefix => '-> ') do
target = sandbox.root + name target = sandbox.pod_dir(name)
target.rmtree if target.exist? target.rmtree if target.exist?
downloader = Downloader.for_target(target, params) downloader = Downloader.for_target(target, params)
downloader.download downloader.download
store_podspec(sandbox, target + "#{name}.podspec")
podspec_path = target + "#{name}.podspec"
json = false
unless Pathname(podspec_path).exist?
podspec_path = target + "#{name}.podspec.json"
json = true
end
store_podspec(sandbox, target + podspec_path, json)
sandbox.store_pre_downloaded_pod(name) sandbox.store_pre_downloaded_pod(name)
if downloader.options_specific? if downloader.options_specific?
source = params source = params
......
...@@ -15,7 +15,7 @@ module Pod ...@@ -15,7 +15,7 @@ module Pod
end end
def save_as(pathname) def save_as(pathname)
gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'} gen_bridge_metadata %(-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}')
end end
end end
end end
......
module Pod module Pod
module Generator module Generator
class CopyResourcesScript class CopyResourcesScript
# @return [Array<#to_s>] A list of files relative to the project pods # @return [Array<#to_s>] A list of files relative to the project pods
# root. # root.
# #
...@@ -44,7 +43,7 @@ module Pod ...@@ -44,7 +43,7 @@ module Pod
# #
EXTERNAL_STRINGS_FILE_MIMINUM_DEPLOYMENT_TARGET = { EXTERNAL_STRINGS_FILE_MIMINUM_DEPLOYMENT_TARGET = {
:ios => Version.new('6.0'), :ios => Version.new('6.0'),
:osx => Version.new('10.8') :osx => Version.new('10.8'),
} }
# @return [Bool] Whether the external strings file is supported by the # @return [Bool] Whether the external strings file is supported by the
...@@ -58,11 +57,11 @@ module Pod ...@@ -58,11 +57,11 @@ module Pod
# @return [String] The install resources shell function. # @return [String] The install resources shell function.
# #
def install_resources_function def install_resources_function
if use_external_strings_file? if use_external_strings_file?
INSTALL_RESOURCES_FUCTION INSTALL_RESOURCES_FUCTION
else else
INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '') INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '')
end end
end end
# @return [String] The contents of the copy resources script. # @return [String] The contents of the copy resources script.
...@@ -70,14 +69,13 @@ module Pod ...@@ -70,14 +69,13 @@ module Pod
def script def script
script = install_resources_function script = install_resources_function
resources.each do |resource| resources.each do |resource|
script += %Q[install_resource "#{resource}"\n] script += %( install_resource "#{resource}"\n )
end end
script += RSYNC_CALL script += RSYNC_CALL
script += XCASSETS_COMPILE script += XCASSETS_COMPILE
script script
end end
INSTALL_RESOURCES_FUCTION = <<EOS INSTALL_RESOURCES_FUCTION = <<EOS
#!/bin/sh #!/bin/sh
set -e set -e
...@@ -124,7 +122,6 @@ install_resource() ...@@ -124,7 +122,6 @@ install_resource()
} }
EOS EOS
RSYNC_CALL = <<EOS RSYNC_CALL = <<EOS
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
...@@ -134,12 +131,11 @@ fi ...@@ -134,12 +131,11 @@ fi
rm -f "$RESOURCES_TO_COPY" rm -f "$RESOURCES_TO_COPY"
EOS EOS
XCASSETS_COMPILE = <<EOS XCASSETS_COMPILE = <<EOS
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ]
then then
case "${TARGETED_DEVICE_FAMILY}" in case "${TARGETED_DEVICE_FAMILY}" in
1,2) 1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;; ;;
...@@ -151,8 +147,8 @@ then ...@@ -151,8 +147,8 @@ then
;; ;;
*) *)
TARGET_DEVICE_ARGS="--target-device mac" TARGET_DEVICE_ARGS="--target-device mac"
;; ;;
esac esac
find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi fi
EOS EOS
......
module Pod module Pod
module Generator module Generator
# Generates a prefix header file for a Pods library. The prefix header is # Generates a prefix header file for a Pods library. The prefix header is
# generated according to the platform of the target and the pods. # generated according to the platform of the target and the pods.
# #
...@@ -8,7 +7,6 @@ module Pod ...@@ -8,7 +7,6 @@ module Pod
# `Cocoa/Cocoa.h`. # `Cocoa/Cocoa.h`.
# #
class PrefixHeader class PrefixHeader
# @return [Array<FileAccessor>] The file accessors for which to generate # @return [Array<FileAccessor>] The file accessors for which to generate
# the prefix header. # the prefix header.
# #
...@@ -55,10 +53,10 @@ module Pod ...@@ -55,10 +53,10 @@ module Pod
result << "#endif\n" result << "#endif\n"
imports.each do |import| imports.each do |import|
result << %|\n#import "#{import}"| result << %(\n#import "#{import}")
end end
unique_prefix_header_contents = file_accessors.collect do |file_accessor| unique_prefix_header_contents = file_accessors.map do |file_accessor|
file_accessor.spec_consumer.prefix_header_contents file_accessor.spec_consumer.prefix_header_contents
end.compact.uniq end.compact.uniq
...@@ -87,7 +85,6 @@ module Pod ...@@ -87,7 +85,6 @@ module Pod
def save_as(path) def save_as(path)
path.open('w') { |header| header.write(generate) } path.open('w') { |header| header.write(generate) }
end end
end end
end end
end end
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths), 'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths),
'PODS_ROOT' => target.relative_pods_root, 'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1', 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem') 'OTHER_CFLAGS' => '$(inherited) ' + XCConfigHelper.quote(header_search_path_flags, '-isystem'),
) )
target.pod_targets.each do |pod_target| target.pod_targets.each do |pod_target|
......
module Pod module Pod
# @todo: Remove by CocoaPods 1.0
#
class Podfile class Podfile
def config def config
UI.warn 'Podfile#config is deprecated. The config is accessible from ' \ UI.warn 'Podfile#config is deprecated. The config is accessible from ' \
'the parameter passed to the hooks' 'the parameter passed to the hooks'
Config.instance Config.instance
end end
end
class Podfile::TargetDefinition class TargetDefinition
def copy_resources_script_name def copy_resources_script_name
UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \ UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \
'The value is accessible directly from the representation of the ' \ 'The value is accessible directly from the representation of the ' \
'library using the #copy_resources_script_path method.' 'library using the #copy_resources_script_path method.'
Config.instance.sandbox.root + "#{label}-resources.sh" Config.instance.sandbox.root + "#{label}-resources.sh"
end
end end
end end
......
...@@ -28,14 +28,15 @@ module Pod ...@@ -28,14 +28,15 @@ module Pod
# source control. # source control.
# #
class Installer class Installer
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
autoload :Analyzer, 'cocoapods/installer/analyzer' autoload :Analyzer, 'cocoapods/installer/analyzer'
autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer' autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
autoload :HooksContext, 'cocoapods/installer/hooks_context'
autoload :Migrator, 'cocoapods/installer/migrator'
autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer' autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
autoload :PodTargetInstaller, 'cocoapods/installer/target_installer/pod_target_installer' autoload :PodTargetInstaller, 'cocoapods/installer/target_installer/pod_target_installer'
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator' autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator'
autoload :HooksContext, 'cocoapods/installer/hooks_context'
include Config::Mixin include Config::Mixin
...@@ -85,6 +86,7 @@ module Pod ...@@ -85,6 +86,7 @@ module Pod
# @return [void] # @return [void]
# #
def install! def install!
prepare
resolve_dependencies resolve_dependencies
download_dependencies download_dependencies
generate_pods_project generate_pods_project
...@@ -92,6 +94,13 @@ module Pod ...@@ -92,6 +94,13 @@ module Pod
perform_post_install_actions perform_post_install_actions
end end
def prepare
UI.section 'Preparing' do
sandbox.prepare
Migrator.migrate(sandbox)
end
end
def resolve_dependencies def resolve_dependencies
UI.section 'Analyzing dependencies' do UI.section 'Analyzing dependencies' do
analyze analyze
...@@ -393,7 +402,7 @@ module Pod ...@@ -393,7 +402,7 @@ module Pod
# @return [void] # @return [void]
# #
def install_libraries def install_libraries
UI.message'- Installing libraries' do UI.message '- Installing targets' do
pod_targets.sort_by(&:name).each do |pod_target| pod_targets.sort_by(&:name).each do |pod_target|
next if pod_target.target_definition.empty? next if pod_target.target_definition.empty?
target_installer = PodTargetInstaller.new(sandbox, pod_target) target_installer = PodTargetInstaller.new(sandbox, pod_target)
......
...@@ -47,10 +47,10 @@ module Pod ...@@ -47,10 +47,10 @@ module Pod
def analyze(allow_fetches = true) def analyze(allow_fetches = true)
update_repositories_if_needed if allow_fetches update_repositories_if_needed if allow_fetches
@result = AnalysisResult.new @result = AnalysisResult.new
compute_target_platforms
@result.podfile_state = generate_podfile_state @result.podfile_state = generate_podfile_state
@locked_dependencies = generate_version_locking_dependencies @locked_dependencies = generate_version_locking_dependencies
compute_target_platforms
fetch_external_sources if allow_fetches fetch_external_sources if allow_fetches
@result.specs_by_target = resolve_dependencies @result.specs_by_target = resolve_dependencies
@result.specifications = generate_specifications @result.specifications = generate_specifications
...@@ -150,7 +150,8 @@ module Pod ...@@ -150,7 +150,8 @@ module Pod
UI.section 'Finding Podfile changes' do UI.section 'Finding Podfile changes' do
pods_by_state = lockfile.detect_changes_with_podfile(podfile) pods_by_state = lockfile.detect_changes_with_podfile(podfile)
pods_by_state.dup.each do |state, full_names| pods_by_state.dup.each do |state, full_names|
pods_by_state[state] = full_names.map { |fn| Specification.root_name(fn) } pods = full_names.map { |fn| Specification.root_name(fn) }.uniq
pods_by_state[state] = pods
end end
pods_state = SpecsState.new(pods_by_state) pods_state = SpecsState.new(pods_by_state)
pods_state.print pods_state.print
...@@ -165,8 +166,6 @@ module Pod ...@@ -165,8 +166,6 @@ module Pod
# Updates the source repositories unless the config indicates to skip it. # Updates the source repositories unless the config indicates to skip it.
# #
# @return [void]
#
def update_repositories_if_needed def update_repositories_if_needed
unless config.skip_repo_update? unless config.skip_repo_update?
UI.section 'Updating spec repositories' do UI.section 'Updating spec repositories' do
...@@ -245,8 +244,8 @@ module Pod ...@@ -245,8 +244,8 @@ module Pod
locking_pods = locking_pods.select { |pod| !update[:pods].include?(pod) } locking_pods = locking_pods.select { |pod| !update[:pods].include?(pod) }
end end
locking_pods.map do |pod| locking_pods.map do |pod|
lockfile.dependency_to_lock_pod_named(pod) lockfile.dependencies_to_lock_pod_named(pod)
end end.flatten
end end
end end
...@@ -319,7 +318,13 @@ module Pod ...@@ -319,7 +318,13 @@ module Pod
def resolve_dependencies def resolve_dependencies
specs_by_target = nil specs_by_target = nil
UI.section "Resolving dependencies of #{UI.path podfile.defined_in_file}" do UI.section "Resolving dependencies of #{UI.path podfile.defined_in_file}" do
resolver = Resolver.new(sandbox, podfile, locked_dependencies) if podfile.sources.empty?
sources = SourcesManager.master
else
sources = SourcesManager.sources(podfile.sources)
end
resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources)
specs_by_target = resolver.resolve specs_by_target = resolver.resolve
end end
specs_by_target specs_by_target
...@@ -482,7 +487,7 @@ module Pod ...@@ -482,7 +487,7 @@ module Pod
# @todo Is assigning the platform to the target definition the best way # @todo Is assigning the platform to the target definition the best way
# to go? # to go?
# #
def compute_archs_for_target_definition(_target_definition, user_targets) def compute_archs_for_target_definition(target_definition, user_targets)
archs = [] archs = []
user_targets.each do |target| user_targets.each do |target|
target_archs = target.common_resolved_build_setting('ARCHS') target_archs = target.common_resolved_build_setting('ARCHS')
...@@ -490,7 +495,9 @@ module Pod ...@@ -490,7 +495,9 @@ module Pod
end end
archs = archs.compact.uniq.sort archs = archs.compact.uniq.sort
UI.puts("Using `ARCHS` setting to build architectures: (`#{archs.join('`, `')}`)") UI.message("Using `ARCHS` setting to build architectures of " \
"target `#{target_definition.label}`: " \
"(`#{archs.join('`, `')}`)")
archs.length > 1 ? archs : archs.first archs.length > 1 ? archs : archs.first
end end
...@@ -503,17 +510,19 @@ module Pod ...@@ -503,17 +510,19 @@ module Pod
# @return [void] # @return [void]
# #
def compute_target_platforms def compute_target_platforms
podfile.target_definition_list.each do |target_definition| UI.section 'Inspecting targets to integrate' do
if config.integrate_targets? podfile.target_definition_list.each do |target_definition|
project_path = compute_user_project_path(target_definition) if config.integrate_targets?
user_project = Xcodeproj::Project.open(project_path) project_path = compute_user_project_path(target_definition)
targets = compute_user_project_targets(target_definition, user_project) user_project = Xcodeproj::Project.open(project_path)
platform = compute_platform_for_target_definition(target_definition, targets) targets = compute_user_project_targets(target_definition, user_project)
archs = compute_archs_for_target_definition(target_definition, targets) platform = compute_platform_for_target_definition(target_definition, targets)
@archs_by_target_def[target_definition] = archs archs = compute_archs_for_target_definition(target_definition, targets)
else @archs_by_target_def[target_definition] = archs
unless target_definition.platform else
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.' unless target_definition.platform
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
end
end end
end end
end end
......
...@@ -183,7 +183,7 @@ module Pod ...@@ -183,7 +183,7 @@ module Pod
def header_mappings(headers_sandbox, file_accessor, headers) def header_mappings(headers_sandbox, file_accessor, headers)
consumer = file_accessor.spec_consumer consumer = file_accessor.spec_consumer
dir = headers_sandbox dir = headers_sandbox
dir = dir + consumer.header_dir if consumer.header_dir dir += consumer.header_dir if consumer.header_dir
mappings = {} mappings = {}
headers.each do |header| headers.each do |header|
...@@ -191,7 +191,7 @@ module Pod ...@@ -191,7 +191,7 @@ module Pod
if consumer.header_mappings_dir if consumer.header_mappings_dir
header_mappings_dir = file_accessor.path_list.root + consumer.header_mappings_dir header_mappings_dir = file_accessor.path_list.root + consumer.header_mappings_dir
relative_path = header.relative_path_from(header_mappings_dir) relative_path = header.relative_path_from(header_mappings_dir)
sub_dir = sub_dir + relative_path.dirname sub_dir += relative_path.dirname
end end
mappings[sub_dir] ||= [] mappings[sub_dir] ||= []
mappings[sub_dir] << header mappings[sub_dir] << header
......
require 'fileutils'
module Pod
class Installer
# Migrates installations performed by previous versions of CocoaPods.
#
class Migrator
class << self
# Performs the migration.
#
# @param [Sandbox] The sandbox which should be migrated.
#
def migrate(sandbox)
if sandbox.manifest
migrate_to_0_34(sandbox) if installation_minor?('0.34', sandbox)
end
end
# @!group Migration Steps
# Migrates from CocoaPods versions previous to 0.34.
#
def migrate_to_0_34(sandbox)
UI.message('Migrating to CocoaPods 0.34') do
delete(sandbox.root + 'Headers')
make_path(sandbox.headers_root)
sandbox.root.children.each do |child|
relative = child.relative_path_from(sandbox.root)
case relative.to_s
when 'Manifest.lock', 'Pods.xcodeproj', 'Sources', 'Headers',
'Target Support Files', 'Local Podspecs'
next
when 'BuildHeaders', 'PublicHeaders'
delete(child)
else
if child.directory? && child.extname != '.xcodeproj'
move(child, sandbox.sources_root + relative)
else
delete(child)
end
end
end
end
delete(Pathname(File.join(ENV['HOME'], 'Library/Caches/CocoaPods/Git')))
end
# @!group Private helpers
def installation_minor?(target_version, sandbox)
sandbox.manifest.cocoapods_version < Version.new(target_version)
end
# Makes a path creating any intermediate directory and printing an UI
# message.
#
# @path [#to_s] path
# The path.
#
def make_path(path)
return if path.exist?
UI.message "- Making path #{UI.path(path)}" do
path.mkpath
end
end
# Moves a path to another one printing an UI message.
#
# @path [#to_s] source
# The path to move.
#
# @path [#to_s] destination
# The destination path.
#
def move(source, destination)
return unless source.exist?
make_path(destination.dirname)
UI.message "- Moving #{UI.path(source)} to #{UI.path(destination)}" do
FileUtils.mv(source.to_s, destination.to_s)
end
end
# Deletes a path, including non empty directories, printing an UI
# message.
#
# @path [#to_s] path
# The path.
#
def delete(path)
return unless path.exist?
UI.message "- Deleting #{UI.path(path)}" do
FileUtils.rm_rf(path)
end
end
end
end
end
end
module Pod module Pod
class Installer class Installer
# Controller class responsible of creating and configuring the static # Controller class responsible of creating and configuring the static
# library target in Pods project. It also creates the support file needed # library target in Pods project. It also creates the support file needed
# by the target. # by the target.
# #
class TargetInstaller class TargetInstaller
# @return [Sandbox] sandbox the sandbox where the support files should # @return [Sandbox] sandbox the sandbox where the support files should
# be generated. # be generated.
# #
...@@ -47,7 +45,6 @@ module Pod ...@@ -47,7 +45,6 @@ module Pod
configuration = @target.add_build_configuration(bc_name, type) configuration = @target.add_build_configuration(bc_name, type)
end end
settings = {} settings = {}
if library.archs if library.archs
settings['ARCHS'] = library.archs settings['ARCHS'] = library.archs
...@@ -60,13 +57,10 @@ module Pod ...@@ -60,13 +57,10 @@ module Pod
library.target = @target library.target = @target
end end
# Creates the group that holds the references to the support files # Creates the directory where to store the support files of the target.
# generated by this installer.
#
# @return [void]
# #
def create_suport_files_group def create_support_files_dir
@support_files_group = project.support_files_group.new_group(library.name) library.support_files_dir.mkdir
end end
# Generates a dummy source file for each target so libraries that contain # Generates a dummy source file for each target so libraries that contain
...@@ -76,12 +70,10 @@ module Pod ...@@ -76,12 +70,10 @@ module Pod
# #
def create_dummy_source def create_dummy_source
path = library.dummy_source_path path = library.dummy_source_path
UI.message "- Generating dummy source file at #{UI.path(path)}" do generator = Generator::DummySource.new(library.label)
generator = Generator::DummySource.new(library.label) generator.save_as(path)
generator.save_as(path) file_reference = add_file_to_support_group(path)
file_reference = add_file_to_support_group(path) target.source_build_phase.add_file_reference(file_reference)
target.source_build_phase.add_file_reference(file_reference)
end
end end
# @return [PBXNativeTarget] the target generated by the installation # @return [PBXNativeTarget] the target generated by the installation
...@@ -126,8 +118,6 @@ module Pod ...@@ -126,8 +118,6 @@ module Pod
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
end end
end end
end end
module Pod module Pod
class Installer class Installer
# Creates the targets which aggregate the Pods libraries in the Pods # Creates the targets which aggregate the Pods libraries in the Pods
# project and the relative support files. # project and the relative support files.
# #
class AggregateTargetInstaller < TargetInstaller class AggregateTargetInstaller < TargetInstaller
# Creates the target in the Pods project and the relative support files. # Creates the target in the Pods project and the relative support files.
# #
# @return [void] # @return [void]
...@@ -13,6 +11,7 @@ module Pod ...@@ -13,6 +11,7 @@ module Pod
def install! def install!
UI.message "- Installing target `#{library.name}` #{library.platform}" do UI.message "- Installing target `#{library.name}` #{library.platform}" do
add_target add_target
create_support_files_dir
create_suport_files_group create_suport_files_group
create_xcconfig_file create_xcconfig_file
create_target_environment_header create_target_environment_header
...@@ -27,6 +26,18 @@ module Pod ...@@ -27,6 +26,18 @@ module Pod
private private
# Creates the group that holds the references to the support files
# generated by this installer.
#
# @return [void]
#
def create_suport_files_group
parent = project.support_files_group
name = library.name
dir = library.support_files_dir
@support_files_group = parent.new_group(name, dir)
end
# Generates the contents of the xcconfig file and saves it to disk. # Generates the contents of the xcconfig file and saves it to disk.
# #
# @return [void] # @return [void]
...@@ -34,13 +45,11 @@ module Pod ...@@ -34,13 +45,11 @@ module Pod
def create_xcconfig_file def create_xcconfig_file
target.build_configurations.each do |configuration| target.build_configurations.each do |configuration|
path = library.xcconfig_path(configuration.name) path = library.xcconfig_path(configuration.name)
UI.message "- Generating #{configuration.name} xcconfig file at #{UI.path(path)}" do gen = Generator::XCConfig::AggregateXCConfig.new(library, configuration.name)
gen = Generator::XCConfig::AggregateXCConfig.new(library, configuration.name) gen.save_as(path)
gen.save_as(path) library.xcconfigs[configuration.name] = gen.xcconfig
library.xcconfigs[configuration.name] = gen.xcconfig xcconfig_file_ref = add_file_to_support_group(path)
xcconfig_file_ref = add_file_to_support_group(path) configuration.base_configuration_reference = xcconfig_file_ref
configuration.base_configuration_reference = xcconfig_file_ref
end
end end
end end
...@@ -49,11 +58,9 @@ module Pod ...@@ -49,11 +58,9 @@ module Pod
# #
def create_target_environment_header def create_target_environment_header
path = library.target_environment_header_path path = library.target_environment_header_path
UI.message "- Generating target environment header at #{UI.path(path)}" do generator = Generator::TargetEnvironmentHeader.new(library.specs_by_build_configuration)
generator = Generator::TargetEnvironmentHeader.new(library.specs_by_build_configuration) generator.save_as(path)
generator.save_as(path) add_file_to_support_group(path)
add_file_to_support_group(path)
end
end end
# Generates the bridge support metadata if requested by the {Podfile}. # Generates the bridge support metadata if requested by the {Podfile}.
...@@ -67,13 +74,11 @@ module Pod ...@@ -67,13 +74,11 @@ module Pod
def create_bridge_support_file def create_bridge_support_file
if target_definition.podfile.generate_bridge_support? if target_definition.podfile.generate_bridge_support?
path = library.bridge_support_path path = library.bridge_support_path
UI.message "- Generating BridgeSupport metadata at #{UI.path(path)}" do headers = target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
headers = target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path } generator = Generator::BridgeSupport.new(headers)
generator = Generator::BridgeSupport.new(headers) generator.save_as(path)
generator.save_as(path) add_file_to_support_group(path)
add_file_to_support_group(path) @bridge_support_file = path.relative_path_from(sandbox.root)
@bridge_support_file = path.relative_path_from(sandbox.root)
end
end end
end end
...@@ -87,18 +92,16 @@ module Pod ...@@ -87,18 +92,16 @@ module Pod
# #
def create_copy_resources_script def create_copy_resources_script
path = library.copy_resources_script_path path = library.copy_resources_script_path
UI.message "- Generating copy resources script at #{UI.path(path)}" do file_accessors = library.pod_targets.map(&:file_accessors).flatten
file_accessors = library.pod_targets.map(&:file_accessors).flatten resource_paths = file_accessors.map { |accessor| accessor.resources.flatten.map { |res| res.relative_path_from(project.path.dirname) } }.flatten
resource_paths = file_accessors.map { |accessor| accessor.resources.flatten.map { |res| res.relative_path_from(project.path.dirname) }}.flatten resource_bundles = file_accessors.map { |accessor| accessor.resource_bundles.keys.map { |name| "${BUILT_PRODUCTS_DIR}/#{name}.bundle" } }.flatten
resource_bundles = file_accessors.map { |accessor| accessor.resource_bundles.keys.map {|name| "${BUILT_PRODUCTS_DIR}/#{name}.bundle" } }.flatten resources = []
resources = [] resources.concat(resource_paths)
resources.concat(resource_paths) resources.concat(resource_bundles)
resources.concat(resource_bundles) resources << bridge_support_file if bridge_support_file
resources << bridge_support_file if bridge_support_file generator = Generator::CopyResourcesScript.new(resources, library.platform)
generator = Generator::CopyResourcesScript.new(resources, library.platform) generator.save_as(path)
generator.save_as(path) add_file_to_support_group(path)
add_file_to_support_group(path)
end
end end
# Generates the acknowledgement files (markdown and plist) for the target. # Generates the acknowledgement files (markdown and plist) for the target.
...@@ -109,12 +112,10 @@ module Pod ...@@ -109,12 +112,10 @@ module Pod
basepath = library.acknowledgements_basepath basepath = library.acknowledgements_basepath
Generator::Acknowledgements.generators.each do |generator_class| Generator::Acknowledgements.generators.each do |generator_class|
path = generator_class.path_from_basepath(basepath) path = generator_class.path_from_basepath(basepath)
UI.message "- Generating acknowledgements at #{UI.path(path)}" do file_accessors = library.pod_targets.map(&:file_accessors).flatten
file_accessors = library.pod_targets.map(&:file_accessors).flatten generator = generator_class.new(file_accessors)
generator = generator_class.new(file_accessors) generator.save_as(path)
generator.save_as(path) add_file_to_support_group(path)
add_file_to_support_group(path)
end
end end
end end
...@@ -126,7 +127,6 @@ module Pod ...@@ -126,7 +127,6 @@ module Pod
attr_reader :bridge_support_file attr_reader :bridge_support_file
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
end end
end end
end end
module Pod module Pod
class Installer class Installer
# Creates the target for the Pods libraries in the Pods project and the # Creates the target for the Pods libraries in the Pods project and the
# relative support files. # relative support files.
# #
class PodTargetInstaller < TargetInstaller class PodTargetInstaller < TargetInstaller
# Creates the target in the Pods project and the relative support files. # Creates the target in the Pods project and the relative support files.
# #
# @return [void] # @return [void]
...@@ -13,6 +11,7 @@ module Pod ...@@ -13,6 +11,7 @@ module Pod
def install! def install!
UI.message "- Installing target `#{library.name}` #{library.platform}" do UI.message "- Installing target `#{library.name}` #{library.platform}" do
add_target add_target
create_support_files_dir
add_files_to_build_phases add_files_to_build_phases
add_resources_bundle_targets add_resources_bundle_targets
create_xcconfig_file create_xcconfig_file
...@@ -34,17 +33,15 @@ module Pod ...@@ -34,17 +33,15 @@ module Pod
# @return [void] # @return [void]
# #
def add_files_to_build_phases def add_files_to_build_phases
UI.message "- Adding Build files" do library.file_accessors.each do |file_accessor|
library.file_accessors.each do |file_accessor| consumer = file_accessor.spec_consumer
consumer = file_accessor.spec_consumer flags = compiler_flags_for_consumer(consumer)
flags = compiler_flags_for_consumer(consumer) all_source_files = file_accessor.source_files
all_source_files = file_accessor.source_files regular_source_files = all_source_files.reject { |sf| sf.extname == '.d' }
regular_source_files = all_source_files.reject { |sf| sf.extname == ".d" } regular_file_refs = regular_source_files.map { |sf| project.reference_for_path(sf) }
regular_file_refs = regular_source_files.map { |sf| project.reference_for_path(sf) } target.add_file_references(regular_file_refs, flags)
target.add_file_references(regular_file_refs, flags) other_file_refs = (all_source_files - regular_source_files).map { |sf| project.reference_for_path(sf) }
other_file_refs = (all_source_files - regular_source_files).map { |sf| project.reference_for_path(sf) } target.add_file_references(other_file_refs, nil)
target.add_file_references(other_file_refs, nil)
end
end end
end end
...@@ -56,24 +53,22 @@ module Pod ...@@ -56,24 +53,22 @@ module Pod
# @return [void] # @return [void]
# #
def add_resources_bundle_targets def add_resources_bundle_targets
UI.message "- Adding resource bundles to Pods project" do library.file_accessors.each do |file_accessor|
library.file_accessors.each do |file_accessor| file_accessor.resource_bundles.each do |bundle_name, paths|
file_accessor.resource_bundles.each do |bundle_name, paths| # Add a dependency on an existing Resource Bundle target if possible
# Add a dependency on an existing Resource Bundle target if possible if bundle_target = project.targets.find { |target| target.name == bundle_name }
if bundle_target = project.targets.detect { |target| target.name == bundle_name }
target.add_dependency(bundle_target)
next
end
file_references = paths.map { |sf| project.reference_for_path(sf) }
bundle_target = project.new_resources_bundle(bundle_name, file_accessor.spec_consumer.platform_name)
bundle_target.add_resources(file_references)
library.user_build_configurations.each do |bc_name, type|
bundle_target.add_build_configuration(bc_name, type)
end
target.add_dependency(bundle_target) target.add_dependency(bundle_target)
next
end
file_references = paths.map { |sf| project.reference_for_path(sf) }
bundle_target = project.new_resources_bundle(bundle_name, file_accessor.spec_consumer.platform_name)
bundle_target.add_resources(file_references)
library.user_build_configurations.each do |bc_name, type|
bundle_target.add_build_configuration(bc_name, type)
end end
target.add_dependency(bundle_target)
end end
end end
end end
...@@ -85,20 +80,16 @@ module Pod ...@@ -85,20 +80,16 @@ module Pod
def create_xcconfig_file def create_xcconfig_file
path = library.xcconfig_path path = library.xcconfig_path
public_gen = Generator::XCConfig::PublicPodXCConfig.new(library) public_gen = Generator::XCConfig::PublicPodXCConfig.new(library)
UI.message "- Generating public xcconfig file at #{UI.path(path)}" do public_gen.save_as(path)
public_gen.save_as(path) add_file_to_support_group(path)
add_file_to_support_group(path)
end
path = library.xcconfig_private_path path = library.xcconfig_private_path
private_gen = Generator::XCConfig::PrivatePodXCConfig.new(library, public_gen.xcconfig) private_gen = Generator::XCConfig::PrivatePodXCConfig.new(library, public_gen.xcconfig)
UI.message "- Generating private xcconfig file at #{UI.path(path)}" do private_gen.save_as(path)
private_gen.save_as(path) xcconfig_file_ref = add_file_to_support_group(path)
xcconfig_file_ref = add_file_to_support_group(path)
target.build_configurations.each do |c| target.build_configurations.each do |c|
c.base_configuration_reference = xcconfig_file_ref c.base_configuration_reference = xcconfig_file_ref
end
end end
end end
...@@ -110,22 +101,20 @@ module Pod ...@@ -110,22 +101,20 @@ module Pod
# #
def create_prefix_header def create_prefix_header
path = library.prefix_header_path path = library.prefix_header_path
UI.message "- Generating prefix header at #{UI.path(path)}" do generator = Generator::PrefixHeader.new(library.file_accessors, library.platform)
generator = Generator::PrefixHeader.new(library.file_accessors, library.platform) generator.imports << library.target_environment_header_path.basename
generator.imports << library.target_environment_header_path.basename generator.save_as(path)
generator.save_as(path) add_file_to_support_group(path)
add_file_to_support_group(path)
target.build_configurations.each do |c|
target.build_configurations.each do |c| relative_path = path.relative_path_from(project.path.dirname)
relative_path = path.relative_path_from(sandbox.root) c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
end
end end
end end
ENABLE_OBJECT_USE_OBJC_FROM = { ENABLE_OBJECT_USE_OBJC_FROM = {
:ios => Version.new('6'), :ios => Version.new('6'),
:osx => Version.new('10.8') :osx => Version.new('10.8'),
} }
# Returns the compiler flags for the source files of the given specification. # Returns the compiler flags for the source files of the given specification.
...@@ -176,7 +165,7 @@ module Pod ...@@ -176,7 +165,7 @@ module Pod
if target_definition.inhibits_warnings_for_pod?(consumer.spec.root.name) if target_definition.inhibits_warnings_for_pod?(consumer.spec.root.name)
flags << '-w -Xanalyzer -analyzer-disable-checker' flags << '-w -Xanalyzer -analyzer-disable-checker'
end end
flags * " " flags * ' '
end end
# Adds a reference to the given file in the support group of this target. # Adds a reference to the given file in the support group of this target.
...@@ -188,12 +177,12 @@ module Pod ...@@ -188,12 +177,12 @@ module Pod
# #
def add_file_to_support_group(path) def add_file_to_support_group(path)
pod_name = library.pod_name pod_name = library.pod_name
group = project.pod_support_files_group(pod_name) dir = library.support_files_dir
group = project.pod_support_files_group(pod_name, dir)
group.new_file(path) group.new_file(path)
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
end end
end end
end end
...@@ -28,6 +28,8 @@ module Pod ...@@ -28,6 +28,8 @@ module Pod
def integrate! def integrate!
UI.section(integration_message) do UI.section(integration_message) do
XCConfigIntegrator.integrate(target, native_targets) XCConfigIntegrator.integrate(target, native_targets)
update_to_cocoapods_0_34
unless native_targets_to_integrate.empty? unless native_targets_to_integrate.empty?
add_pods_library add_pods_library
add_copy_resources_script_phase add_copy_resources_script_phase
...@@ -48,6 +50,23 @@ module Pod ...@@ -48,6 +50,23 @@ module Pod
# @!group Integration steps # @!group Integration steps
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
# Fixes the paths of the copy resource scripts.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_34
phases = native_targets.map do |target|
target.shell_script_build_phases.select do |bp|
bp.name == 'Copy Pods Resources'
end
end.flatten
script_path = target.copy_resources_script_relative_path
phases.each do |phase|
phase.shell_script = %("#{script_path}"\n)
end
end
# Adds spec libraries to the frameworks build phase of the # Adds spec libraries to the frameworks build phase of the
# {TargetDefinition} integration libraries. Adds a file reference to # {TargetDefinition} integration libraries. Adds a file reference to
# the library of the {TargetDefinition} and adds it to the frameworks # the library of the {TargetDefinition} and adds it to the frameworks
...@@ -75,10 +94,10 @@ module Pod ...@@ -75,10 +94,10 @@ module Pod
def add_copy_resources_script_phase def add_copy_resources_script_phase
phase_name = 'Copy Pods Resources' phase_name = 'Copy Pods Resources'
native_targets_to_integrate.each do |native_target| native_targets_to_integrate.each do |native_target|
phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first || phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first
native_target.new_shell_script_build_phase(phase_name) phase ||= native_target.new_shell_script_build_phase(phase_name)
path = target.copy_resources_script_relative_path script_path = target.copy_resources_script_relative_path
phase.shell_script = %( "#{path}"\n ) phase.shell_script = %("#{script_path}"\n)
phase.show_env_vars_in_log = '0' phase.show_env_vars_in_log = '0'
end end
end end
...@@ -100,7 +119,7 @@ module Pod ...@@ -100,7 +119,7 @@ module Pod
native_target.build_phases.unshift(phase) native_target.build_phases.unshift(phase)
phase.name = phase_name phase.name = phase_name
phase.shell_script = <<-EOS.strip_heredoc phase.shell_script = <<-EOS.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null diff "${PODS_ROOT}/../../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
cat << EOM cat << EOM
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
...@@ -159,10 +178,8 @@ module Pod ...@@ -159,10 +178,8 @@ module Pod
# integration. # integration.
# #
def integration_message def integration_message
"Integrating Pod #{'target'.pluralize(target.pod_targets.size)} " \ "Integrating target `#{target.name}` " \
"`#{target.pod_targets.map(&:name).to_sentence}` " \ "(#{UI.path target.user_project_path} project)"
"into aggregate target #{target.name} " \
"of project #{UI.path target.user_project_path}."
end end
end end
end end
......
...@@ -18,7 +18,7 @@ module Pod ...@@ -18,7 +18,7 @@ module Pod
def self.integrate(pod_bundle, targets) def self.integrate(pod_bundle, targets)
targets.each do |target| targets.each do |target|
target.build_configurations.each do |config| target.build_configurations.each do |config|
update_from_cocoapods_0_33_1(pod_bundle, targets) update_to_cocoapods_0_34(pod_bundle, targets)
set_target_xcconfig(pod_bundle, config) set_target_xcconfig(pod_bundle, config)
end end
end end
...@@ -40,15 +40,21 @@ module Pod ...@@ -40,15 +40,21 @@ module Pod
# #
# @todo This can be removed for CocoaPods 1.0 # @todo This can be removed for CocoaPods 1.0
# #
def self.update_from_cocoapods_0_33_1(pod_bundle, targets) def self.update_to_cocoapods_0_34(pod_bundle, targets)
sandbox = pod_bundle.sandbox
targets.map(&:project).uniq.each do |project| targets.map(&:project).uniq.each do |project|
path = pod_bundle.xcconfig_relative_path(nil) file_refs = project.files.select do |file_ref|
file_ref = project.files.find { |f| f.path == path } path = file_ref.path.to_s
if file_ref if File.extname(path) == '.xcconfig'
UI.message "- Removing (#{path})" do absolute_path = file_ref.real_path.to_s
absolute_path.start_with?(sandbox.root.to_s) &&
!absolute_path.start_with?(sandbox.target_support_files_root.to_s)
end
end
file_refs.uniq.each do |file_ref|
UI.message "- Removing (#{file_ref.path})" do
file_ref.remove_from_project file_ref.remove_from_project
absolute_path = pod_bundle.xcconfig_path
File.delete(absolute_path) if File.exist?(absolute_path)
end end
end end
end end
...@@ -66,8 +72,9 @@ module Pod ...@@ -66,8 +72,9 @@ module Pod
# #
def self.set_target_xcconfig(pod_bundle, config) def self.set_target_xcconfig(pod_bundle, config)
path = pod_bundle.xcconfig_relative_path(config.name) path = pod_bundle.xcconfig_relative_path(config.name)
file_ref = config.project.files.find { |f| f.path == path } group = config.project['Pods'] || config.project.new_group('Pods')
file_ref ||= config.project.new_file(path) file_ref = group.files.find { |f| f.path == path }
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref config.base_configuration_reference = file_ref
end end
......
...@@ -122,12 +122,11 @@ module Pod ...@@ -122,12 +122,11 @@ module Pod
# #
# @return [PBXGroup] The group. # @return [PBXGroup] The group.
# #
def pod_support_files_group(pod_name) def pod_support_files_group(pod_name, dir)
group = pod_group(pod_name) group = pod_group(pod_name)
support_files_group = group['Support Files'] support_files_group = group['Support Files']
unless support_files_group unless support_files_group
support_files_group = group.new_group('Support Files') support_files_group = group.new_group('Support Files', dir)
support_files_group.source_tree = 'SOURCE_ROOT'
end end
support_files_group support_files_group
end end
......
...@@ -28,14 +28,21 @@ module Pod ...@@ -28,14 +28,21 @@ module Pod
# #
attr_reader :locked_dependencies attr_reader :locked_dependencies
# @return [Array<Source>] The list of the sources which will be used for
# the resolution.
#
attr_accessor :sources
# @param [Sandbox] sandbox @see sandbox # @param [Sandbox] sandbox @see sandbox
# @param [Podfile] podfile @see podfile # @param [Podfile] podfile @see podfile
# @param [Array<Dependency>] locked_dependencies @see locked_dependencies # @param [Array<Dependency>] locked_dependencies @see locked_dependencies
# @param [Array<Source>, Source] sources @see sources
# #
def initialize(sandbox, podfile, locked_dependencies = []) def initialize(sandbox, podfile, locked_dependencies, sources)
@sandbox = sandbox @sandbox = sandbox
@podfile = podfile @podfile = podfile
@locked_dependencies = locked_dependencies @locked_dependencies = locked_dependencies
@sources = Array(sources)
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -51,14 +58,15 @@ module Pod ...@@ -51,14 +58,15 @@ module Pod
# definition. # definition.
# #
def resolve def resolve
@cached_sources = SourcesManager.aggregate
@cached_sets = {} @cached_sets = {}
@cached_specs = {} @cached_specs = {}
@specs_by_target = {} @specs_by_target = {}
target_definitions = podfile.target_definition_list target_definitions = podfile.target_definition_list
target_definitions.each do |target| target_definitions.each do |target|
UI.section "Resolving dependencies for target `#{target.name}' (#{target.platform})" do title = "Resolving dependencies for target `#{target.name}' " \
"(#{target.platform})"
UI.section(title) do
@loaded_specs = [] @loaded_specs = []
find_dependency_specs(podfile, target.dependencies, target) find_dependency_specs(podfile, target.dependencies, target)
specs = cached_specs.values_at(*@loaded_specs).sort_by(&:name) specs = cached_specs.values_at(*@loaded_specs).sort_by(&:name)
...@@ -83,14 +91,6 @@ module Pod ...@@ -83,14 +91,6 @@ module Pod
# !@ Resolution context # !@ Resolution context
# @return [Source::Aggregate] A cache of the sources needed to find the
# podspecs.
#
# @note The sources are cached because frequently accessed by the
# resolver and loading them requires disk activity.
#
attr_accessor :cached_sources
# @return [Hash<String => Set>] A cache that keeps tracks of the sets # @return [Hash<String => Set>] A cache that keeps tracks of the sets
# loaded by the resolution process. # loaded by the resolution process.
# #
...@@ -148,7 +148,7 @@ module Pod ...@@ -148,7 +148,7 @@ module Pod
dependency = locked_dep if locked_dep dependency = locked_dep if locked_dep
UI.message("- #{dependency}", '', 2) do UI.message("- #{dependency}", '', 2) do
set = find_cached_set(dependency) set = find_cached_set(dependency, dependent_spec)
set.required_by(dependency, dependent_spec.to_s) set.required_by(dependency, dependent_spec.to_s)
unless @loaded_specs.include?(dependency.name) unless @loaded_specs.include?(dependency.name)
...@@ -168,38 +168,61 @@ module Pod ...@@ -168,38 +168,61 @@ module Pod
end end
end end
# Loads or returns a previously initialized for the Pod of the given # @return [Set] Loads or returns a previously initialized set for the Pod
# dependency. # of the given dependency.
# #
# @param [Dependency] dependency # @param [Dependency] dependency
# the dependency for which the set is needed. # The dependency for which the set is needed.
#
# @param [#to_s] dependent_spec
# the specification whose dependencies are being resolved. Used
# only for UI purposes.
# #
# @return [Set] the cached set for a given dependency. # @return [Set] the cached set for a given dependency.
# #
def find_cached_set(dependency) def find_cached_set(dependency, dependent_spec)
name = dependency.root_name name = dependency.root_name
unless cached_sets[name] unless cached_sets[name]
if dependency.external_source if dependency.external_source
spec = sandbox.specification(dependency.root_name) spec = sandbox.specification(dependency.root_name)
unless spec unless spec
raise StandardError, "[Bug] Unable to find the specification for `#{dependency}`." raise StandardError, '[Bug] Unable to find the specification ' \
"for `#{dependency}`."
end end
set = Specification::Set::External.new(spec) set = Specification::Set::External.new(spec)
else else
set = cached_sources.search(dependency) set = find_set_from_sources(dependency)
end end
cached_sets[name] = set cached_sets[name] = set
unless set unless set
raise Informative, "Unable to find a specification for `#{dependency}`." raise Informative, 'Unable to find a specification for ' \
"`#{dependency}` depended upon by #{dependent_spec}."
end end
end end
cached_sets[name] cached_sets[name]
end end
# @return [Set] Loads a set for the Pod of the given dependency from the
# sources. The set will be limited to the versions of the first
# source which includes the Pod.
#
# @param [Dependency] dependency
# The dependency for which the set is needed.
#
def find_set_from_sources(dependency)
sources.each_with_object(nil) do |source, _|
set = source.search(dependency)
return set if set
end
end
# Ensures that a specification is compatible with the platform of a target. # Ensures that a specification is compatible with the platform of a target.
# #
# @raise If the specification is not supported by the target. # @raise If the specification is not supported by the target.
# #
# @todo This step is not specific to the resolution process and should be
# performed later in the analysis.
#
# @return [void] # @return [void]
# #
def validate_platform(spec, target) def validate_platform(spec, target)
......
...@@ -11,38 +11,30 @@ module Pod ...@@ -11,38 +11,30 @@ module Pod
# #
# Pods # Pods
# | # |
# +-- User # +-- Headers
# | +-- [Target Name]-configuration.h # | +-- Private
# | +-- Specs # | | +-- [Pod Name]
# | +-- Scripts # | +-- Public
# | +-- [Pod Name]
# | # |
# +-- Generated # +-- Local Podspecs
# +-- Headers # | +-- External Sources
# | +-- Private # | +-- Normal Sources
# | | +-- [Pod Name] # |
# | +-- Public # +-- Target Support Files
# | +-- [Pod Name] # | +-- [Target Name]
# | # | +-- Pods-acknowledgements.markdown
# +-- Sources # | +-- Pods-acknowledgements.plist
# | +-- [Pod Name] # | +-- Pods-dummy.m
# | # | +-- Pods-prefix.pch
# +-- Specs # | +-- Pods.xcconfig
# | +-- External Sources # |
# | +-- Normal Sources # +-- Sources
# | # | +-- [Pod Name]
# +-- Target Support Files # |
# | +-- [Target Name] # +-- Manifest.lock
# | +-- Pods-acknowledgements.markdown # |
# | +-- Pods-acknowledgements.plist # +-- Pods.xcodeproj
# | +-- Pods-dummy.m
# | +-- Pods-prefix.pch
# | +-- Pods.xcconfig
# |
# +-- Manifest.lock
# |
# +-- Pods.xcodeproj
#
# See #833
# #
class Sandbox class Sandbox
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor' autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
...@@ -62,7 +54,7 @@ module Pod ...@@ -62,7 +54,7 @@ module Pod
def initialize(root) def initialize(root)
FileUtils.mkdir_p(root) FileUtils.mkdir_p(root)
@root = Pathname.new(root).realpath @root = Pathname.new(root).realpath
@public_headers = HeadersStore.new(self, 'Headers') @public_headers = HeadersStore.new(self, 'Public')
@predownloaded_pods = [] @predownloaded_pods = []
@head_pods = [] @head_pods = []
@checkout_sources = {} @checkout_sources = {}
...@@ -81,14 +73,6 @@ module Pod ...@@ -81,14 +73,6 @@ module Pod
# #
attr_accessor :project attr_accessor :project
# Removes the sandbox.
#
# @return [void]
#
def implode
root.rmtree
end
# Removes the files of the Pod with the given name from the sandbox. # Removes the files of the Pod with the given name from the sandbox.
# #
# @return [void] # @return [void]
...@@ -103,6 +87,19 @@ module Pod ...@@ -103,6 +87,19 @@ module Pod
podspe_path.rmtree if podspe_path podspe_path.rmtree if podspe_path
end end
# Prepares the sandbox for a new installation removing any file that will
# be regenerated and ensuring that the directories exists.
#
def prepare
FileUtils.rm_rf(headers_root)
FileUtils.rm_rf(target_support_files_root)
FileUtils.mkdir_p(headers_root)
FileUtils.mkdir_p(sources_root)
FileUtils.mkdir_p(specifications_root)
FileUtils.mkdir_p(target_support_files_root)
end
# @return [String] a string representation suitable for debugging. # @return [String] a string representation suitable for debugging.
# #
def inspect def inspect
...@@ -127,17 +124,16 @@ module Pod ...@@ -127,17 +124,16 @@ module Pod
root + 'Pods.xcodeproj' root + 'Pods.xcodeproj'
end end
# Returns the path for the directory where to store the support files of # Returns the path for the directory where the support files of
# a target. # a target are stored.
# #
# @param [String] name # @param [String] name
# The name of the target. # The name of the target.
# #
# @return [Pathname] the path of the support files. # @return [Pathname] the path of the support files.
# #
def library_support_files_dir(_name) def target_support_files_dir(name)
# root + "Target Support Files/#{name}" target_support_files_root + name
root
end end
# Returns the path where the Pod with the given name is stored, taking into # Returns the path where the Pod with the given name is stored, taking into
...@@ -153,8 +149,7 @@ module Pod ...@@ -153,8 +149,7 @@ module Pod
if local?(root_name) if local?(root_name)
Pathname.new(development_pods[root_name]) Pathname.new(development_pods[root_name])
else else
# root + "Sources/#{name}" sources_root + root_name
root + root_name
end end
end end
...@@ -168,10 +163,31 @@ module Pod ...@@ -168,10 +163,31 @@ module Pod
@pods_with_absolute_path.include? name @pods_with_absolute_path.include? name
end end
# @return [Pathname] the directory where to store the documentation. # @return [Pathname] The directory where headers are stored.
# #
def documentation_dir def headers_root
root + 'Documentation' root + 'Headers'
end
# @return [Pathname] The directory where the downloaded sources of
# the Pods are stored.
#
def sources_root
root + 'Sources'
end
# @return [Pathname] the path for the directory where the
# specifications are stored.
#
def specifications_root
root + 'Local Podspecs'
end
# @return [Pathname] The directory where the files generated by
# CocoaPods to support the umbrella targets are stored.
#
def target_support_files_root
root + 'Target Support Files'
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -194,17 +210,6 @@ module Pod ...@@ -194,17 +210,6 @@ module Pod
end end
end end
# @return [Pathname] the path for the directory where to store the
# specifications.
#
# @todo Migrate old installations and store the for all the pods.
# Two folders should be created `External Sources` and `Podspecs`.
#
def specifications_dir(_external_source = false)
# root + "Specifications"
root + 'Local Podspecs'
end
# Returns the path of the specification for the Pod with the # Returns the path of the specification for the Pod with the
# given name, if one is stored. # given name, if one is stored.
# #
...@@ -215,11 +220,11 @@ module Pod ...@@ -215,11 +220,11 @@ module Pod
# @return [Nil] if the podspec is not stored. # @return [Nil] if the podspec is not stored.
# #
def specification_path(name) def specification_path(name)
path = specifications_dir + "#{name}.podspec" path = specifications_root + "#{name}.podspec"
if path.exist? if path.exist?
path path
else else
path = specifications_dir + "#{name}.podspec.json" path = specifications_root + "#{name}.podspec.json"
if path.exist? if path.exist?
path path
else else
...@@ -240,9 +245,9 @@ module Pod ...@@ -240,9 +245,9 @@ module Pod
# @todo Store all the specifications (including those not originating # @todo Store all the specifications (including those not originating
# from external sources) so users can check them. # from external sources) so users can check them.
# #
def store_podspec(name, podspec, external_source = false, json = false) def store_podspec(name, podspec, _external_source = false, json = false)
file_name = json ? "#{name}.podspec.json" : "#{name}.podspec" file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
output_path = specifications_dir(external_source) + file_name output_path = specifications_root + file_name
output_path.dirname.mkpath output_path.dirname.mkpath
if podspec.is_a?(String) if podspec.is_a?(String)
output_path.open('w') { |f| f.puts(podspec) } output_path.open('w') { |f| f.puts(podspec) }
......
...@@ -7,7 +7,7 @@ module Pod ...@@ -7,7 +7,7 @@ module Pod
# @return [Pathname] the absolute path of this header directory. # @return [Pathname] the absolute path of this header directory.
# #
def root def root
@root ||= @sandbox.root + @relative_path sandbox.headers_root + @relative_path
end end
# @return [Sandbox] the sandbox where this header directory is stored. # @return [Sandbox] the sandbox where this header directory is stored.
...@@ -31,7 +31,8 @@ module Pod ...@@ -31,7 +31,8 @@ module Pod
# root with the `${PODS_ROOT}` variable. # root with the `${PODS_ROOT}` variable.
# #
def search_paths def search_paths
@search_paths.uniq.map { |path| "${PODS_ROOT}/#{path}" } headers_dir = root.relative_path_from(sandbox.root).dirname
@search_paths.uniq.map { |path| "${PODS_ROOT}/#{headers_dir}/#{path}" }
end end
# Removes the directory as it is regenerated from scratch during each # Removes the directory as it is regenerated from scratch during each
...@@ -56,7 +57,8 @@ module Pod ...@@ -56,7 +57,8 @@ module Pod
# headers directory. # headers directory.
# #
# @param [Pathname] relative_header_path # @param [Pathname] relative_header_path
# the path of the header file relative to the sandbox. # the path of the header file relative to the Pods project
# (`PODS_ROOT` variable of the xcconfigs).
# #
# @note This method adds the files to the search paths. # @note This method adds the files to the search paths.
# #
...@@ -68,7 +70,7 @@ module Pod ...@@ -68,7 +70,7 @@ module Pod
namespaced_path.mkpath unless File.exist?(namespaced_path) namespaced_path.mkpath unless File.exist?(namespaced_path)
relative_header_paths.map do |relative_header_path| relative_header_paths.map do |relative_header_path|
absolute_source = (@sandbox.root + relative_header_path) absolute_source = (sandbox.root + relative_header_path)
source = absolute_source.relative_path_from(namespaced_path) source = absolute_source.relative_path_from(namespaced_path)
Dir.chdir(namespaced_path) do Dir.chdir(namespaced_path) do
FileUtils.ln_sf(source, relative_header_path.basename) FileUtils.ln_sf(source, relative_header_path.basename)
......
...@@ -5,25 +5,36 @@ module Pod ...@@ -5,25 +5,36 @@ module Pod
class << self class << self
include Config::Mixin include Config::Mixin
# @return [Source::Aggregate] the aggregate of all the sources known to # @return [Source::Aggregate] The aggregate of all the sources with the
# this installation of CocoaPods. # known Pods.
# #
def aggregate def aggregate
Source::Aggregate.new(config.repos_dir) dirs = config.repos_dir.children.select(&:directory?)
Source::Aggregate.new(dirs)
end end
# @return [Array<Source>] the list of all the sources known to this # @return [Array<Source>] The list of the sources with the given names.
#
# @param [Array<#to_s>] names
# The names of the sources.
#
def sources(names)
dirs = names.map { |name| source_dir(name) }
dirs.map { |repo| Source.new(repo) }
end
# @return [Array<Source>] The list of all the sources known to this
# installation of CocoaPods. # installation of CocoaPods.
# #
def all def all
aggregate.all dirs = config.repos_dir.children.select(&:directory?)
dirs.map { |repo| Source.new(repo) }
end end
# @return [Array<Specification::Set>] the list of all the specification # @return [Source] The CocoaPods Master Repo source.
# sets know to this installation of CocoaPods.
# #
def all_sets def master
aggregate.all_sets sources(['master'])
end end
# Search all the sources to match the set for the given dependency. # Search all the sources to match the set for the given dependency.
...@@ -126,10 +137,7 @@ module Pod ...@@ -126,10 +137,7 @@ module Pod
Config.instance.search_index_file Config.instance.search_index_file
end end
public
# @!group Updating Sources # @!group Updating Sources
#-----------------------------------------------------------------------#
extend Executable extend Executable
executable :git executable :git
...@@ -267,10 +275,7 @@ module Pod ...@@ -267,10 +275,7 @@ module Pod
end end
end end
public
# @!group Master repo # @!group Master repo
#-----------------------------------------------------------------------#
# @return [Pathname] The path of the master repo. # @return [Pathname] The path of the master repo.
# #
...@@ -287,8 +292,6 @@ module Pod ...@@ -287,8 +292,6 @@ module Pod
master_repo_dir.exist? && repo_compatible?(master_repo_dir) master_repo_dir.exist? && repo_compatible?(master_repo_dir)
end end
#-----------------------------------------------------------------------#
private private
# @return [Bool] Whether the given path is writable by the current user. # @return [Bool] Whether the given path is writable by the current user.
...@@ -307,7 +310,7 @@ module Pod ...@@ -307,7 +310,7 @@ module Pod
# The name of the source. # The name of the source.
# #
def git_source_named(name) def git_source_named(name)
specified_source = aggregate.all.find { |s| s.name == name } specified_source = aggregate.sources.find { |s| s.name == name }
unless specified_source unless specified_source
raise Informative, "Unable to find the `#{name}` repo." raise Informative, "Unable to find the `#{name}` repo."
end end
...@@ -320,10 +323,23 @@ module Pod ...@@ -320,10 +323,23 @@ module Pod
# @return [Source] The list of the git sources. # @return [Source] The list of the git sources.
# #
def git_sources def git_sources
aggregate.all.select do |source| all.select do |source|
git_repo?(source.data_provider.repo) git_repo?(source.data_provider.repo)
end end
end end
# @return [Pathname] The path of the source with the given name.
#
# @param [String] name
# The name of the source.
#
def source_dir(name)
if dir = config.repos_dir + name
dir
else
raise Informative, "Unable to find the `#{name}` repo."
end
end
end end
end end
end end
...@@ -71,8 +71,8 @@ module Pod ...@@ -71,8 +71,8 @@ module Pod
# @return [Pathname] the folder where to store the support files of this # @return [Pathname] the folder where to store the support files of this
# library. # library.
# #
def support_files_root def support_files_dir
@sandbox.library_support_files_dir(name) sandbox.target_support_files_dir(name)
end end
# @param [String] variant # @param [String] variant
...@@ -83,41 +83,42 @@ module Pod ...@@ -83,41 +83,42 @@ module Pod
# #
def xcconfig_path(variant = nil) def xcconfig_path(variant = nil)
if variant if variant
support_files_root + "#{label}.#{variant.downcase}.xcconfig" support_files_dir + "#{label}.#{variant.downcase}.xcconfig"
else else
support_files_root + "#{label}.xcconfig" support_files_dir + "#{label}.xcconfig"
end end
end end
# @return [Pathname] the absolute path of the private xcconfig file. # @return [Pathname] the absolute path of the private xcconfig file.
# #
def xcconfig_private_path def xcconfig_private_path
support_files_root + "#{label}-Private.xcconfig" support_files_dir + "#{label}-Private.xcconfig"
end end
# @return [Pathname] the absolute path of the header file which contains # @return [Pathname] the absolute path of the header file which contains
# the information about the installed pods. # the information about the installed pods.
# #
def target_environment_header_path def target_environment_header_path
support_files_root + "#{target_definition.label}-environment.h" name = target_definition.label
sandbox.target_support_files_dir(name) + "#{name}-environment.h"
end end
# @return [Pathname] the absolute path of the prefix header file. # @return [Pathname] the absolute path of the prefix header file.
# #
def prefix_header_path def prefix_header_path
support_files_root + "#{label}-prefix.pch" support_files_dir + "#{label}-prefix.pch"
end end
# @return [Pathname] the absolute path of the bridge support file. # @return [Pathname] the absolute path of the bridge support file.
# #
def bridge_support_path def bridge_support_path
support_files_root + "#{label}.bridgesupport" support_files_dir + "#{label}.bridgesupport"
end end
# @return [Pathname] the path of the dummy source generated by CocoaPods # @return [Pathname] the path of the dummy source generated by CocoaPods
# #
def dummy_source_path def dummy_source_path
support_files_root + "#{label}-dummy.m" support_files_dir + "#{label}-dummy.m"
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -102,20 +102,20 @@ module Pod ...@@ -102,20 +102,20 @@ module Pod
# the file type. # the file type.
# #
def acknowledgements_basepath def acknowledgements_basepath
support_files_root + "#{label}-acknowledgements" support_files_dir + "#{label}-acknowledgements"
end end
# @return [Pathname] The absolute path of the copy resources script. # @return [Pathname] The absolute path of the copy resources script.
# #
def copy_resources_script_path def copy_resources_script_path
support_files_root + "#{label}-resources.sh" support_files_dir + "#{label}-resources.sh"
end end
# @return [String] The xcconfig path of the root from the `$(SRCROOT)` # @return [String] The xcconfig path of the root from the `$(SRCROOT)`
# variable of the user's project. # variable of the user's project.
# #
def relative_pods_root def relative_pods_root
"${SRCROOT}/#{support_files_root.relative_path_from(client_root)}" "${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}"
end end
# @param [String] config_name The build configuration name to get the xcconfig for # @param [String] config_name The build configuration name to get the xcconfig for
......
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
@specs = specs @specs = specs
@target_definition = target_definition @target_definition = target_definition
@sandbox = sandbox @sandbox = sandbox
@build_headers = Sandbox::HeadersStore.new(sandbox, 'BuildHeaders') @build_headers = Sandbox::HeadersStore.new(sandbox, 'Build')
@file_accessors = [] @file_accessors = []
end end
...@@ -80,8 +80,8 @@ module Pod ...@@ -80,8 +80,8 @@ module Pod
else else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \ raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \ "different build configurations for the `#{target_definition}` " \
'target. CocoaPods does not support subspecs across different ' \ 'target. CocoaPods does not currently support subspecs across ' \
'build configurations.' 'different build configurations.'
end end
end end
......
...@@ -145,7 +145,9 @@ module Pod ...@@ -145,7 +145,9 @@ module Pod
# #
def path(pathname) def path(pathname)
if pathname if pathname
path = pathname.relative_path_from((config.podfile_path.dirname if config.podfile_path) || Pathname.pwd) from_path = config.podfile_path.dirname if config.podfile_path
from_path ||= Pathname.pwd
path = Pathname(pathname).relative_path_from(from_path)
"`#{path}`" "`#{path}`"
else else
'' ''
......
...@@ -124,10 +124,8 @@ module Pod ...@@ -124,10 +124,8 @@ module Pod
# #
# @note Uses the `:path` option of the Podfile. # @note Uses the `:path` option of the Podfile.
# #
attr_writer :local attr_accessor :local
def local? alias_method :local?, :local
@local
end
# @return [Bool] Whether the validator should fail only on errors or also # @return [Bool] Whether the validator should fail only on errors or also
# on warnings. # on warnings.
......
Subproject commit cba2640d5c2e410d8b9d8e401d3ad65904ef8bd4 Subproject commit 64203384a3ac363eab602bc6f09004d483f594e1
...@@ -15,9 +15,9 @@ module Pod ...@@ -15,9 +15,9 @@ module Pod
it 'converts a podspec to JSON and prints it to STDOUT' do it 'converts a podspec to JSON and prints it to STDOUT' do
out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec')) out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec'))
out.should.match /"name":"BananaLib"/ out.should.match /"name": "BananaLib"/
out.should.match /"version":"1.0"/ out.should.match /"version": "1.0"/
out.should.match /"description":"Full of chunky bananas."/ out.should.match /"description": "Full of chunky bananas."/
end end
end end
......
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
@sut.any_instance.stubs(:clone_template) @sut.any_instance.stubs(:clone_template)
dir = SpecHelper.temporary_directory + 'TestPod' dir = SpecHelper.temporary_directory + 'TestPod'
dir.mkpath dir.mkpath
File.stubs(:exists?).with('configure').returns(true) File.stubs(:exist?).with('configure').returns(true)
@sut.any_instance.expects(:system).with('./configure TestPod').once @sut.any_instance.expects(:system).with('./configure TestPod').once
run_command('lib', 'create', 'TestPod') run_command('lib', 'create', 'TestPod')
end end
......
...@@ -18,7 +18,7 @@ module Pod ...@@ -18,7 +18,7 @@ module Pod
end end
it 'returns the new pods' do it 'returns the new pods' do
sets = SourcesManager.all_sets sets = SourcesManager.aggregate.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' } jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
dates = { dates = {
'BananaLib' => Time.now, 'BananaLib' => Time.now,
...@@ -30,7 +30,7 @@ module Pod ...@@ -30,7 +30,7 @@ module Pod
end end
it 'presents the known pods with versions' do it 'presents the known pods with versions' do
sets = SourcesManager.all_sets sets = SourcesManager.aggregate.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' } jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
out = run_command('list') out = run_command('list')
......
...@@ -68,8 +68,10 @@ module Pod ...@@ -68,8 +68,10 @@ module Pod
it 'for a single missing Pod' do it 'for a single missing Pod' do
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', '--no-repo-update') }.should.raise Informative should.raise Informative do
exception.message.should.include 'Pod `Reachability` is not installed and cannot be updated' run_command('update', 'Reachability', '--no-repo-update')
end.message.should.include 'The `Reachability` Pod is not ' \
'installed and cannot be updated'
end end
end end
......
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
# README!
#
# Adds {Command::Spec::Edit#exec} to fake the {Kernel#exec} call that would
# normally be made during an edit.
#
module Pod
class Command
class Spec
class Edit
def exec(cmd, *args)
UI.puts "#{cmd} #{args.join(' ')}"
raise SystemExit
end
end
end
end
end
module Pod module Pod
describe Command::Spec do describe Command::Spec do
...@@ -254,7 +272,7 @@ module Pod ...@@ -254,7 +272,7 @@ module Pod
end end
it "complains if it can't find a spec file for the given spec" do it "complains if it can't find a spec file for the given spec" do
File.stubs(:exists?).returns(false) File.stubs(:exist?).returns(false)
lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise Informative lambda { command('spec', 'edit', 'AFNetworking').run }.should.raise Informative
File.unstub(:exists?) File.unstub(:exists?)
end end
......
...@@ -65,7 +65,7 @@ CLIntegracon.configure do |c| ...@@ -65,7 +65,7 @@ CLIntegracon.configure do |c|
# Register special handling for YAML files # Register special handling for YAML files
paths = [%r{Podfile\.lock}, %r{Manifest\.lock$}, %r{xcodeproj\.yaml$}] paths = [%r{Podfile\.lock}, %r{Manifest\.lock$}, %r{xcodeproj\.yaml$}]
c.has_special_handling_for *paths do |path| c.has_special_handling_for(*paths) do |path|
if RUBY_VERSION < '1.9' if RUBY_VERSION < '1.9'
nil # CP is not sorting array derived from hashes whose order is nil # CP is not sorting array derived from hashes whose order is
# undefined in 1.8.7 # undefined in 1.8.7
......
...@@ -67,24 +67,6 @@ module Pod ...@@ -67,24 +67,6 @@ module Pod
end end
end end
# README!
#
# Adds {Command::Spec::Edit#exec} to fake the {Kernel#exec} call that would
# normally be made during an edit.
#
module Pod
class Command
class Spec
class Edit
def exec(cmd, *args)
UI.puts "#{cmd} #{args.join(' ')}"
raise SystemExit
end
end
end
end
end
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
ENV['SKIP_SETUP'] = 'true' ENV['SKIP_SETUP'] = 'true'
......
...@@ -3,19 +3,19 @@ require File.expand_path('../../spec_helper', __FILE__) ...@@ -3,19 +3,19 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod module Pod
describe Command do describe Command do
it 'returns the proper command class' do it 'returns the proper command class' do
Command.parse(%w( install )).should.be.instance_of Command::Install Command.parse(%w(install )).should.be.instance_of Command::Install
Command.parse(%w( list )).should.be.instance_of Command::List Command.parse(%w(list )).should.be.instance_of Command::List
Command.parse(%w( outdated )).should.be.instance_of Command::Outdated Command.parse(%w(outdated )).should.be.instance_of Command::Outdated
Command.parse(%w( repo )).should.be.instance_of Command::Repo Command.parse(%w(repo )).should.be.instance_of Command::Repo
Command.parse(%w( repo add )).should.be.instance_of Command::Repo::Add Command.parse(%w(repo add )).should.be.instance_of Command::Repo::Add
Command.parse(%w( repo lint )).should.be.instance_of Command::Repo::Lint Command.parse(%w(repo lint )).should.be.instance_of Command::Repo::Lint
Command.parse(%w( repo update )).should.be.instance_of Command::Repo::Update Command.parse(%w(repo update )).should.be.instance_of Command::Repo::Update
Command.parse(%w( repo remove )).should.be.instance_of Command::Repo::Remove Command.parse(%w(repo remove )).should.be.instance_of Command::Repo::Remove
Command.parse(%w( search )).should.be.instance_of Command::Search Command.parse(%w(search )).should.be.instance_of Command::Search
Command.parse(%w( setup )).should.be.instance_of Command::Setup Command.parse(%w(setup )).should.be.instance_of Command::Setup
Command.parse(%w( spec create )).should.be.instance_of Command::Spec::Create Command.parse(%w(spec create )).should.be.instance_of Command::Spec::Create
Command.parse(%w( spec lint )).should.be.instance_of Command::Spec::Lint Command.parse(%w(spec lint )).should.be.instance_of Command::Spec::Lint
Command.parse(%w( init )).should.be.instance_of Command::Init Command.parse(%w(init )).should.be.instance_of Command::Init
end end
end end
end end
...@@ -6,6 +6,7 @@ module Pod ...@@ -6,6 +6,7 @@ module Pod
before do before do
dependency = Dependency.new('Reachability', :git => fixture('integration/Reachability')) dependency = Dependency.new('Reachability', :git => fixture('integration/Reachability'))
@subject = ExternalSources.from_dependency(dependency, nil) @subject = ExternalSources.from_dependency(dependency, nil)
config.sandbox.prepare
end end
#--------------------------------------# #--------------------------------------#
...@@ -35,18 +36,28 @@ module Pod ...@@ -35,18 +36,28 @@ module Pod
describe 'Subclasses helpers' do describe 'Subclasses helpers' do
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
sandbox = config.sandbox @subject.send(:pre_download, config.sandbox)
@subject.send(:pre_download, sandbox) path = config.sandbox.specifications_root + 'Reachability.podspec'
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist? path.should.exist?
sandbox.predownloaded_pods.should == ['Reachability'] config.sandbox.predownloaded_pods.should == ['Reachability']
sandbox.checkout_sources.should == { config.sandbox.checkout_sources.should == {
'Reachability' => { 'Reachability' => {
:git => fixture('integration/Reachability'), :git => fixture('integration/Reachability'),
:commit => '4ec575e4b074dcc87c44018cce656672a979b34a', :commit => '4ec575e4b074dcc87c44018cce656672a979b34a',
}, },
} }
end end
it 'checks for JSON podspecs' do
path = config.sandbox.pod_dir('Reachability')
podspec_path = path + 'Reachability.podspec.json'
Dir.mkdir(path)
File.open(podspec_path, 'w') {}
Pathname.any_instance.stubs(:rmtree)
Downloader::Git.any_instance.stubs(:download)
config.sandbox.expects(:store_podspec).with('Reachability', podspec_path, true, true)
@subject.send(:pre_download, config.sandbox)
end
end end
end end
end end
...@@ -13,7 +13,7 @@ module Pod ...@@ -13,7 +13,7 @@ module Pod
it 'creates a copy of the podspec' do it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist? path.should.exist?
end end
......
...@@ -5,45 +5,45 @@ module Pod ...@@ -5,45 +5,45 @@ module Pod
before do before do
params = { :path => fixture('integration/Reachability') } params = { :path => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params) dependency = Dependency.new('Reachability', params)
podfile_path = fixture('integration/Podfile') podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path) @subject = ExternalSources.from_dependency(dependency, podfile_path)
end end
it "creates a copy of the podspec" do it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist? path.should.exist?
end end
it "supports the deprecated local key" do it 'supports the deprecated local key' do
params = { :local => fixture('integration/Reachability') } params = { :local => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params) dependency = Dependency.new('Reachability', params)
podfile_path = fixture('integration/Podfile') podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path) @subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist? path.should.exist?
end end
it "returns the description" do it 'returns the description' do
@subject.description.should.match %r|from `.*integration/Reachability`| @subject.description.should.match %r{from `.*integration/Reachability`}
end end
it "marks the Pod as local in the sandbox" do it 'marks the Pod as local in the sandbox' do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
config.sandbox.development_pods.should == { config.sandbox.development_pods.should == {
"Reachability" => fixture('integration/Reachability').to_s 'Reachability' => fixture('integration/Reachability').to_s,
} }
end end
it "raises if the podspec cannot be found" do it 'raises if the podspec cannot be found' do
@subject.stubs(:params).returns(:path => temporary_directory) @subject.stubs(:params).returns(:path => temporary_directory)
should.raise Informative do should.raise Informative do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/ end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/
it "marks a pod as relative" do it 'marks a pod as relative' do
@subject.stubs(:params).returns(:path => './Reachability') @subject.stubs(:params).returns(:path => './Reachability')
Pathname.any_instance.stubs(:exist?).returns(true) Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec) config.sandbox.stubs(:store_podspec)
...@@ -51,7 +51,7 @@ module Pod ...@@ -51,7 +51,7 @@ module Pod
config.sandbox.local_path_was_absolute?('Reachability').should.be.false config.sandbox.local_path_was_absolute?('Reachability').should.be.false
end end
it "marks a pod as absolute" do it 'marks a pod as absolute' do
@subject.stubs(:params).returns(:path => '/path/Reachability') @subject.stubs(:params).returns(:path => '/path/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true) Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec) config.sandbox.stubs(:store_podspec)
...@@ -60,27 +60,27 @@ module Pod ...@@ -60,27 +60,27 @@ module Pod
end end
end end
describe "#podspec_path" do describe '#podspec_path' do
it "handles absolute paths" do it 'handles absolute paths' do
@subject.stubs(:params).returns(:path => fixture('integration/Reachability')) @subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path) path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec') path.should == fixture('integration/Reachability/Reachability.podspec')
end end
it "handles paths when there is no podfile path" do it 'handles paths when there is no podfile path' do
@subject.stubs(:podfile_path).returns(nil) @subject.stubs(:podfile_path).returns(nil)
@subject.stubs(:params).returns(:path => fixture('integration/Reachability')) @subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path) path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec') path.should == fixture('integration/Reachability/Reachability.podspec')
end end
it "handles relative paths" do it 'handles relative paths' do
@subject.stubs(:params).returns(:path => 'Reachability') @subject.stubs(:params).returns(:path => 'Reachability')
path = @subject.send(:podspec_path) path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec') path.should == fixture('integration/Reachability/Reachability.podspec')
end end
it "expands the tilde" do it 'expands the tilde' do
File.stubs(:exist?).returns(true) File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:path => '~/Reachability') @subject.stubs(:params).returns(:path => '~/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true) Pathname.any_instance.stubs(:exist?).returns(true)
...@@ -95,7 +95,7 @@ module Pod ...@@ -95,7 +95,7 @@ module Pod
result.should.be.false result.should.be.false
end end
it "consider relative paths not explicitly set from the current dir" do it 'consider relative paths not explicitly set from the current dir' do
result = @subject.send(:absolute?, './ThirdPartyCode/UrbanAirship') result = @subject.send(:absolute?, './ThirdPartyCode/UrbanAirship')
result.should.be.false result.should.be.false
end end
...@@ -112,4 +112,3 @@ module Pod ...@@ -112,4 +112,3 @@ module Pod
end end
end end
end end
...@@ -5,56 +5,54 @@ module Pod ...@@ -5,56 +5,54 @@ module Pod
before do before do
podspec_path = fixture('integration/Reachability/Reachability.podspec') podspec_path = fixture('integration/Reachability/Reachability.podspec')
dependency = Dependency.new("Reachability", :podspec => podspec_path.to_s) dependency = Dependency.new('Reachability', :podspec => podspec_path.to_s)
podfile_path = fixture('integration/Podfile') podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path) @subject = ExternalSources.from_dependency(dependency, podfile_path)
end end
it "creates a copy of the podspec" do it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox) @subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec' path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist? path.should.exist?
end end
it "returns the description" do it 'returns the description' do
@subject.description.should.match %r|from `.*Reachability/Reachability.podspec`| @subject.description.should.match %r{from `.*Reachability/Reachability.podspec`}
end end
describe "Helpers" do describe 'Helpers' do
it "handles absolute paths" do it 'handles absolute paths' do
@subject.stubs(:params).returns(:podspec => fixture('integration/Reachability')) @subject.stubs(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri) path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end end
it "handles paths when there is no podfile path" do it 'handles paths when there is no podfile path' do
@subject.stubs(:podfile_path).returns(nil) @subject.stubs(:podfile_path).returns(nil)
@subject.stubs(:params).returns(:podspec => fixture('integration/Reachability')) @subject.stubs(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri) path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end end
it "handles relative paths" do it 'handles relative paths' do
@subject.stubs(:params).returns(:podspec => 'Reachability') @subject.stubs(:params).returns(:podspec => 'Reachability')
path = @subject.send(:podspec_uri) path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end end
it "expands the tilde" do it 'expands the tilde' do
File.stubs(:exist?).returns(true) File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:podspec => '~/Reachability') @subject.stubs(:params).returns(:podspec => '~/Reachability')
path = @subject.send(:podspec_uri) path = @subject.send(:podspec_uri)
path.should == ENV['HOME'] + '/Reachability/Reachability.podspec' path.should == ENV['HOME'] + '/Reachability/Reachability.podspec'
end end
it "handles URLs" do it 'handles URLs' do
@subject.stubs(:params).returns(:podspec => "http://www.example.com/Reachability.podspec") @subject.stubs(:params).returns(:podspec => 'http://www.example.com/Reachability.podspec')
path = @subject.send(:podspec_uri) path = @subject.send(:podspec_uri)
path.should == "http://www.example.com/Reachability.podspec" path.should == 'http://www.example.com/Reachability.podspec'
end end
end end
end end
end end
...@@ -30,10 +30,10 @@ describe Pod::Generator::Markdown do ...@@ -30,10 +30,10 @@ describe Pod::Generator::Markdown do
given_path = @generator.class.path_from_basepath(basepath) given_path = @generator.class.path_from_basepath(basepath)
expected_path = config.sandbox.root + 'Pods-acknowledgements.markdown' expected_path = config.sandbox.root + 'Pods-acknowledgements.markdown'
mockFile = mock file = mock
mockFile.expects(:write).with(equals(@generator.licenses)) file.expects(:write).with(equals(@generator.licenses))
mockFile.expects(:close) file.expects(:close)
File.expects(:new).with(equals(expected_path), equals('w')).returns(mockFile) File.expects(:new).with(equals(expected_path), equals('w')).returns(file)
@generator.save_as(given_path) @generator.save_as(given_path)
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Generator::BridgeSupport" do describe 'Pod::Generator::BridgeSupport' do
if `which gen_bridge_metadata`.strip.empty? if `which gen_bridge_metadata`.strip.empty?
puts " ! ".red << "Skipping because the `gen_bridge_metadata` executable can't be found." puts ' ! '.red << "Skipping because the `gen_bridge_metadata` executable can't be found."
else else
it "generates a metadata file with the appropriate search paths" do it 'generates a metadata file with the appropriate search paths' do
headers = %w{ /some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h }.map { |h| Pathname.new(h) } headers = %w(/some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h).map { |h| Pathname.new(h) }
generator = Pod::Generator::BridgeSupport.new(headers) generator = Pod::Generator::BridgeSupport.new(headers)
def generator.gen_bridge_metadata(command) expected = %(-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods.bridgesupport' '#{headers.join("' '")}')
@command = command generator.expects(:gen_bridge_metadata).with(expected)
end generator.save_as(Pathname.new('/path/to/Pods.bridgesupport'))
generator.save_as(Pathname.new("/path/to/Pods.bridgesupport"))
generator.instance_variable_get(:@command).should ==
%{-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods.bridgesupport' '#{headers.join("' '")}'}
end end
end end
end end
...@@ -54,7 +54,7 @@ module Pod ...@@ -54,7 +54,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => [], :frameworks => [],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios :platform_name => :ios,
) )
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "SenTestingKit"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "SenTestingKit"'
...@@ -67,7 +67,7 @@ module Pod ...@@ -67,7 +67,7 @@ module Pod
:libraries => ['xml2'], :libraries => ['xml2'],
:frameworks => [], :frameworks => [],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios :platform_name => :ios,
) )
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l "xml2"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l "xml2"'
...@@ -80,7 +80,7 @@ module Pod ...@@ -80,7 +80,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => ['CoreAnimation'], :frameworks => ['CoreAnimation'],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios :platform_name => :ios,
) )
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "CoreAnimation"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "CoreAnimation"'
...@@ -93,7 +93,7 @@ module Pod ...@@ -93,7 +93,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => [], :frameworks => [],
:weak_frameworks => ['iAd'], :weak_frameworks => ['iAd'],
:platform_name => :ios :platform_name => :ios,
) )
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework "iAd"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework "iAd"'
...@@ -106,7 +106,7 @@ module Pod ...@@ -106,7 +106,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => ['SenTestingKit'], :frameworks => ['SenTestingKit'],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :ios :platform_name => :ios,
) )
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('SDKROOT') xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('SDKROOT')
...@@ -120,7 +120,7 @@ module Pod ...@@ -120,7 +120,7 @@ module Pod
:libraries => [], :libraries => [],
:frameworks => ['SenTestingKit'], :frameworks => ['SenTestingKit'],
:weak_frameworks => [], :weak_frameworks => [],
:platform_name => :osx :platform_name => :osx,
) )
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig) @sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR') xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR')
......
...@@ -29,11 +29,13 @@ module Pod ...@@ -29,11 +29,13 @@ module Pod
end end
it 'returns the path of the prefix header' do it 'returns the path of the prefix header' do
@rep.prefix_header_path.should == temporary_directory + 'Pods/Pods-MyApp-prefix.pch' @rep.prefix_header_path.should == temporary_directory +
'Pods/Target Support Files/Pods-MyApp/Pods-MyApp-prefix.pch'
end end
it 'returns the path of the copy resources script' do it 'returns the path of the copy resources script' do
@rep.copy_resources_script_path.should == temporary_directory + 'Pods/Pods-MyApp-resources.sh' @rep.copy_resources_script_path.should == temporary_directory +
'Pods/Target Support Files/Pods-MyApp/Pods-MyApp-resources.sh'
end end
it 'returns the pods project' do it 'returns the pods project' do
......
...@@ -166,9 +166,9 @@ module Pod ...@@ -166,9 +166,9 @@ module Pod
#--------------------------------------# #--------------------------------------#
it 'returns whether the folder containing the Pod with the given name is empty' do it 'returns whether the folder containing the Pod with the given name exists' do
@analyzer.send(:folder_exist?, 'BananaLib').should.be.false @analyzer.send(:folder_exist?, 'BananaLib').should.be.false
path = temporary_directory + 'Pods/BananaLib' path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath path.mkpath
@analyzer.send(:folder_exist?, 'BananaLib').should.be.true @analyzer.send(:folder_exist?, 'BananaLib').should.be.true
...@@ -176,7 +176,7 @@ module Pod ...@@ -176,7 +176,7 @@ module Pod
it 'returns whether the folder containing the Pod with the given name is empty' do it 'returns whether the folder containing the Pod with the given name is empty' do
@analyzer.send(:folder_empty?, 'BananaLib').should.be.true @analyzer.send(:folder_empty?, 'BananaLib').should.be.true
path = temporary_directory + 'Pods/BananaLib' path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath path.mkpath
File.open(path + 'file', 'w') {} File.open(path + 'file', 'w') {}
@analyzer.send(:folder_empty?, 'BananaLib').should.be.false @analyzer.send(:folder_empty?, 'BananaLib').should.be.false
......
...@@ -82,7 +82,7 @@ module Pod ...@@ -82,7 +82,7 @@ module Pod
'Pods-SVPullToRefresh', 'Pods-SVPullToRefresh',
'Pods-libextobjc', 'Pods-libextobjc',
].sort ].sort
target.support_files_root.should == config.sandbox.root target.support_files_dir.should == config.sandbox.target_support_files_dir('Pods')
target.user_project_path.to_s.should.include 'SampleProject/SampleProject' target.user_project_path.to_s.should.include 'SampleProject/SampleProject'
target.client_root.to_s.should.include 'SampleProject' target.client_root.to_s.should.include 'SampleProject'
...@@ -464,11 +464,7 @@ module Pod ...@@ -464,11 +464,7 @@ module Pod
e = lambda { @analyzer.send(:compute_platform_for_target_definition, target_definition, user_targets) }.should.raise Informative e = lambda { @analyzer.send(:compute_platform_for_target_definition, target_definition, user_targets) }.should.raise Informative
e.message.should.match /Targets with different platforms/ e.message.should.match /Targets with different platforms/
end end
end end
#--------------------------------------#
end end
end end
end end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Installer::Migrator do
it 'performs a migration' do
manifest = stub(:cocoapods_version => Version.new('0.32'))
config.sandbox.stubs(:manifest).returns(manifest)
old_path = config.sandbox.root + 'ARAnalytics'
old_path.mkdir
Installer::Migrator.migrate(config.sandbox)
old_path.should.not.exist?
(config.sandbox.sources_root + 'ARAnalytics').should.exist?
end
it "doesn't perform migrations if they are not needed" do
manifest = stub(:cocoapods_version => Version.new('999'))
config.sandbox.stubs(:manifest).returns(manifest)
Installer::Migrator.expects(:migrate_to_0_34).never
Installer::Migrator.migrate(config.sandbox)
end
end
end
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install! @installer.install!
@installer.specific_source.should.be.nil @installer.specific_source.should.be.nil
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
...@@ -28,7 +28,7 @@ module Pod ...@@ -28,7 +28,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install! @installer.install!
@installer.specific_source[:commit].should == '0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc' @installer.specific_source[:commit].should == '0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc'
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
...@@ -36,7 +36,7 @@ module Pod ...@@ -36,7 +36,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' }
@installer.install! @installer.install!
@installer.specific_source[:commit].should == '446b22414597f1bb4062a62c4eed7af9627a3f1b' @installer.specific_source[:commit].should == '446b22414597f1bb4062a62c4eed7af9627a3f1b'
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist pod_folder.should.exist
end end
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
it 'cleans up directory when an error occurs during download' do it 'cleans up directory when an error occurs during download' do
config.sandbox.store_head_pod('BananaLib') config.sandbox.store_head_pod('BananaLib')
pod_folder = config.sandbox.root + 'BananaLib' pod_folder = config.sandbox.pod_dir('BananaLib')
partially_downloaded_file = pod_folder + 'partially_downloaded_file' partially_downloaded_file = pod_folder + 'partially_downloaded_file'
mock_downloader = Object.new mock_downloader = Object.new
...@@ -119,14 +119,14 @@ module Pod ...@@ -119,14 +119,14 @@ module Pod
it 'cleans the paths non used by the installation' do it 'cleans the paths non used by the installation' do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
unused_file = config.sandbox.root + 'BananaLib/sub-dir/sub-dir-2/somefile.txt' unused_file = config.sandbox.root + 'Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt'
unused_file.should.not.exist unused_file.should.not.exist
end end
it 'preserves important files like the LICENSE and the README' do it 'preserves important files like the LICENSE and the README' do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
readme_file = config.sandbox.root + 'BananaLib/README' readme_file = config.sandbox.root + 'Sources/BananaLib/README'
readme_file.should.exist readme_file.should.exist
end end
...@@ -169,13 +169,13 @@ module Pod ...@@ -169,13 +169,13 @@ module Pod
@installer.send(:download_source) @installer.send(:download_source)
paths = @installer.send(:clean_paths) paths = @installer.send(:clean_paths)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') } relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
paths_without_git = relative_paths.reject { |p| p.include? 'Pods/BananaLib/.git' } paths_without_git = relative_paths.reject { |p| p.include? 'Pods/Sources/BananaLib/.git' }
paths_without_git.sort.should == [ paths_without_git.sort.should == [
'Pods/BananaLib/BananaLib.podspec', 'Pods/Sources/BananaLib/BananaLib.podspec',
'Pods/BananaLib/libPusher', 'Pods/Sources/BananaLib/libPusher',
'Pods/BananaLib/sub-dir', 'Pods/Sources/BananaLib/sub-dir',
'Pods/BananaLib/sub-dir/sub-dir-2', 'Pods/Sources/BananaLib/sub-dir/sub-dir-2',
'Pods/BananaLib/sub-dir/sub-dir-2/somefile.txt', 'Pods/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt',
] ]
end end
...@@ -184,13 +184,13 @@ module Pod ...@@ -184,13 +184,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') } relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [ relative_paths.sort.should == [
'Pods/BananaLib/Classes/Banana.h', 'Pods/Sources/BananaLib/Classes/Banana.h',
'Pods/BananaLib/Classes/Banana.m', 'Pods/Sources/BananaLib/Classes/Banana.m',
'Pods/BananaLib/Classes/BananaLib.pch', 'Pods/Sources/BananaLib/Classes/BananaLib.pch',
'Pods/BananaLib/Classes/BananaPrivate.h', 'Pods/Sources/BananaLib/Classes/BananaPrivate.h',
'Pods/BananaLib/LICENSE', 'Pods/Sources/BananaLib/LICENSE',
'Pods/BananaLib/README', 'Pods/Sources/BananaLib/README',
'Pods/BananaLib/Resources/logo-sidebar.png', 'Pods/Sources/BananaLib/Resources/logo-sidebar.png',
] ]
end end
...@@ -208,13 +208,13 @@ module Pod ...@@ -208,13 +208,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') } relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [ relative_paths.sort.should == [
'Pods/BananaLib/Classes/Banana.h', 'Pods/Sources/BananaLib/Classes/Banana.h',
'Pods/BananaLib/Classes/Banana.m', 'Pods/Sources/BananaLib/Classes/Banana.m',
'Pods/BananaLib/Classes/BananaLib.pch', 'Pods/Sources/BananaLib/Classes/BananaLib.pch',
'Pods/BananaLib/Classes/BananaPrivate.h', 'Pods/Sources/BananaLib/Classes/BananaPrivate.h',
'Pods/BananaLib/LICENSE', 'Pods/Sources/BananaLib/LICENSE',
'Pods/BananaLib/README', 'Pods/Sources/BananaLib/README',
'Pods/BananaLib/Resources/logo-sidebar.png', 'Pods/Sources/BananaLib/Resources/logo-sidebar.png',
] ]
end end
......
...@@ -4,6 +4,7 @@ module Pod ...@@ -4,6 +4,7 @@ module Pod
describe Installer::AggregateTargetInstaller do describe Installer::AggregateTargetInstaller do
describe 'In General' do describe 'In General' do
before do before do
config.sandbox.prepare
@podfile = Podfile.new do @podfile = Podfile.new do
platform :ios platform :ios
xcodeproj 'dummy' xcodeproj 'dummy'
...@@ -124,7 +125,8 @@ module Pod ...@@ -124,7 +125,8 @@ module Pod
it 'creates a header for the target which contains the information about the installed Pods' do it 'creates a header for the target which contains the information about the installed Pods' do
@installer.install! @installer.install!
file = config.sandbox.root + 'Pods-environment.h' support_files_dir = config.sandbox.target_support_files_dir('Pods')
file = support_files_dir + 'Pods-environment.h'
contents = file.read contents = file.read
contents.should.include?('#define COCOAPODS_POD_AVAILABLE_BananaLib') contents.should.include?('#define COCOAPODS_POD_AVAILABLE_BananaLib')
contents.should.include?('#define COCOAPODS_VERSION_MAJOR_BananaLib 1') contents.should.include?('#define COCOAPODS_VERSION_MAJOR_BananaLib 1')
...@@ -140,7 +142,8 @@ module Pod ...@@ -140,7 +142,8 @@ module Pod
it 'creates a create copy resources script' do it 'creates a create copy resources script' do
@installer.install! @installer.install!
script = config.sandbox.root + 'Pods-resources.sh' support_files_dir = config.sandbox.target_support_files_dir('Pods')
script = support_files_dir + 'Pods-resources.sh'
script.read.should.include?('logo-sidebar.png') script.read.should.include?('logo-sidebar.png')
end end
...@@ -154,9 +157,10 @@ module Pod ...@@ -154,9 +157,10 @@ module Pod
it 'creates the acknowledgements files ' do it 'creates the acknowledgements files ' do
@installer.install! @installer.install!
markdown = config.sandbox.root + 'Pods-acknowledgements.markdown' support_files_dir = config.sandbox.target_support_files_dir('Pods')
markdown = support_files_dir + 'Pods-acknowledgements.markdown'
markdown.read.should.include?('Permission is hereby granted') markdown.read.should.include?('Permission is hereby granted')
plist = config.sandbox.root + 'Pods-acknowledgements.plist' plist = support_files_dir + 'Pods-acknowledgements.plist'
plist.read.should.include?('Permission is hereby granted') plist.read.should.include?('Permission is hereby granted')
end end
...@@ -166,7 +170,8 @@ module Pod ...@@ -166,7 +170,8 @@ module Pod
build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') } build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') }
build_file.should.be.not.nil build_file.should.be.not.nil
build_file.file_ref.path.should == 'Pods-dummy.m' build_file.file_ref.path.should == 'Pods-dummy.m'
dummy = config.sandbox.root + 'Pods-dummy.m' support_files_dir = config.sandbox.target_support_files_dir('Pods')
dummy = support_files_dir + 'Pods-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods') dummy.read.should.include?('@interface PodsDummy_Pods')
end end
end end
......
...@@ -4,6 +4,7 @@ module Pod ...@@ -4,6 +4,7 @@ module Pod
describe Installer::PodTargetInstaller do describe Installer::PodTargetInstaller do
describe 'In General' do describe 'In General' do
before do before do
config.sandbox.prepare
@podfile = Podfile.new do @podfile = Podfile.new do
platform :ios platform :ios
xcodeproj 'dummy' xcodeproj 'dummy'
...@@ -124,7 +125,8 @@ module Pod ...@@ -124,7 +125,8 @@ module Pod
it "creates a prefix header, including the contents of the specification's prefix header" do it "creates a prefix header, including the contents of the specification's prefix header" do
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
@installer.install! @installer.install!
prefix_header = config.sandbox.root + 'Pods-BananaLib-prefix.pch' support_files_dir = config.sandbox.target_support_files_dir('Pods-BananaLib')
prefix_header = support_files_dir + 'Pods-BananaLib-prefix.pch'
generated = prefix_header.read generated = prefix_header.read
expected = <<-EOS.strip_heredoc expected = <<-EOS.strip_heredoc
#ifdef __OBJC__ #ifdef __OBJC__
...@@ -144,7 +146,8 @@ module Pod ...@@ -144,7 +146,8 @@ module Pod
build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' } build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' }
build_file.should.be.not.nil build_file.should.be.not.nil
build_file.file_ref.path.should == 'Pods-BananaLib-dummy.m' build_file.file_ref.path.should == 'Pods-BananaLib-dummy.m'
dummy = config.sandbox.root + 'Pods-BananaLib-dummy.m' support_files_dir = config.sandbox.target_support_files_dir('Pods-BananaLib')
dummy = support_files_dir + 'Pods-BananaLib-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods') dummy.read.should.include?('@interface PodsDummy_Pods')
end end
......
...@@ -15,7 +15,7 @@ module Pod ...@@ -15,7 +15,7 @@ module Pod
@pod_bundle.client_root = project_path.dirname @pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid] @pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new( configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1' 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
) )
@pod_bundle.xcconfigs['Debug'] = configuration @pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Test'] = configuration @pod_bundle.xcconfigs['Test'] = configuration
...@@ -28,8 +28,6 @@ module Pod ...@@ -28,8 +28,6 @@ module Pod
file_ref = @project.new_file(path) file_ref = @project.new_file(path)
config = @target.build_configuration_list['Release'] config = @target.build_configuration_list['Release']
config.base_configuration_reference = file_ref config.base_configuration_reference = file_ref
File.expects(:exist?).returns(true)
File.expects(:delete).with(path)
XCConfigIntegrator.integrate(@pod_bundle, [@target]) XCConfigIntegrator.integrate(@pod_bundle, [@target])
@project.files.find { |f| f.path == path }.should.be.nil @project.files.find { |f| f.path == path }.should.be.nil
end end
......
...@@ -20,7 +20,7 @@ module Pod ...@@ -20,7 +20,7 @@ module Pod
@pod_bundle.client_root = project_path.dirname @pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid] @pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new( configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1' 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
) )
@pod_bundle.xcconfigs['Debug'] = configuration @pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Test'] = configuration @pod_bundle.xcconfigs['Test'] = configuration
...@@ -41,6 +41,15 @@ module Pod ...@@ -41,6 +41,15 @@ module Pod
@target_integrator.integrate! @target_integrator.integrate!
end end
it 'fixes the copy resource scripts of legacy installations' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' }
phase.shell_script = %("${SRCROOT}/../Pods/Pods-resources.sh"\n)
@target_integrator.integrate!
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\""
end
it 'adds references to the Pods static libraries to the Frameworks group' do it 'adds references to the Pods static libraries to the Frameworks group' do
@target_integrator.integrate! @target_integrator.integrate!
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.nil? @target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.nil?
...@@ -58,7 +67,7 @@ module Pod ...@@ -58,7 +67,7 @@ module Pod
@target_integrator.integrate! @target_integrator.integrate!
target = @target_integrator.send(:native_targets).first target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' } phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' }
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Pods-resources.sh\"" phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\""
end end
it 'adds a Check Manifest.lock build phase to each target' do it 'adds a Check Manifest.lock build phase to each target' do
...@@ -66,7 +75,7 @@ module Pod ...@@ -66,7 +75,7 @@ module Pod
target = @target_integrator.send(:native_targets).first target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Check Pods Manifest.lock' } phase = target.shell_script_build_phases.find { |bp| bp.name == 'Check Pods Manifest.lock' }
phase.shell_script.should == <<-EOS.strip_heredoc phase.shell_script.should == <<-EOS.strip_heredoc
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null diff "${PODS_ROOT}/../../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
cat << EOM cat << EOM
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
......
...@@ -36,37 +36,37 @@ module Pod ...@@ -36,37 +36,37 @@ module Pod
end end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
@lib.xcconfig_path('Release').to_s.should.include?('Pods/Pods.release.xcconfig') @lib.xcconfig_path('Release').to_s.should.include?('Pods/Target Support Files/Pods/Pods.release.xcconfig')
end end
it 'returns the absolute path of the resources script' do it 'returns the absolute path of the resources script' do
@lib.copy_resources_script_path.to_s.should.include?('Pods/Pods-resources.sh') @lib.copy_resources_script_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods-resources.sh')
end end
it 'returns the absolute path of the target header file' do it 'returns the absolute path of the target header file' do
@lib.target_environment_header_path.to_s.should.include?('Pods/Pods-environment.h') @lib.target_environment_header_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods-environment.h')
end end
it 'returns the absolute path of the prefix header file' do it 'returns the absolute path of the prefix header file' do
@lib.prefix_header_path.to_s.should.include?('Pods/Pods-prefix.pch') @lib.prefix_header_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods-prefix.pch')
end end
it 'returns the absolute path of the bridge support file' do it 'returns the absolute path of the bridge support file' do
@lib.bridge_support_path.to_s.should.include?('Pods/Pods.bridgesupport') @lib.bridge_support_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods.bridgesupport')
end end
it 'returns the absolute path of the acknowledgements files without extension' do it 'returns the absolute path of the acknowledgements files without extension' do
@lib.acknowledgements_basepath.to_s.should.include?('Pods/Pods-acknowledgements') @lib.acknowledgements_basepath.to_s.should.include?('Pods/Target Support Files/Pods/Pods-acknowledgements')
end end
#--------------------------------------# #--------------------------------------#
it 'returns the path of the resources script relative to the user project' do it 'returns the path of the resources script relative to the user project' do
@lib.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Pods-resources.sh' @lib.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh'
end end
it 'returns the path of the xcconfig file relative to the user project' do it 'returns the path of the xcconfig file relative to the user project' do
@lib.xcconfig_relative_path('Release').should == 'Pods/Pods.release.xcconfig' @lib.xcconfig_relative_path('Release').should == 'Pods/Target Support Files/Pods/Pods.release.xcconfig'
end end
end end
......
...@@ -52,7 +52,7 @@ module Pod ...@@ -52,7 +52,7 @@ module Pod
path = config.sandbox.pod_dir('BananaLib') path = config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path) group = @project.add_pod_group('BananaLib', @path)
group.source_tree.should == '<group>' group.source_tree.should == '<group>'
group.path.should == 'BananaLib' group.path.should == 'Sources/BananaLib'
Pathname.new(group.path).should.be.relative Pathname.new(group.path).should.be.relative
end end
...@@ -139,14 +139,13 @@ module Pod ...@@ -139,14 +139,13 @@ module Pod
end end
it 'creates a support file group relative to the project' do it 'creates a support file group relative to the project' do
group = @project.pod_support_files_group('BananaLib') group = @project.pod_support_files_group('BananaLib', 'path')
group.source_tree.should == 'SOURCE_ROOT' group.path.should == 'path'
group.path.should.be.nil
end end
it "doesn't duplicate the groups" do it "doesn't duplicate the groups" do
group_1 = @project.pod_support_files_group('BananaLib') group_1 = @project.pod_support_files_group('BananaLib', 'path')
group_2 = @project.pod_support_files_group('BananaLib') group_2 = @project.pod_support_files_group('BananaLib', 'path')
group_1.uuid.should == group_2.uuid group_1.uuid.should == group_2.uuid
end end
......
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
pod 'BlocksKit', '1.5.2' pod 'BlocksKit', '1.5.2'
end end
locked_deps = [Dependency.new('BlocksKit', '1.5.2')] locked_deps = [Dependency.new('BlocksKit', '1.5.2')]
@resolver = Resolver.new(config.sandbox, @podfile, locked_deps) @resolver = Resolver.new(config.sandbox, @podfile, locked_deps, SourcesManager.all)
end end
it 'returns the sandbox' do it 'returns the sandbox' do
...@@ -55,7 +55,7 @@ module Pod ...@@ -55,7 +55,7 @@ module Pod
platform :ios platform :ios
pod 'Reachability', :podspec => podspec pod 'Reachability', :podspec => podspec
end end
resolver = Resolver.new(config.sandbox, podfile) resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
resolver.resolve resolver.resolve
specs = resolver.specs_by_target.values.flatten specs = resolver.specs_by_target.values.flatten
specs.map(&:to_s).should == ['Reachability (3.0.0)'] specs.map(&:to_s).should == ['Reachability (3.0.0)']
...@@ -70,7 +70,7 @@ module Pod ...@@ -70,7 +70,7 @@ module Pod
platform :ios, '6.0' platform :ios, '6.0'
pod 'BlocksKit', '1.5.2' pod 'BlocksKit', '1.5.2'
end end
@resolver = Resolver.new(config.sandbox, @podfile) @resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
end end
it 'cross resolves dependencies' do it 'cross resolves dependencies' do
...@@ -80,7 +80,7 @@ module Pod ...@@ -80,7 +80,7 @@ module Pod
pod 'AFQuickLookView', '= 0.1.0' # requires 'AFNetworking', '>= 0.9.0' pod 'AFQuickLookView', '= 0.1.0' # requires 'AFNetworking', '>= 0.9.0'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should == ['AFNetworking (0.9.1)', 'AFQuickLookView (0.1.0)'] specs.should == ['AFNetworking (0.9.1)', 'AFQuickLookView (0.1.0)']
end end
...@@ -101,6 +101,15 @@ module Pod ...@@ -101,6 +101,15 @@ module Pod
e.message.should.match(/platform .* not compatible/) e.message.should.match(/platform .* not compatible/)
end end
it 'raises if unable to find a specification' do
Specification.any_instance.stubs(:all_dependencies).returns([Dependency.new('Windows')])
message = should.raise Informative do
@resolver.resolve
end.message
message.should.match /Unable to find a specification/
message.should.match /`Windows` depended upon by BlocksKit/
end
it 'does not raise if all dependencies are supported by the platform of the target definition' do it 'does not raise if all dependencies are supported by the platform of the target definition' do
lambda { @resolver.resolve }.should.not.raise lambda { @resolver.resolve }.should.not.raise
end end
...@@ -110,7 +119,7 @@ module Pod ...@@ -110,7 +119,7 @@ module Pod
platform :ios, '7.0' platform :ios, '7.0'
pod 'RestKit', '0.10.3' pod 'RestKit', '0.10.3'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
resolver.resolve.values.flatten.map(&:name).sort.should == %w( resolver.resolve.values.flatten.map(&:name).sort.should == %w(
FileMD5Hash FileMD5Hash
ISO8601DateFormatter ISO8601DateFormatter
...@@ -149,9 +158,11 @@ module Pod ...@@ -149,9 +158,11 @@ module Pod
end end
end end
config.sandbox.expects(:specification).with('MainSpec').returns(spec) config.sandbox.expects(:specification).with('MainSpec').returns(spec)
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:name).sort specs = resolver.resolve.values.flatten.map(&:name).sort
specs.should == %w( MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec ) specs.should == %w(
MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec
)
end end
it "marks a specification's version to be a HEAD version" do it "marks a specification's version to be a HEAD version" do
...@@ -160,7 +171,7 @@ module Pod ...@@ -160,7 +171,7 @@ module Pod
pod 'FileMD5Hash' pod 'FileMD5Hash'
pod 'JSONKit', :head pod 'JSONKit', :head
end end
resolver = Resolver.new(config.sandbox, podfile) resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
filemd5hash, jsonkit = resolver.resolve.values.first.sort_by(&:name) filemd5hash, jsonkit = resolver.resolve.values.first.sort_by(&:name)
filemd5hash.version.should.not.be.head filemd5hash.version.should.not.be.head
jsonkit.version.should.be.head jsonkit.version.should.be.head
...@@ -174,7 +185,7 @@ module Pod ...@@ -174,7 +185,7 @@ module Pod
pod 'JSONKit', '1.4' pod 'JSONKit', '1.4'
pod 'JSONKit', '1.5pre' pod 'JSONKit', '1.5pre'
end end
resolver = Resolver.new(config.sandbox, podfile) resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
e = lambda { resolver.resolve }.should.raise Pod::Informative e = lambda { resolver.resolve }.should.raise Pod::Informative
e.message.should.match(/Unable to satisfy the following requirements/) e.message.should.match(/Unable to satisfy the following requirements/)
end end
...@@ -184,15 +195,31 @@ module Pod ...@@ -184,15 +195,31 @@ module Pod
platform :ios platform :ios
pod 'JSONKit', '<= 1.5pre' pod 'JSONKit', '<= 1.5pre'
end end
resolver = Resolver.new(config.sandbox, podfile) resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
version = resolver.resolve.values.flatten.first.version version = resolver.resolve.values.flatten.first.version
version.to_s.should == '1.5pre' version.to_s.should == '1.5pre'
locked_deps = [Dependency.new('JSONKit', '= 1.4')] locked_deps = [Dependency.new('JSONKit', '= 1.4')]
resolver = Resolver.new(config.sandbox, podfile, locked_deps) resolver = Resolver.new(config.sandbox, podfile, locked_deps, SourcesManager.all)
version = resolver.resolve.values.flatten.first.version version = resolver.resolve.values.flatten.first.version
version.to_s.should == '1.4' version.to_s.should == '1.4'
end end
it 'takes into account the order of the sources' do
podfile = Podfile.new do
platform :ios
pod 'JSONKit'
end
sources = SourcesManager.sources(%w(master test_repo))
resolver = Resolver.new(config.sandbox, podfile, [], sources)
version = resolver.resolve.values.flatten.first.version
version.to_s.should.not == '999.999.999'
sources = SourcesManager.sources(%w(test_repo master))
resolver = Resolver.new(config.sandbox, podfile, [], sources)
version = resolver.resolve.values.flatten.first.version
version.to_s.should == '999.999.999'
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -205,7 +232,7 @@ module Pod ...@@ -205,7 +232,7 @@ module Pod
pod 'AFNetworking', '1.0RC3' pod 'AFNetworking', '1.0RC3'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should == ['AFNetworking (1.0RC3)'] specs.should == ['AFNetworking (1.0RC3)']
end end
...@@ -216,7 +243,7 @@ module Pod ...@@ -216,7 +243,7 @@ module Pod
pod 'AFNetworking', '~> 1.0RC3' pod 'AFNetworking', '~> 1.0RC3'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.0)'] specs.should == ['AFNetworking (1.2.0)']
...@@ -228,7 +255,7 @@ module Pod ...@@ -228,7 +255,7 @@ module Pod
pod 'AFNetworking', '1.0' pod 'AFNetworking', '1.0'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)'] specs.should == ['AFNetworking (1.0)']
...@@ -240,7 +267,7 @@ module Pod ...@@ -240,7 +267,7 @@ module Pod
pod 'AFNetworking', '< 1.0' pod 'AFNetworking', '< 1.0'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (0.10.1)'] specs.should == ['AFNetworking (0.10.1)']
...@@ -252,7 +279,7 @@ module Pod ...@@ -252,7 +279,7 @@ module Pod
pod 'AFNetworking', '<= 1.0' pod 'AFNetworking', '<= 1.0'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)'] specs.should == ['AFNetworking (1.0)']
...@@ -264,7 +291,7 @@ module Pod ...@@ -264,7 +291,7 @@ module Pod
pod 'AFNetworking', '> 1.0', '< 1.3' pod 'AFNetworking', '> 1.0', '< 1.3'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)'] specs.should == ['AFNetworking (1.2.1)']
...@@ -276,7 +303,7 @@ module Pod ...@@ -276,7 +303,7 @@ module Pod
pod 'AFNetworking', '>= 1.0', '< 1.3' pod 'AFNetworking', '>= 1.0', '< 1.3'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)'] specs.should == ['AFNetworking (1.2.1)']
...@@ -288,7 +315,7 @@ module Pod ...@@ -288,7 +315,7 @@ module Pod
pod 'AFNetworking', '~> 1.0', '< 1.3' pod 'AFNetworking', '~> 1.0', '< 1.3'
end end
resolver = Resolver.new(config.sandbox, @podfile) resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)'] specs.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)'] specs.should == ['AFNetworking (1.2.1)']
......
...@@ -5,11 +5,11 @@ module Pod ...@@ -5,11 +5,11 @@ module Pod
before do before do
@sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox') @sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox')
@header_dir = Sandbox::HeadersStore.new(@sandbox, 'Headers') @header_dir = Sandbox::HeadersStore.new(@sandbox, 'Public')
end end
it "returns it's headers root" do it "returns it's headers root" do
@header_dir.root.should == temporary_directory + 'Sandbox/Headers' @header_dir.root.should == temporary_directory + 'Sandbox/Headers/Public'
end end
it "can add namespaced headers to it's header path using symlinks and return the relative path" do it "can add namespaced headers to it's header path using symlinks and return the relative path" do
...@@ -40,11 +40,11 @@ module Pod ...@@ -40,11 +40,11 @@ module Pod
File.open(@sandbox.root + path, 'w') { |file| file.write('hello') } File.open(@sandbox.root + path, 'w') { |file| file.write('hello') }
end end
@header_dir.add_files(namespace_path, relative_header_paths) @header_dir.add_files(namespace_path, relative_header_paths)
@header_dir.search_paths.should.include('${PODS_ROOT}/Headers/ExampleLib') @header_dir.search_paths.should.include('${PODS_ROOT}/Headers/Public/ExampleLib')
end end
it 'always adds the Headers root to the header search paths' do it 'always adds the Headers root to the header search paths' do
@header_dir.search_paths.should.include('${PODS_ROOT}/Headers') @header_dir.search_paths.should.include('${PODS_ROOT}/Headers/Public')
end end
end end
end end
...@@ -33,16 +33,12 @@ module Pod ...@@ -33,16 +33,12 @@ module Pod
end end
it 'returns the public headers store' do it 'returns the public headers store' do
@sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Headers' @sandbox.public_headers.root.should ==
end temporary_directory + 'Sandbox/Headers/Public'
it 'deletes the entire root directory on implode' do
@sandbox.implode
File.directory?(temporary_directory + 'Sandbox').should.be.false
end end
it 'cleans any trace of the Pod with the given name' do it 'cleans any trace of the Pod with the given name' do
pod_root = @sandbox.root + 'BananaLib' pod_root = @sandbox.pod_dir('BananaLib')
pod_root.mkpath pod_root.mkpath
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec')) @sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
specification_path = @sandbox.specification_path('BananaLib') specification_path = @sandbox.specification_path('BananaLib')
...@@ -52,7 +48,7 @@ module Pod ...@@ -52,7 +48,7 @@ module Pod
end end
it "doesn't remove the root of local Pods while cleaning" do it "doesn't remove the root of local Pods while cleaning" do
pod_root = @sandbox.root + 'BananaLib' pod_root = @sandbox.pod_dir('BananaLib')
@sandbox.stubs(:local?).returns(true) @sandbox.stubs(:local?).returns(true)
pod_root.mkpath pod_root.mkpath
@sandbox.clean_pod('BananaLib') @sandbox.clean_pod('BananaLib')
...@@ -66,19 +62,23 @@ module Pod ...@@ -66,19 +62,23 @@ module Pod
describe 'Paths' do describe 'Paths' do
it 'returns the path of the manifest' do it 'returns the path of the manifest' do
@sandbox.manifest_path.should == temporary_directory + 'Sandbox/Manifest.lock' @sandbox.manifest_path.should ==
temporary_directory + 'Sandbox/Manifest.lock'
end end
it 'returns the path of the Pods project' do it 'returns the path of the Pods project' do
@sandbox.project_path.should == temporary_directory + 'Sandbox/Pods.xcodeproj' @sandbox.project_path.should ==
temporary_directory + 'Sandbox/Pods.xcodeproj'
end end
it 'returns the directory for the support files of a library' do it 'returns the directory for the support files of a library' do
@sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox' @sandbox.target_support_files_dir('Pods').should ==
temporary_directory + 'Sandbox/Target Support Files/Pods'
end end
it 'returns the directory where a Pod is stored' do it 'returns the directory where a Pod is stored' do
@sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/JSONKit' @sandbox.pod_dir('JSONKit').should ==
temporary_directory + 'Sandbox/Sources/JSONKit'
end end
it 'returns the directory where a local Pod is stored' do it 'returns the directory where a local Pod is stored' do
...@@ -86,14 +86,11 @@ module Pod ...@@ -86,14 +86,11 @@ module Pod
@sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path') @sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path')
end end
it 'returns the directory where to store the documentation' do
@sandbox.documentation_dir.should == temporary_directory + 'Sandbox/Documentation'
end
it 'handles symlinks in /tmp' do it 'handles symlinks in /tmp' do
tmp_sandbox = Pod::Sandbox.new('/tmp/CocoaPods') tmp_sandbox = Pod::Sandbox.new('/tmp/CocoaPods')
tmp_sandbox.root.should.be == Pathname.new('/private/tmp/CocoaPods') tmp_sandbox.root.should.be == Pathname.new('/private/tmp/CocoaPods')
tmp_sandbox.implode require 'fileutils'
FileUtils.rm_rf(tmp_sandbox.root)
end end
end end
...@@ -102,8 +99,8 @@ module Pod ...@@ -102,8 +99,8 @@ module Pod
describe 'Specification store' do describe 'Specification store' do
it 'loads the stored specification with the given name' do it 'loads the stored specification with the given name' do
(@sandbox.root + 'Local Podspecs').mkdir (@sandbox.specifications_root).mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs') FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.specifications_root)
@sandbox.specification('BananaLib').name.should == 'BananaLib' @sandbox.specification('BananaLib').name.should == 'BananaLib'
end end
...@@ -120,13 +117,15 @@ module Pod ...@@ -120,13 +117,15 @@ module Pod
end end
it 'returns the directory where to store the specifications' do it 'returns the directory where to store the specifications' do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs' @sandbox.specifications_root.should ==
temporary_directory + 'Sandbox/Local Podspecs'
end end
it "returns the path to a spec file in the 'Local Podspecs' dir" do it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Local Podspecs').mkdir (@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs') FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs')
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Local Podspecs/BananaLib.podspec' @sandbox.specification_path('BananaLib').should ==
@sandbox.root + 'Local Podspecs/BananaLib.podspec'
end end
it 'stores a podspec with a given path into the sandbox' do it 'stores a podspec with a given path into the sandbox' do
......
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "In general" do describe 'In general' do
before do before do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
...@@ -43,88 +43,84 @@ module Pod ...@@ -43,88 +43,84 @@ module Pod
#--------------------------------------# #--------------------------------------#
it "returns all the sources" do it 'returns all the sources' do
Source::Aggregate.any_instance.unstub(:all) Source::Aggregate.any_instance.unstub(:all)
SourcesManager.all.map(&:name).should == %w[master test_repo] SourcesManager.all.map(&:name).should == %w(master test_repo)
end end
it "returns all the sets" do it 'searches for the set of a dependency' do
SourcesManager.all_sets.map(&:name).should.include?('BananaLib')
end
it "searches for the set of a dependency" do
set = SourcesManager.search(Dependency.new('BananaLib')) set = SourcesManager.search(Dependency.new('BananaLib'))
set.class.should == Specification::Set set.class.should == Specification::Set
set.name.should == 'BananaLib' set.name.should == 'BananaLib'
end end
it "returns nil if it is not able to find a pod for the given dependency" do it 'returns nil if it is not able to find a pod for the given dependency' do
set = SourcesManager.search(Dependency.new('Windows-Lib')) set = SourcesManager.search(Dependency.new('Windows-Lib'))
set.should.be.nil set.should.be.nil
end end
it "searches sets by name" do it 'searches sets by name' do
sets = SourcesManager.search_by_name('BananaLib') sets = SourcesManager.search_by_name('BananaLib')
sets.all?{ |s| s.class == Specification::Set}.should.be.true sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end end
it "can perform a full text search of the sets" do it 'can perform a full text search of the sets' do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Chunky', true) sets = SourcesManager.search_by_name('Chunky', true)
sets.all?{ |s| s.class == Specification::Set}.should.be.true sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end end
it "can perform a full text regexp search of the sets" do it 'can perform a full text regexp search of the sets' do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
sets = SourcesManager.search_by_name('Ch[aeiou]nky', true) sets = SourcesManager.search_by_name('Ch[aeiou]nky', true)
sets.all?{ |s| s.class == Specification::Set}.should.be.true sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end end
it "generates the search index before performing a search if it doesn't exits" do it "generates the search index before performing a search if it doesn't exits" do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
Source::Aggregate.any_instance.expects(:generate_search_index).returns({'BananaLib' => {}}) Source::Aggregate.any_instance.expects(:generate_search_index).returns('BananaLib' => {})
Source::Aggregate.any_instance.expects(:update_search_index).never Source::Aggregate.any_instance.expects(:update_search_index).never
SourcesManager.updated_search_index = nil SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true) sets = SourcesManager.search_by_name('BananaLib', true)
end end
it "updates the search index before performing a search if it exits" do it 'updates the search index before performing a search if it exits' do
File.open(SourcesManager.search_index_path, 'w') { |file| file.write("---\nBananaLib:\n version: 0.0.1") } File.open(SourcesManager.search_index_path, 'w') { |file| file.write("---\nBananaLib:\n version: 0.0.1") }
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
Source::Aggregate.any_instance.expects(:generate_search_index).never Source::Aggregate.any_instance.expects(:generate_search_index).never
Source::Aggregate.any_instance.expects(:update_search_index).returns({'BananaLib' => {}}) Source::Aggregate.any_instance.expects(:update_search_index).returns('BananaLib' => {})
SourcesManager.updated_search_index = nil SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true) sets = SourcesManager.search_by_name('BananaLib', true)
end end
it "returns the path of the search index" do it 'returns the path of the search index' do
SourcesManager.unstub(:search_index_path) SourcesManager.unstub(:search_index_path)
path = SourcesManager.search_index_path.to_s path = SourcesManager.search_index_path.to_s
path.should.match %r[Library/Caches/CocoaPods/search_index.yaml] path.should.match %r{Library/Caches/CocoaPods/search_index.yaml}
end end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "Updating Sources" do describe 'Updating Sources' do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
it "update source backed by a git repository" do it 'update source backed by a git repository' do
set_up_test_repo_for_update set_up_test_repo_for_update
SourcesManager.update(test_repo_path.basename.to_s, true) SourcesManager.update(test_repo_path.basename.to_s, true)
UI.output.should.match /is up to date/ UI.output.should.match /is up to date/
end end
it "uses the only fast forward git option" do it 'uses the only fast forward git option' do
set_up_test_repo_for_update set_up_test_repo_for_update
SourcesManager.expects(:git!).with() { |options| options.should.match /--ff-only/ } SourcesManager.expects(:git!).with { |options| options.should.match /--ff-only/ }
SourcesManager.update(test_repo_path.basename.to_s, true) SourcesManager.update(test_repo_path.basename.to_s, true)
end end
it "prints a warning if the update failed" do it 'prints a warning if the update failed' do
UI.warnings = '' UI.warnings = ''
set_up_test_repo_for_update set_up_test_repo_for_update
Dir.chdir(test_repo_path) do Dir.chdir(test_repo_path) do
...@@ -134,23 +130,23 @@ module Pod ...@@ -134,23 +130,23 @@ module Pod
UI.warnings.should.include('not able to update the `master` repo') UI.warnings.should.include('not able to update the `master` repo')
end end
it "returns whether a source is backed by a git repo" do it 'returns whether a source is backed by a git repo' do
SourcesManager.git_repo?(SourcesManager.master_repo_dir).should.be.true SourcesManager.git_repo?(SourcesManager.master_repo_dir).should.be.true
SourcesManager.git_repo?(Pathname.new('/tmp')).should.be.false SourcesManager.git_repo?(Pathname.new('/tmp')).should.be.false
end end
it "informs the user if there is an update for CocoaPods" do it 'informs the user if there is an update for CocoaPods' do
SourcesManager.stubs(:version_information).returns({ 'last' => '999.0' }) SourcesManager.stubs(:version_information).returns('last' => '999.0')
SourcesManager.check_version_information(temporary_directory) SourcesManager.check_version_information(temporary_directory)
UI.output.should.match /CocoaPods 999.0 is available/ UI.output.should.match /CocoaPods 999.0 is available/
end end
it "raises while asked to version information of a source if it is not compatible" do it 'raises while asked to version information of a source if it is not compatible' do
SourcesManager.stubs(:version_information).returns({ 'min' => '999.0' }) SourcesManager.stubs(:version_information).returns('min' => '999.0')
e = lambda { SourcesManager.check_version_information(temporary_directory) }.should.raise Informative e = lambda { SourcesManager.check_version_information(temporary_directory) }.should.raise Informative
e.message.should.match /Update CocoaPods/ e.message.should.match /Update CocoaPods/
e.message.should.match /(currently using #{Pod::VERSION})/ e.message.should.match /(currently using #{Pod::VERSION})/
SourcesManager.stubs(:version_information).returns({ 'max' => '0.0.1' }) SourcesManager.stubs(:version_information).returns('max' => '0.0.1')
e = lambda { SourcesManager.check_version_information(temporary_directory) }.should.raise Informative e = lambda { SourcesManager.check_version_information(temporary_directory) }.should.raise Informative
e.message.should.match /Update CocoaPods/ e.message.should.match /Update CocoaPods/
e.message.should.match /(currently using #{Pod::VERSION})/ e.message.should.match /(currently using #{Pod::VERSION})/
...@@ -168,23 +164,23 @@ module Pod ...@@ -168,23 +164,23 @@ module Pod
SourcesManager.send(:path_writable?, path).should.be.true SourcesManager.send(:path_writable?, path).should.be.true
end end
it "returns whether a repository is compatible" do it 'returns whether a repository is compatible' do
SourcesManager.stubs(:version_information).returns({ 'min' => '0.0.1' }) SourcesManager.stubs(:version_information).returns('min' => '0.0.1')
SourcesManager.repo_compatible?('stub').should.be.true SourcesManager.repo_compatible?('stub').should.be.true
SourcesManager.stubs(:version_information).returns({ 'max' => '999.0' }) SourcesManager.stubs(:version_information).returns('max' => '999.0')
SourcesManager.repo_compatible?('stub').should.be.true SourcesManager.repo_compatible?('stub').should.be.true
SourcesManager.stubs(:version_information).returns({ 'min' => '999.0' }) SourcesManager.stubs(:version_information).returns('min' => '999.0')
SourcesManager.repo_compatible?('stub').should.be.false SourcesManager.repo_compatible?('stub').should.be.false
SourcesManager.stubs(:version_information).returns({ 'max' => '0.0.1' }) SourcesManager.stubs(:version_information).returns('max' => '0.0.1')
SourcesManager.repo_compatible?('stub').should.be.false SourcesManager.repo_compatible?('stub').should.be.false
end end
it "returns whether there is a CocoaPods update available" do it 'returns whether there is a CocoaPods update available' do
SourcesManager.cocoapods_update?({ 'last' => '0.0.1' }).should.be.false SourcesManager.cocoapods_update?('last' => '0.0.1').should.be.false
SourcesManager.cocoapods_update?({ 'last' => '999.0' }).should.be.true SourcesManager.cocoapods_update?('last' => '999.0').should.be.true
end end
it "it returns an empty array for the version information if the file can't be found" do it "it returns an empty array for the version information if the file can't be found" do
...@@ -195,13 +191,13 @@ module Pod ...@@ -195,13 +191,13 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "Master repo" do describe 'Master repo' do
it "returns the master repo dir" do it 'returns the master repo dir' do
SourcesManager.master_repo_dir.to_s.should.match /fixtures\/spec-repos\/master/ SourcesManager.master_repo_dir.to_s.should.match /fixtures\/spec-repos\/master/
end end
it "returns whether the master repo is functional" do it 'returns whether the master repo is functional' do
SourcesManager.master_repo_functional?.should.be.true SourcesManager.master_repo_functional?.should.be.true
config.repos_dir = SpecHelper.temporary_directory config.repos_dir = SpecHelper.temporary_directory
SourcesManager.master_repo_functional?.should.be.false SourcesManager.master_repo_functional?.should.be.false
......
...@@ -44,35 +44,35 @@ module Pod ...@@ -44,35 +44,35 @@ module Pod
end end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
@target.xcconfig_path('Release').to_s.should.include?('Pods/Pods.release.xcconfig') @target.xcconfig_path('Release').to_s.should.include?('Pods/Target Support Files/Pods/Pods.release.xcconfig')
end end
it 'returns the absolute path of the resources script' do it 'returns the absolute path of the resources script' do
@target.copy_resources_script_path.to_s.should.include?('Pods/Pods-resources.sh') @target.copy_resources_script_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods-resources.sh')
end end
it 'returns the absolute path of the target header file' do it 'returns the absolute path of the target header file' do
@target.target_environment_header_path.to_s.should.include?('Pods/Pods-environment.h') @target.target_environment_header_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods-environment.h')
end end
it 'returns the absolute path of the prefix header file' do it 'returns the absolute path of the prefix header file' do
@target.prefix_header_path.to_s.should.include?('Pods/Pods-prefix.pch') @target.prefix_header_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods-prefix.pch')
end end
it 'returns the absolute path of the bridge support file' do it 'returns the absolute path of the bridge support file' do
@target.bridge_support_path.to_s.should.include?('Pods/Pods.bridgesupport') @target.bridge_support_path.to_s.should.include?('Pods/Target Support Files/Pods/Pods.bridgesupport')
end end
it 'returns the absolute path of the acknowledgements files without extension' do it 'returns the absolute path of the acknowledgements files without extension' do
@target.acknowledgements_basepath.to_s.should.include?('Pods/Pods-acknowledgements') @target.acknowledgements_basepath.to_s.should.include?('Pods/Target Support Files/Pods/Pods-acknowledgements')
end end
it 'returns the path of the resources script relative to the user project' do it 'returns the path of the resources script relative to the user project' do
@target.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Pods-resources.sh' @target.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh'
end end
it 'returns the path of the xcconfig file relative to the user project' do it 'returns the path of the xcconfig file relative to the user project' do
@target.xcconfig_relative_path('Release').should == 'Pods/Pods.release.xcconfig' @target.xcconfig_relative_path('Release').should == 'Pods/Target Support Files/Pods/Pods.release.xcconfig'
end end
end end
......
...@@ -54,32 +54,45 @@ module Pod ...@@ -54,32 +54,45 @@ module Pod
@target_definition.store_pod('BananaLib') @target_definition.store_pod('BananaLib')
@target_definition.store_pod('BananaLib/Subspec') @target_definition.store_pod('BananaLib/Subspec')
@target_definition.whitelist_pod_for_configuration('BananaLib', 'debug') @target_definition.whitelist_pod_for_configuration('BananaLib', 'debug')
should.raise Informative do message = should.raise Informative do
@pod_target.include_in_build_config?('release').should.be.true @pod_target.include_in_build_config?('release').should.be.true
end.message.should.match /subspecs across different build configurations/ end.message
message.should.match /subspecs across different build configurations/
end end
end end
describe 'Support files' do describe 'Support files' do
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
@pod_target.xcconfig_path('Release').to_s.should.include 'Pods/Pods-BananaLib.release.xcconfig' @pod_target.xcconfig_path('Release').to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.release.xcconfig'
)
end end
it 'returns the absolute path of the target header file' do it 'returns the absolute path of the target header file' do
@pod_target.target_environment_header_path.to_s.should.include 'Pods/Pods-environment.h' @pod_target.target_environment_header_path.to_s.should.include?(
'Pods/Target Support Files/Pods/Pods-environment.h'
)
end end
it 'returns the absolute path of the prefix header file' do it 'returns the absolute path of the prefix header file' do
@pod_target.prefix_header_path.to_s.should.include 'Pods/Pods-BananaLib-prefix.pch' @pod_target.prefix_header_path.to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-prefix.pch'
)
end end
it 'returns the absolute path of the bridge support file' do it 'returns the absolute path of the bridge support file' do
@pod_target.bridge_support_path.to_s.should.include 'Pods/Pods-BananaLib.bridgesupport' @pod_target.bridge_support_path.to_s.should.include?(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.bridgesupport'
)
end end
it 'returns the absolute path of the public and private xcconfig files' do it 'returns the absolute path of the public and private xcconfig files' do
@pod_target.xcconfig_path.to_s.should.include 'Pods/Pods-BananaLib.xcconfig' @pod_target.xcconfig_path.to_s.should.include?(
@pod_target.xcconfig_private_path.to_s.should.include 'Pods/Pods-BananaLib-Private.xcconfig' 'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib.xcconfig'
)
@pod_target.xcconfig_private_path.to_s.should.include(
'Pods/Target Support Files/Pods-BananaLib/Pods-BananaLib-Private.xcconfig'
)
end end
end end
......
...@@ -173,11 +173,17 @@ module Pod ...@@ -173,11 +173,17 @@ module Pod
describe 'Screenshot validation' do describe 'Screenshot validation' do
before do before do
@sut.stubs(:validate_homepage) @sut.stubs(:validate_homepage)
WebMock::API.stub_request(:head, 'banana-corp.local/valid-image.png').to_return(:status => 200, :headers => { 'Content-Type' => 'image/png' }) WebMock::API.
stub_request(:head, 'banana-corp.local/valid-image.png').
to_return(
:status => 200,
:headers => { 'Content-Type' => 'image/png' }
)
end end
it 'checks if the screenshots are valid' do it 'checks if the screenshots are valid' do
Specification.any_instance.stubs(:screenshots).returns(['http://banana-corp.local/valid-image.png']) Specification.any_instance.stubs(:screenshots).
returns(['http://banana-corp.local/valid-image.png'])
@sut.validate @sut.validate
@sut.results.should.be.empty? @sut.results.should.be.empty?
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