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`
# 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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# 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
# Configuration parameters: AlignWith, SupportedStyles.
Lint/DefEndAlignment:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
Enabled: false
# Offense count: 11
# Offense count: 10
# Configuration parameters: AlignWith, SupportedStyles.
Lint/EndAlignment:
Enabled: false
# Offense count: 2
Lint/SpaceBeforeFirstArg:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false
# Offense count: 3
Lint/UselessAccessModifier:
Enabled: false
......@@ -53,18 +30,18 @@ Metrics/BlockNesting:
# Offense count: 11
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 326
Max: 334
# Offense count: 12
Metrics/CyclomaticComplexity:
Max: 9
# Offense count: 956
# Offense count: 961
# Configuration parameters: AllowURI.
Metrics/LineLength:
Max: 1060
# Offense count: 104
# Offense count: 106
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 39
......@@ -73,226 +50,69 @@ Metrics/MethodLength:
Metrics/PerceivedComplexity:
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
# Configuration parameters: Keywords.
Style/CommentAnnotation:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/CommentIndentation:
Enabled: false
# Offense count: 1
Style/DoubleNegation:
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
# Configuration parameters: Exclude.
Style/FileName:
Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/For:
Enabled: false
# Offense count: 6
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
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
# 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.
Style/PercentLiteralDelimiters:
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
# Configuration parameters: MaxSlashes.
Style/RegexpLiteral:
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
# Cop supports --auto-correct.
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:
Style/SelfAssignment:
Enabled: false
# Offense count: 34
# Offense count: 28
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false
# Offense count: 160
# Offense count: 49
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false
# Offense count: 9
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma:
Enabled: false
# Offense count: 22
# Offense count: 17
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false
# Offense count: 4
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
Style/TrivialAccessors:
Enabled: false
# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/VariableName:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/WordArray:
......
......@@ -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)
[#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.
A plugin can register itself to be activated after the installation with the
following syntax:
......@@ -84,6 +92,16 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Robert Zuber](https://github.com/z00b)
[#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
......@@ -101,6 +119,7 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Fabio Pelosin][FabioPelosin]
[#34](https://github.com/CocoaPods/CLAide/issues/34)
## 0.33.0
##### Breaking
......
PATH
remote: .
GIT
remote: https://github.com/CocoaPods/CLAide.git
revision: c4c75f833db97173fca7380890ed99affad2bbab
branch: master
specs:
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)
claide (0.6.1)
GIT
remote: https://github.com/CocoaPods/Core.git
revision: 2c5be5dbb1157c10e86ff75223a119b74d01ae7f
branch: master
specs:
cocoapods-core (0.33.1)
activesupport (>= 3.2.15)
fuzzy_match (~> 2.0.4)
json_pure (~> 1.8)
nap (~> 0.8)
open4 (~> 1.3)
xcodeproj (~> 0.18.0)
nap (~> 0.8.0)
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision: de62dd92e4f10b008711393a0a257dd5130ce948
revision: 8cebb41a5630053109da9720454a2ae3eecfee3c
branch: master
specs:
xcodeproj (0.18.0)
......@@ -27,54 +27,54 @@ GIT
colored (~> 1.2)
GIT
remote: https://github.com/CocoaPods/cocoapods-try.git
revision: 59a225cd4dd1868da4be7c4cc870cae427f04bf9
branch: master
specs:
cocoapods-try (0.3.0)
GIT
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: 62bca8ec7073fc59d4137818bd78e0bbc8b1718f
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: a8710a42b1ce379fb2afe66ce9f98a08b58fb482
branch: master
specs:
cocoapods-trunk (0.1.4)
json_pure (~> 1.8)
nap (>= 0.8)
netrc
cocoapods-downloader (0.6.1)
GIT
remote: https://github.com/CocoaPods/cocoapods-plugins.git
revision: f1364dd91ea334e46b2f37455aef46147d14575a
revision: 110d18e51f2db545096262832413d31a22e0461a
branch: master
specs:
cocoapods-plugins (0.2.0)
nap
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision: a8710a42b1ce379fb2afe66ce9f98a08b58fb482
remote: https://github.com/CocoaPods/cocoapods-trunk.git
revision: 62bca8ec7073fc59d4137818bd78e0bbc8b1718f
branch: master
specs:
cocoapods-downloader (0.6.1)
cocoapods-trunk (0.1.4)
json_pure (~> 1.8)
nap (>= 0.8)
netrc
GIT
remote: https://github.com/CocoaPods/Core.git
revision: f557903817f29000819d4b1b754e6dd667587c30
remote: https://github.com/CocoaPods/cocoapods-try.git
revision: 59a225cd4dd1868da4be7c4cc870cae427f04bf9
branch: master
specs:
cocoapods-core (0.33.1)
activesupport (>= 3.2.15)
fuzzy_match (~> 2.0.4)
json_pure (~> 1.8)
nap (~> 0.8.0)
cocoapods-try (0.3.0)
GIT
remote: https://github.com/CocoaPods/CLAide.git
revision: c4c75f833db97173fca7380890ed99affad2bbab
branch: master
PATH
remote: .
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
remote: http://rubygems.org/
......@@ -85,6 +85,8 @@ GEM
multi_json (~> 1.0)
addressable (2.3.6)
ast (2.0.0)
astrolabe (1.3.0)
parser (>= 2.2.0.pre.3, < 3.0)
awesome_print (1.2.0)
bacon (1.2.0)
clintegracon (0.5.2)
......@@ -137,7 +139,8 @@ GEM
ffi (>= 0.5.0)
rb-kqueue (0.2.3)
ffi (>= 0.5.0)
rubocop (0.25.0)
rubocop (0.26.0)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.4, < 3.0)
powerpack (~> 0.0.6)
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
#-----------------------------------------------------------------------------#
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"
puts "Updating submodules"
......@@ -113,7 +127,7 @@ begin
#--------------------------------------#
desc "Run the integration spec"
task :integration do
task :integration => :check_requirements do
unless File.exists?('spec/cocoapods-integration-specs')
$stderr.puts red("Integration files not checked out. Run `rake bootstrap`")
exit 1
......@@ -128,7 +142,7 @@ begin
# The specs helper interfere with the integration 2 specs and thus they need
# to be run separately.
#
task :all => :unpack_fixture_tarballs do
task :all => [:unpack_fixture_tarballs, :check_requirements] do
ENV['GENERATE_COVERAGE'] = 'true'
puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
......@@ -300,3 +314,9 @@ end
def red(string)
"\033[0;31m#{string}\e[0m"
end
def has_required_binary?(name)
`which #{name}`
$?.success?
end
......@@ -19,10 +19,10 @@
/* End PBXBuildFile 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>"; };
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>"; };
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>"; };
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; };
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; };
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; };
......@@ -54,6 +54,15 @@
/* End PBXFrameworksBuildPhase 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 = {
isa = PBXGroup;
children = (
......@@ -61,8 +70,7 @@
F8129C051591061B009BFE23 /* Classes */,
F8129BFE1591061B009BFE23 /* Frameworks */,
F8129BFC1591061B009BFE23 /* Products */,
206C0CA2FCD1CCE9783CC39F /* Pods-AFNetworking Example.debug.xcconfig */,
1489BC7C65DCCDA21BD9C10D /* Pods-AFNetworking Example.release.xcconfig */,
A052BC91C16D94336357A93A /* Pods */,
);
indentWidth = 4;
sourceTree = "<group>";
......@@ -220,7 +228,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
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;
};
/* End PBXShellScriptBuildPhase section */
......@@ -298,7 +306,7 @@
};
F8129C1A1591061B009BFE23 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 206C0CA2FCD1CCE9783CC39F /* Pods-AFNetworking Example.debug.xcconfig */;
baseConfigurationReference = 53763FEA1CCF8658D4ACFFCE /* Pods-AFNetworking Example.debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
......@@ -312,7 +320,7 @@
};
F8129C1B1591061B009BFE23 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1489BC7C65DCCDA21BD9C10D /* Pods-AFNetworking Example.release.xcconfig */;
baseConfigurationReference = B3341CC0913DB5992CDCDDF6 /* Pods-AFNetworking Example.release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
......
......@@ -33,11 +33,11 @@
/* End PBXBuildFile 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; };
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; };
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; };
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; };
......@@ -88,6 +88,15 @@
/* End PBXFrameworksBuildPhase 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 */ = {
isa = PBXGroup;
children = (
......@@ -131,8 +140,7 @@
F8E469ED1395812A00DB05C8 /* Images */,
F8E469631395739D00DB05C8 /* Frameworks */,
F8E469611395739C00DB05C8 /* Products */,
17E95B75D4453CE0BA3028FF /* Pods-AFNetworking iOS Example.debug.xcconfig */,
08ACA902EBEF3347432C3442 /* Pods-AFNetworking iOS Example.release.xcconfig */,
9CE17E7C344B0E75BC0723EA /* Pods */,
);
indentWidth = 4;
sourceTree = "<group>";
......@@ -287,7 +295,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
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;
};
E4419DF1E8B742E49777FFE0 /* Check Pods Manifest.lock */ = {
......@@ -358,7 +366,7 @@
};
F8E469821395739D00DB05C8 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 17E95B75D4453CE0BA3028FF /* Pods-AFNetworking iOS Example.debug.xcconfig */;
baseConfigurationReference = C3B414D5F7FCC5379A284B4E /* Pods-AFNetworking iOS Example.debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
......@@ -380,7 +388,7 @@
};
F8E469831395739D00DB05C8 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 08ACA902EBEF3347432C3442 /* Pods-AFNetworking iOS Example.release.xcconfig */;
baseConfigurationReference = 5628C4E1DE6DDC806B14CF8D /* Pods-AFNetworking iOS Example.release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
......
......@@ -59,7 +59,8 @@ module Pod
# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"
PLATFORM
for target in project.targets
project.targets.each do |target|
podfile << target_module(target)
end
podfile << "\n"
......
......@@ -28,8 +28,9 @@ module Pod
end
def run
require 'json'
spec = Specification.from_file(@path)
output_pipe.puts spec.to_json
output_pipe.puts(JSON.pretty_generate(spec))
end
end
......
......@@ -17,8 +17,8 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', true),
CLAide::Argument.new('TEMPLATE_URL', false)
CLAide::Argument.new('NAME', true),
CLAide::Argument.new('TEMPLATE_URL', false),
]
def initialize(argv)
......@@ -29,8 +29,8 @@ module Pod
def validate!
super
help! "A name for the Pod is required." unless @name
help! "The Pod name cannot contain spaces." if @name.match(/\s/)
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 begin with a '.'" if @name[0, 1] == '.'
end
......@@ -50,9 +50,9 @@ module Pod
executable :git
executable :ruby
TEMPLATE_REPO = "https://github.com/CocoaPods/pod-template.git"
TEMPLATE_INFO_URL = "https://github.com/CocoaPods/pod-template"
CREATE_NEW_POD_INFO_URL = "http://guides.cocoapods.org/making/making-a-cocoapod"
TEMPLATE_REPO = 'https://github.com/CocoaPods/pod-template.git'
TEMPLATE_INFO_URL = 'https://github.com/CocoaPods/pod-template'
CREATE_NEW_POD_INFO_URL = 'http://guides.cocoapods.org/making/making-a-cocoapod'
# Clones the template from the remote in the working directory using
# the name of the Pod.
......@@ -61,7 +61,7 @@ module Pod
#
def clone_template
UI.section("Cloning `#{template_repo_url}` into `#{@name}`.") do
git!"clone '#{template_repo_url}' #{@name}"
git! "clone '#{template_repo_url}' #{@name}"
end
end
......@@ -72,10 +72,10 @@ module Pod
def configure_template
UI.section("Configuring #{@name} template.") do
Dir.chdir(@name) do
if File.exists? "configure"
system "./configure #{@name}"
if File.exist?('configure')
system("./configure #{@name}")
else
UI.warn "Template does not have a configure file."
UI.warn 'Template does not have a configure file.'
end
end
end
......@@ -109,11 +109,11 @@ module Pod
DESC
def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"],
["--only-errors", "Lint validates even if warnings are present"],
["--subspec=NAME","Lint validates only the given subspec"],
["--no-subspecs", "Lint skips validation of subspecs"],
["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super)
[['--quick', 'Lint skips checks that would require to download and build the spec'],
['--only-errors', 'Lint validates even if warnings are present'],
['--subspec=NAME', 'Lint validates only the given subspec'],
['--no-subspecs', 'Lint skips validation of subspecs'],
['--no-clean', 'Lint leaves the build directory intact for inspection']].concat(super)
end
def initialize(argv)
......@@ -153,7 +153,7 @@ module Pod
message = "#{validator.spec.name} did not pass validation."
if @clean
message << "\nYou can use the `--no-clean` option to inspect " \
"any issue."
'any issue.'
end
raise Informative, message
end
......@@ -173,19 +173,20 @@ module Pod
# @raise If multiple podspecs are found.
#
def podspecs_to_lint
if !@podspecs_paths.empty? then
if !@podspecs_paths.empty?
Array(@podspecs_paths)
else
else
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
end
end
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -23,7 +23,7 @@ module Pod
def run
update_if_necessary!
sets = SourcesManager.all_sets
sets = SourcesManager.aggregate.all_sets
sets.each { |set| UI.pod(set, :name_and_version) }
UI.puts "\n#{sets.count} pods were found"
end
......@@ -47,7 +47,7 @@ module Pod
days = [1, 2, 3, 5, 8]
dates, groups = {}, {}
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
creation_dates = statistics_provider.creation_dates(sets)
......
......@@ -75,7 +75,8 @@ module Pod
class Update < Command
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
Updates the Pods identified by the specified `POD_NAMES`. If no
......@@ -101,12 +102,19 @@ module Pod
verify_lockfile_exists!
# 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
raise Informative, (missing_pods.length > 1 \
? 'Pods %s are not installed and cannot be updated' \
: 'Pod %s is not installed and cannot be updated'
) % missing_pods.map { |p| "`#{p}`" }.join(', ')
if missing_pods.length > 1
message = "Pods `#{missing_pods.join('`, `')}` are not " \
'installed and cannot be updated'
else
message = "The `#{missing_pods.first}` Pod is not installed " \
'and cannot be updated'
end
raise Informative, message
end
run_install_with_update(:pods => @pods)
......
......@@ -17,7 +17,7 @@ module Pod
def self.options
[
['--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)
end
......@@ -51,16 +51,17 @@ module Pod
# @!group Setup steps
# Migrates any repos from the old directory structure to the new directory
# structure.
# Migrates any repos from the old directory structure to the new
# directory structure.
#
# @todo: Remove by 1.0
#
# @return [void]
def migrate_repos
config.repos_dir.mkpath
Dir.foreach old_master_repo_dir.parent do |repo_dir|
source_repo_dir = old_master_repo_dir.parent + 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
end
end
......
......@@ -19,7 +19,7 @@ module Pod
DESC
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)
......@@ -29,7 +29,7 @@ module Pod
def validate!
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
def run
......@@ -63,11 +63,11 @@ module Pod
]
def self.options
[ ["--quick", "Lint skips checks that would require to download and build the spec"],
["--only-errors", "Lint validates even if warnings are present"],
["--subspec=NAME","Lint validates only the given subspec"],
["--no-subspecs", "Lint skips validation of subspecs"],
["--no-clean", "Lint leaves the build directory intact for inspection"] ].concat(super)
[['--quick', 'Lint skips checks that would require to download and build the spec'],
['--only-errors', 'Lint validates even if warnings are present'],
['--subspec=NAME', 'Lint validates only the given subspec'],
['--no-subspecs', 'Lint skips validation of subspecs'],
['--no-clean', 'Lint leaves the build directory intact for inspection']].concat(super)
end
def initialize(argv)
......@@ -102,10 +102,10 @@ module Pod
count = podspecs_to_lint.count
UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n"
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"
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
podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist?
end
......@@ -114,32 +114,32 @@ module Pod
def podspecs_to_lint
@podspecs_to_lint ||= begin
files = []
@podspecs_paths << '.' if @podspecs_paths.empty?
@podspecs_paths.each do |path|
if path =~ /https?:\/\//
require 'open-uri'
output_path = podspecs_tmp_dir + File.basename(path)
output_path.dirname.mkpath
open(path) do |io|
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')
files = []
@podspecs_paths << '.' if @podspecs_paths.empty?
@podspecs_paths.each do |path|
if path =~ /https?:\/\//
require 'open-uri'
output_path = podspecs_tmp_dir + File.basename(path)
output_path.dirname.mkpath
open(path) do |io|
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
end
files
end
end
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
......@@ -153,11 +153,13 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', false)
CLAide::Argument.new('NAME', false),
]
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
def initialize(argv)
......@@ -169,7 +171,7 @@ module Pod
def validate!
super
help! "A podspec name is required." unless @spec
help! 'A podspec name is required.' unless @spec
end
def run
......@@ -187,11 +189,11 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', false)
CLAide::Argument.new('NAME', false),
]
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
def initialize(argv)
......@@ -203,14 +205,14 @@ module Pod
def validate!
super
help! "A podspec name is required." unless @spec
help! 'A podspec name is required.' unless @spec
end
def run
filepath = if @show_all
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 }]? ")
specs[index]
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 }]? ")
specs[index]
else
get_path_of_spec(@spec)
end
......@@ -229,11 +231,12 @@ module Pod
DESC
self.arguments = [
CLAide::Argument.new('NAME', false)
CLAide::Argument.new('NAME', false),
]
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
def initialize(argv)
......@@ -245,19 +248,20 @@ module Pod
def validate!
super
help! "A podspec name is required." unless @spec
help! 'A podspec name is required.' unless @spec
end
def run
filepath = if @show_all
if @show_all
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 }]? ")
specs[index]
message = "Which spec would you like to edit [1-#{specs.count}]? "
index = choose_from_array(specs, message)
filepath = specs[index]
else
get_path_of_spec(@spec)
filepath = get_path_of_spec(@spec)
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."
end
......@@ -284,7 +288,7 @@ module Pod
raise Informative, "Failed to open editor. Set your 'EDITOR' environment variable."
end
def exec_editor *args
def exec_editor(*args)
return if args.to_s.empty?
safe_exec(which_editor, *args)
end
......@@ -292,7 +296,7 @@ module Pod
def safe_exec(cmd, *args)
# This buys us proper argument quoting and evaluation
# of environment variables in the cmd parameter.
exec "/bin/sh", "-i", "-c", cmd + ' "$@"', "--", *args
exec('/bin/sh', '-i', '-c', cmd + ' "$@"', '--', *args)
end
end
......@@ -337,7 +341,7 @@ module Pod
elsif sets.map(&:name).include?(spec)
set = sets.find { |s| s.name == spec }
else
names = sets.collect(&:name) * ', '
names = sets.map(&:name) * ', '
raise Informative, "More than one spec found for '#{ spec }':\n#{ names }"
end
......@@ -346,19 +350,19 @@ module Pod
return pathname_from_spec(best_spec, spec_source)
end
return all_paths_from_set(set)
all_paths_from_set(set)
end
# @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)
end
# @return [String] of spec paths one on each line
#
def all_paths_from_set(set)
paths = ""
paths = ''
sources = set.sources
......@@ -384,18 +388,18 @@ module Pod
sources.each do |source|
versions = source.versions(set.name)
versions.each do |version|
if !best_version or version > best_version
if !best_version || version > best_version
best_source = source
best_version = version
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 }'"
end
return best_source.specification(set.name, best_version), best_source
[best_source.specification(set.name, best_version), best_source]
end
#--------------------------------------#
......@@ -427,7 +431,7 @@ module Pod
data[:name] = repo['name']
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_email] = user['email'] || 'email@address.com'
data[:source_url] = repo['clone_url']
......@@ -436,18 +440,18 @@ module Pod
end
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 = {}
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)
end
version = versions_tags.keys.sort.last || '0.0.1'
data = {:version => version}
data = { :version => version }
if version == '0.0.1'
branches = GitHub.branches(repo['html_url'])
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] = master['commit']['sha']
else
......@@ -458,7 +462,7 @@ module Pod
end
def spec_template(data)
return <<-SPEC
<<-SPEC
#
# 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.
......@@ -513,7 +517,7 @@ Pod::Spec.new do |s|
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#
s.author = { "#{data[:author_name]}" => "#{data[:author_email]}" }
# Or just: s.author = "#{data[:author_name]}"
# s.authors = { "#{data[:author_name]}" => "#{data[:author_email]}" }
......@@ -599,7 +603,7 @@ end
end
def semantic_versioning_notice(repo_id, repo)
return <<-EOS
<<-EOS
#{'――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――'.reversed}
......
module Pod
# Stores the global configuration of CocoaPods.
#
class Config
# The default settings for the configuration.
#
# Users can specify custom settings in `~/.cocoapods/config.yaml`.
......@@ -35,18 +33,18 @@ module Pod
# performed actions.
#
attr_accessor :verbose
alias_method :verbose?, :verbose
alias_method :verbose?, :verbose
# @return [Bool] Whether CocoaPods should produce not output.
#
attr_accessor :silent
alias_method :silent?, :silent
alias_method :silent?, :silent
# @return [Bool] Whether a message should be printed when a new version of
# CocoaPods is available.
#
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
# @return [Bool] Whether the installer should clean after the installation.
#
attr_accessor :clean
alias_method :clean?, :clean
alias_method :clean?, :clean
# @return [Bool] Whether CocoaPods should integrate a user target and build
# the workspace or just create the Pods project.
#
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.
#
attr_accessor :skip_repo_update
alias_method :skip_repo_update?, :skip_repo_update
alias_method :skip_repo_update?, :skip_repo_update
public
......@@ -115,13 +112,13 @@ module Pod
# files are stored.
#
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
# @return [Pathname] the directory where the CocoaPods sources are stored.
#
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
attr_writer :repos_dir
......@@ -129,7 +126,7 @@ module Pod
# @return [Pathname] the directory where the CocoaPods templates are stored.
#
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
# @return [Pathname] the root of the CocoaPods installation where the
......@@ -138,7 +135,7 @@ module Pod
def installation_root
current_path = Pathname.pwd
unless @installation_root
while(!current_path.root?)
until current_path.root?
if podfile_path_in_dir(current_path)
@installation_root = current_path
unless current_path == Pathname.pwd
......@@ -155,7 +152,7 @@ module Pod
end
attr_writer :installation_root
alias :project_root :installation_root
alias_method :project_root, :installation_root
# @return [Pathname] The root of the sandbox.
#
......@@ -164,7 +161,7 @@ module Pod
end
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.
#
......@@ -215,7 +212,7 @@ module Pod
# @return [Pathname]
#
def default_podfile_path
@default_podfile_path ||= templates_dir + "Podfile.default"
@default_podfile_path ||= templates_dir + 'Podfile.default'
end
# Returns the path of the default Podfile test pods.
......@@ -225,7 +222,7 @@ module Pod
# @return [Pathname]
#
def default_test_podfile_path
@default_test_podfile_path ||= templates_dir + "Podfile.test"
@default_test_podfile_path ||= templates_dir + 'Podfile.test'
end
# @return [Pathname] The file to use a cache of the statistics provider.
......@@ -234,7 +231,7 @@ module Pod
cache_root + 'statistics.yml'
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
cache_root + 'search_index.yaml'
......@@ -262,7 +259,7 @@ module Pod
# @return [Pathname] The path of the file which contains the user settings.
#
def user_settings_file
home_dir + "config.yaml"
home_dir + 'config.yaml'
end
# Sets the values of the attributes with the given hash.
......@@ -275,7 +272,7 @@ module Pod
def configure_with(values_by_key)
return unless values_by_key
values_by_key.each do |key, value|
self.instance_variable_set("@#{key}", value)
instance_variable_set("@#{key}", value)
end
end
......@@ -327,8 +324,8 @@ module Pod
#
# @return [void]
#
def self.instance=(instance)
@instance = instance
class << self
attr_writer :instance
end
# Provides support for accessing the configuration instance in other
......
......@@ -78,7 +78,7 @@ module Pod
#-------------------------------------------------------------------------#
# Helper class that allows to write to an {IO} instance taking into account
# the UI indentation lever.
# the UI indentation level.
#
class Indenter < ::Array
# @return [Fixnum] The indentation level of the UI.
......
......@@ -97,11 +97,19 @@ module Pod
def pre_download(sandbox)
title = "Pre-downloading: `#{name}` #{description}"
UI.titled_section(title, :verbose_prefix => '-> ') do
target = sandbox.root + name
target = sandbox.pod_dir(name)
target.rmtree if target.exist?
downloader = Downloader.for_target(target, params)
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)
if downloader.options_specific?
source = params
......
......@@ -15,7 +15,7 @@ module Pod
end
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
......
module Pod
module Generator
class CopyResourcesScript
# @return [Array<#to_s>] A list of files relative to the project pods
# root.
#
......@@ -44,7 +43,7 @@ module Pod
#
EXTERNAL_STRINGS_FILE_MIMINUM_DEPLOYMENT_TARGET = {
: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
......@@ -58,11 +57,11 @@ module Pod
# @return [String] The install resources shell function.
#
def install_resources_function
if use_external_strings_file?
INSTALL_RESOURCES_FUCTION
else
INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '')
end
if use_external_strings_file?
INSTALL_RESOURCES_FUCTION
else
INSTALL_RESOURCES_FUCTION.gsub(' --reference-external-strings-file', '')
end
end
# @return [String] The contents of the copy resources script.
......@@ -70,14 +69,13 @@ module Pod
def script
script = install_resources_function
resources.each do |resource|
script += %Q[install_resource "#{resource}"\n]
script += %( install_resource "#{resource}"\n )
end
script += RSYNC_CALL
script += XCASSETS_COMPILE
script
end
INSTALL_RESOURCES_FUCTION = <<EOS
#!/bin/sh
set -e
......@@ -124,7 +122,6 @@ install_resource()
}
EOS
RSYNC_CALL = <<EOS
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
rm -f "$RESOURCES_TO_COPY"
EOS
XCASSETS_COMPILE = <<EOS
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ]
then
case "${TARGETED_DEVICE_FAMILY}" in
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
......@@ -151,8 +147,8 @@ then
;;
*)
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}"
fi
EOS
......
module Pod
module Generator
# Generates a prefix header file for a Pods library. The prefix header is
# generated according to the platform of the target and the pods.
#
......@@ -8,7 +7,6 @@ module Pod
# `Cocoa/Cocoa.h`.
#
class PrefixHeader
# @return [Array<FileAccessor>] The file accessors for which to generate
# the prefix header.
#
......@@ -55,10 +53,10 @@ module Pod
result << "#endif\n"
imports.each do |import|
result << %|\n#import "#{import}"|
result << %(\n#import "#{import}")
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
end.compact.uniq
......@@ -87,7 +85,6 @@ module Pod
def save_as(path)
path.open('w') { |header| header.write(generate) }
end
end
end
end
......@@ -53,7 +53,7 @@ module Pod
'HEADER_SEARCH_PATHS' => XCConfigHelper.quote(target.sandbox.public_headers.search_paths),
'PODS_ROOT' => target.relative_pods_root,
'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|
......
module Pod
# @todo: Remove by CocoaPods 1.0
#
class Podfile
def config
UI.warn 'Podfile#config is deprecated. The config is accessible from ' \
'the parameter passed to the hooks'
Config.instance
end
end
class Podfile::TargetDefinition
def copy_resources_script_name
UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \
'The value is accessible directly from the representation of the ' \
'library using the #copy_resources_script_path method.'
Config.instance.sandbox.root + "#{label}-resources.sh"
class TargetDefinition
def copy_resources_script_name
UI.warn 'TargetDefinition#copy_resources_script_name is deprecated. ' \
'The value is accessible directly from the representation of the ' \
'library using the #copy_resources_script_path method.'
Config.instance.sandbox.root + "#{label}-resources.sh"
end
end
end
......
......@@ -28,14 +28,15 @@ module Pod
# source control.
#
class Installer
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
autoload :Analyzer, 'cocoapods/installer/analyzer'
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 :TargetInstaller, 'cocoapods/installer/target_installer'
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_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 :HooksContext, 'cocoapods/installer/hooks_context'
include Config::Mixin
......@@ -85,6 +86,7 @@ module Pod
# @return [void]
#
def install!
prepare
resolve_dependencies
download_dependencies
generate_pods_project
......@@ -92,6 +94,13 @@ module Pod
perform_post_install_actions
end
def prepare
UI.section 'Preparing' do
sandbox.prepare
Migrator.migrate(sandbox)
end
end
def resolve_dependencies
UI.section 'Analyzing dependencies' do
analyze
......@@ -393,7 +402,7 @@ module Pod
# @return [void]
#
def install_libraries
UI.message'- Installing libraries' do
UI.message '- Installing targets' do
pod_targets.sort_by(&:name).each do |pod_target|
next if pod_target.target_definition.empty?
target_installer = PodTargetInstaller.new(sandbox, pod_target)
......
......@@ -47,10 +47,10 @@ module Pod
def analyze(allow_fetches = true)
update_repositories_if_needed if allow_fetches
@result = AnalysisResult.new
compute_target_platforms
@result.podfile_state = generate_podfile_state
@locked_dependencies = generate_version_locking_dependencies
compute_target_platforms
fetch_external_sources if allow_fetches
@result.specs_by_target = resolve_dependencies
@result.specifications = generate_specifications
......@@ -150,7 +150,8 @@ module Pod
UI.section 'Finding Podfile changes' do
pods_by_state = lockfile.detect_changes_with_podfile(podfile)
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
pods_state = SpecsState.new(pods_by_state)
pods_state.print
......@@ -165,8 +166,6 @@ module Pod
# Updates the source repositories unless the config indicates to skip it.
#
# @return [void]
#
def update_repositories_if_needed
unless config.skip_repo_update?
UI.section 'Updating spec repositories' do
......@@ -245,8 +244,8 @@ module Pod
locking_pods = locking_pods.select { |pod| !update[:pods].include?(pod) }
end
locking_pods.map do |pod|
lockfile.dependency_to_lock_pod_named(pod)
end
lockfile.dependencies_to_lock_pod_named(pod)
end.flatten
end
end
......@@ -319,7 +318,13 @@ module Pod
def resolve_dependencies
specs_by_target = nil
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
end
specs_by_target
......@@ -482,7 +487,7 @@ module Pod
# @todo Is assigning the platform to the target definition the best way
# to go?
#
def compute_archs_for_target_definition(_target_definition, user_targets)
def compute_archs_for_target_definition(target_definition, user_targets)
archs = []
user_targets.each do |target|
target_archs = target.common_resolved_build_setting('ARCHS')
......@@ -490,7 +495,9 @@ module Pod
end
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
end
......@@ -503,17 +510,19 @@ module Pod
# @return [void]
#
def compute_target_platforms
podfile.target_definition_list.each do |target_definition|
if config.integrate_targets?
project_path = compute_user_project_path(target_definition)
user_project = Xcodeproj::Project.open(project_path)
targets = compute_user_project_targets(target_definition, user_project)
platform = compute_platform_for_target_definition(target_definition, targets)
archs = compute_archs_for_target_definition(target_definition, targets)
@archs_by_target_def[target_definition] = archs
else
unless target_definition.platform
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
UI.section 'Inspecting targets to integrate' do
podfile.target_definition_list.each do |target_definition|
if config.integrate_targets?
project_path = compute_user_project_path(target_definition)
user_project = Xcodeproj::Project.open(project_path)
targets = compute_user_project_targets(target_definition, user_project)
platform = compute_platform_for_target_definition(target_definition, targets)
archs = compute_archs_for_target_definition(target_definition, targets)
@archs_by_target_def[target_definition] = archs
else
unless target_definition.platform
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
end
end
end
end
......
......@@ -183,7 +183,7 @@ module Pod
def header_mappings(headers_sandbox, file_accessor, headers)
consumer = file_accessor.spec_consumer
dir = headers_sandbox
dir = dir + consumer.header_dir if consumer.header_dir
dir += consumer.header_dir if consumer.header_dir
mappings = {}
headers.each do |header|
......@@ -191,7 +191,7 @@ module Pod
if 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)
sub_dir = sub_dir + relative_path.dirname
sub_dir += relative_path.dirname
end
mappings[sub_dir] ||= []
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
class Installer
# Controller class responsible of creating and configuring the static
# library target in Pods project. It also creates the support file needed
# by the target.
#
class TargetInstaller
# @return [Sandbox] sandbox the sandbox where the support files should
# be generated.
#
......@@ -47,7 +45,6 @@ module Pod
configuration = @target.add_build_configuration(bc_name, type)
end
settings = {}
if library.archs
settings['ARCHS'] = library.archs
......@@ -60,13 +57,10 @@ module Pod
library.target = @target
end
# Creates the group that holds the references to the support files
# generated by this installer.
#
# @return [void]
# Creates the directory where to store the support files of the target.
#
def create_suport_files_group
@support_files_group = project.support_files_group.new_group(library.name)
def create_support_files_dir
library.support_files_dir.mkdir
end
# Generates a dummy source file for each target so libraries that contain
......@@ -76,12 +70,10 @@ module Pod
#
def create_dummy_source
path = library.dummy_source_path
UI.message "- Generating dummy source file at #{UI.path(path)}" do
generator = Generator::DummySource.new(library.label)
generator.save_as(path)
file_reference = add_file_to_support_group(path)
target.source_build_phase.add_file_reference(file_reference)
end
generator = Generator::DummySource.new(library.label)
generator.save_as(path)
file_reference = add_file_to_support_group(path)
target.source_build_phase.add_file_reference(file_reference)
end
# @return [PBXNativeTarget] the target generated by the installation
......@@ -126,8 +118,6 @@ module Pod
end
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Installer
# Creates the targets which aggregate the Pods libraries in the Pods
# project and the relative support files.
#
class AggregateTargetInstaller < TargetInstaller
# Creates the target in the Pods project and the relative support files.
#
# @return [void]
......@@ -13,6 +11,7 @@ module Pod
def install!
UI.message "- Installing target `#{library.name}` #{library.platform}" do
add_target
create_support_files_dir
create_suport_files_group
create_xcconfig_file
create_target_environment_header
......@@ -27,6 +26,18 @@ module Pod
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.
#
# @return [void]
......@@ -34,13 +45,11 @@ module Pod
def create_xcconfig_file
target.build_configurations.each do |configuration|
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.save_as(path)
library.xcconfigs[configuration.name] = gen.xcconfig
xcconfig_file_ref = add_file_to_support_group(path)
configuration.base_configuration_reference = xcconfig_file_ref
end
gen = Generator::XCConfig::AggregateXCConfig.new(library, configuration.name)
gen.save_as(path)
library.xcconfigs[configuration.name] = gen.xcconfig
xcconfig_file_ref = add_file_to_support_group(path)
configuration.base_configuration_reference = xcconfig_file_ref
end
end
......@@ -49,11 +58,9 @@ module Pod
#
def create_target_environment_header
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.save_as(path)
add_file_to_support_group(path)
end
generator = Generator::TargetEnvironmentHeader.new(library.specs_by_build_configuration)
generator.save_as(path)
add_file_to_support_group(path)
end
# Generates the bridge support metadata if requested by the {Podfile}.
......@@ -67,13 +74,11 @@ module Pod
def create_bridge_support_file
if target_definition.podfile.generate_bridge_support?
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 }
generator = Generator::BridgeSupport.new(headers)
generator.save_as(path)
add_file_to_support_group(path)
@bridge_support_file = path.relative_path_from(sandbox.root)
end
headers = target.headers_build_phase.files.map { |bf| sandbox.root + bf.file_ref.path }
generator = Generator::BridgeSupport.new(headers)
generator.save_as(path)
add_file_to_support_group(path)
@bridge_support_file = path.relative_path_from(sandbox.root)
end
end
......@@ -87,18 +92,16 @@ module Pod
#
def create_copy_resources_script
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
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
resources = []
resources.concat(resource_paths)
resources.concat(resource_bundles)
resources << bridge_support_file if bridge_support_file
generator = Generator::CopyResourcesScript.new(resources, library.platform)
generator.save_as(path)
add_file_to_support_group(path)
end
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_bundles = file_accessors.map { |accessor| accessor.resource_bundles.keys.map { |name| "${BUILT_PRODUCTS_DIR}/#{name}.bundle" } }.flatten
resources = []
resources.concat(resource_paths)
resources.concat(resource_bundles)
resources << bridge_support_file if bridge_support_file
generator = Generator::CopyResourcesScript.new(resources, library.platform)
generator.save_as(path)
add_file_to_support_group(path)
end
# Generates the acknowledgement files (markdown and plist) for the target.
......@@ -109,12 +112,10 @@ module Pod
basepath = library.acknowledgements_basepath
Generator::Acknowledgements.generators.each do |generator_class|
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
generator = generator_class.new(file_accessors)
generator.save_as(path)
add_file_to_support_group(path)
end
file_accessors = library.pod_targets.map(&:file_accessors).flatten
generator = generator_class.new(file_accessors)
generator.save_as(path)
add_file_to_support_group(path)
end
end
......@@ -126,7 +127,6 @@ module Pod
attr_reader :bridge_support_file
#-----------------------------------------------------------------------#
end
end
end
module Pod
class Installer
# Creates the target for the Pods libraries in the Pods project and the
# relative support files.
#
class PodTargetInstaller < TargetInstaller
# Creates the target in the Pods project and the relative support files.
#
# @return [void]
......@@ -13,6 +11,7 @@ module Pod
def install!
UI.message "- Installing target `#{library.name}` #{library.platform}" do
add_target
create_support_files_dir
add_files_to_build_phases
add_resources_bundle_targets
create_xcconfig_file
......@@ -34,17 +33,15 @@ module Pod
# @return [void]
#
def add_files_to_build_phases
UI.message "- Adding Build files" do
library.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer
flags = compiler_flags_for_consumer(consumer)
all_source_files = file_accessor.source_files
regular_source_files = all_source_files.reject { |sf| sf.extname == ".d" }
regular_file_refs = regular_source_files.map { |sf| project.reference_for_path(sf) }
target.add_file_references(regular_file_refs, flags)
other_file_refs = (all_source_files - regular_source_files).map { |sf| project.reference_for_path(sf) }
target.add_file_references(other_file_refs, nil)
end
library.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer
flags = compiler_flags_for_consumer(consumer)
all_source_files = file_accessor.source_files
regular_source_files = all_source_files.reject { |sf| sf.extname == '.d' }
regular_file_refs = regular_source_files.map { |sf| project.reference_for_path(sf) }
target.add_file_references(regular_file_refs, flags)
other_file_refs = (all_source_files - regular_source_files).map { |sf| project.reference_for_path(sf) }
target.add_file_references(other_file_refs, nil)
end
end
......@@ -56,24 +53,22 @@ module Pod
# @return [void]
#
def add_resources_bundle_targets
UI.message "- Adding resource bundles to Pods project" do
library.file_accessors.each do |file_accessor|
file_accessor.resource_bundles.each do |bundle_name, paths|
# Add a dependency on an existing Resource Bundle target if possible
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
library.file_accessors.each do |file_accessor|
file_accessor.resource_bundles.each do |bundle_name, paths|
# Add a dependency on an existing Resource Bundle target if possible
if bundle_target = project.targets.find { |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)
end
end
end
......@@ -85,20 +80,16 @@ module Pod
def create_xcconfig_file
path = library.xcconfig_path
public_gen = Generator::XCConfig::PublicPodXCConfig.new(library)
UI.message "- Generating public xcconfig file at #{UI.path(path)}" do
public_gen.save_as(path)
add_file_to_support_group(path)
end
public_gen.save_as(path)
add_file_to_support_group(path)
path = library.xcconfig_private_path
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)
xcconfig_file_ref = add_file_to_support_group(path)
private_gen.save_as(path)
xcconfig_file_ref = add_file_to_support_group(path)
target.build_configurations.each do |c|
c.base_configuration_reference = xcconfig_file_ref
end
target.build_configurations.each do |c|
c.base_configuration_reference = xcconfig_file_ref
end
end
......@@ -110,22 +101,20 @@ module Pod
#
def create_prefix_header
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.imports << library.target_environment_header_path.basename
generator.save_as(path)
add_file_to_support_group(path)
target.build_configurations.each do |c|
relative_path = path.relative_path_from(sandbox.root)
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
end
generator = Generator::PrefixHeader.new(library.file_accessors, library.platform)
generator.imports << library.target_environment_header_path.basename
generator.save_as(path)
add_file_to_support_group(path)
target.build_configurations.each do |c|
relative_path = path.relative_path_from(project.path.dirname)
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
end
end
ENABLE_OBJECT_USE_OBJC_FROM = {
: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.
......@@ -176,7 +165,7 @@ module Pod
if target_definition.inhibits_warnings_for_pod?(consumer.spec.root.name)
flags << '-w -Xanalyzer -analyzer-disable-checker'
end
flags * " "
flags * ' '
end
# Adds a reference to the given file in the support group of this target.
......@@ -188,12 +177,12 @@ module Pod
#
def add_file_to_support_group(path)
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)
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -28,6 +28,8 @@ module Pod
def integrate!
UI.section(integration_message) do
XCConfigIntegrator.integrate(target, native_targets)
update_to_cocoapods_0_34
unless native_targets_to_integrate.empty?
add_pods_library
add_copy_resources_script_phase
......@@ -48,6 +50,23 @@ module Pod
# @!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
# {TargetDefinition} integration libraries. Adds a file reference to
# the library of the {TargetDefinition} and adds it to the frameworks
......@@ -75,10 +94,10 @@ module Pod
def add_copy_resources_script_phase
phase_name = 'Copy Pods Resources'
native_targets_to_integrate.each do |native_target|
phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||
native_target.new_shell_script_build_phase(phase_name)
path = target.copy_resources_script_relative_path
phase.shell_script = %( "#{path}"\n )
phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first
phase ||= native_target.new_shell_script_build_phase(phase_name)
script_path = target.copy_resources_script_relative_path
phase.shell_script = %("#{script_path}"\n)
phase.show_env_vars_in_log = '0'
end
end
......@@ -100,7 +119,7 @@ module Pod
native_target.build_phases.unshift(phase)
phase.name = phase_name
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
cat << EOM
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
# integration.
#
def integration_message
"Integrating Pod #{'target'.pluralize(target.pod_targets.size)} " \
"`#{target.pod_targets.map(&:name).to_sentence}` " \
"into aggregate target #{target.name} " \
"of project #{UI.path target.user_project_path}."
"Integrating target `#{target.name}` " \
"(#{UI.path target.user_project_path} project)"
end
end
end
......
......@@ -18,7 +18,7 @@ module Pod
def self.integrate(pod_bundle, targets)
targets.each do |target|
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)
end
end
......@@ -40,15 +40,21 @@ module Pod
#
# @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|
path = pod_bundle.xcconfig_relative_path(nil)
file_ref = project.files.find { |f| f.path == path }
if file_ref
UI.message "- Removing (#{path})" do
file_refs = project.files.select do |file_ref|
path = file_ref.path.to_s
if File.extname(path) == '.xcconfig'
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
absolute_path = pod_bundle.xcconfig_path
File.delete(absolute_path) if File.exist?(absolute_path)
end
end
end
......@@ -66,8 +72,9 @@ module Pod
#
def self.set_target_xcconfig(pod_bundle, config)
path = pod_bundle.xcconfig_relative_path(config.name)
file_ref = config.project.files.find { |f| f.path == path }
file_ref ||= config.project.new_file(path)
group = config.project['Pods'] || config.project.new_group('Pods')
file_ref = group.files.find { |f| f.path == path }
file_ref ||= group.new_file(path)
config.base_configuration_reference = file_ref
end
......
......@@ -122,12 +122,11 @@ module Pod
#
# @return [PBXGroup] The group.
#
def pod_support_files_group(pod_name)
def pod_support_files_group(pod_name, dir)
group = pod_group(pod_name)
support_files_group = group['Support Files']
unless support_files_group
support_files_group = group.new_group('Support Files')
support_files_group.source_tree = 'SOURCE_ROOT'
support_files_group = group.new_group('Support Files', dir)
end
support_files_group
end
......
......@@ -28,14 +28,21 @@ module Pod
#
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 [Podfile] podfile @see podfile
# @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
@podfile = podfile
@locked_dependencies = locked_dependencies
@sources = Array(sources)
end
#-------------------------------------------------------------------------#
......@@ -51,14 +58,15 @@ module Pod
# definition.
#
def resolve
@cached_sources = SourcesManager.aggregate
@cached_sets = {}
@cached_specs = {}
@specs_by_target = {}
target_definitions = podfile.target_definition_list
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 = []
find_dependency_specs(podfile, target.dependencies, target)
specs = cached_specs.values_at(*@loaded_specs).sort_by(&:name)
......@@ -83,14 +91,6 @@ module Pod
# !@ 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
# loaded by the resolution process.
#
......@@ -148,7 +148,7 @@ module Pod
dependency = locked_dep if locked_dep
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)
unless @loaded_specs.include?(dependency.name)
......@@ -168,38 +168,61 @@ module Pod
end
end
# Loads or returns a previously initialized for the Pod of the given
# dependency.
# @return [Set] Loads or returns a previously initialized set for the Pod
# of the given 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.
#
def find_cached_set(dependency)
def find_cached_set(dependency, dependent_spec)
name = dependency.root_name
unless cached_sets[name]
if dependency.external_source
spec = sandbox.specification(dependency.root_name)
unless spec
raise StandardError, "[Bug] Unable to find the specification for `#{dependency}`."
raise StandardError, '[Bug] Unable to find the specification ' \
"for `#{dependency}`."
end
set = Specification::Set::External.new(spec)
else
set = cached_sources.search(dependency)
set = find_set_from_sources(dependency)
end
cached_sets[name] = 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
cached_sets[name]
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.
#
# @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]
#
def validate_platform(spec, target)
......
......@@ -11,38 +11,30 @@ module Pod
#
# Pods
# |
# +-- User
# | +-- [Target Name]-configuration.h
# | +-- Specs
# | +-- Scripts
# +-- Headers
# | +-- Private
# | | +-- [Pod Name]
# | +-- Public
# | +-- [Pod Name]
# |
# +-- Generated
# +-- Headers
# | +-- Private
# | | +-- [Pod Name]
# | +-- Public
# | +-- [Pod Name]
# |
# +-- Sources
# | +-- [Pod Name]
# |
# +-- Specs
# | +-- External Sources
# | +-- Normal Sources
# |
# +-- Target Support Files
# | +-- [Target Name]
# | +-- Pods-acknowledgements.markdown
# | +-- Pods-acknowledgements.plist
# | +-- Pods-dummy.m
# | +-- Pods-prefix.pch
# | +-- Pods.xcconfig
# |
# +-- Manifest.lock
# |
# +-- Pods.xcodeproj
#
# See #833
# +-- Local Podspecs
# | +-- External Sources
# | +-- Normal Sources
# |
# +-- Target Support Files
# | +-- [Target Name]
# | +-- Pods-acknowledgements.markdown
# | +-- Pods-acknowledgements.plist
# | +-- Pods-dummy.m
# | +-- Pods-prefix.pch
# | +-- Pods.xcconfig
# |
# +-- Sources
# | +-- [Pod Name]
# |
# +-- Manifest.lock
# |
# +-- Pods.xcodeproj
#
class Sandbox
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
......@@ -62,7 +54,7 @@ module Pod
def initialize(root)
FileUtils.mkdir_p(root)
@root = Pathname.new(root).realpath
@public_headers = HeadersStore.new(self, 'Headers')
@public_headers = HeadersStore.new(self, 'Public')
@predownloaded_pods = []
@head_pods = []
@checkout_sources = {}
......@@ -81,14 +73,6 @@ module Pod
#
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.
#
# @return [void]
......@@ -103,6 +87,19 @@ module Pod
podspe_path.rmtree if podspe_path
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.
#
def inspect
......@@ -127,17 +124,16 @@ module Pod
root + 'Pods.xcodeproj'
end
# Returns the path for the directory where to store the support files of
# a target.
# Returns the path for the directory where the support files of
# a target are stored.
#
# @param [String] name
# The name of the target.
#
# @return [Pathname] the path of the support files.
#
def library_support_files_dir(_name)
# root + "Target Support Files/#{name}"
root
def target_support_files_dir(name)
target_support_files_root + name
end
# Returns the path where the Pod with the given name is stored, taking into
......@@ -153,8 +149,7 @@ module Pod
if local?(root_name)
Pathname.new(development_pods[root_name])
else
# root + "Sources/#{name}"
root + root_name
sources_root + root_name
end
end
......@@ -168,10 +163,31 @@ module Pod
@pods_with_absolute_path.include? name
end
# @return [Pathname] the directory where to store the documentation.
# @return [Pathname] The directory where headers are stored.
#
def documentation_dir
root + 'Documentation'
def headers_root
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
#-------------------------------------------------------------------------#
......@@ -194,17 +210,6 @@ module Pod
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
# given name, if one is stored.
#
......@@ -215,11 +220,11 @@ module Pod
# @return [Nil] if the podspec is not stored.
#
def specification_path(name)
path = specifications_dir + "#{name}.podspec"
path = specifications_root + "#{name}.podspec"
if path.exist?
path
else
path = specifications_dir + "#{name}.podspec.json"
path = specifications_root + "#{name}.podspec.json"
if path.exist?
path
else
......@@ -240,9 +245,9 @@ module Pod
# @todo Store all the specifications (including those not originating
# 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"
output_path = specifications_dir(external_source) + file_name
output_path = specifications_root + file_name
output_path.dirname.mkpath
if podspec.is_a?(String)
output_path.open('w') { |f| f.puts(podspec) }
......
......@@ -7,7 +7,7 @@ module Pod
# @return [Pathname] the absolute path of this header directory.
#
def root
@root ||= @sandbox.root + @relative_path
sandbox.headers_root + @relative_path
end
# @return [Sandbox] the sandbox where this header directory is stored.
......@@ -31,7 +31,8 @@ module Pod
# root with the `${PODS_ROOT}` variable.
#
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
# Removes the directory as it is regenerated from scratch during each
......@@ -56,7 +57,8 @@ module Pod
# headers directory.
#
# @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.
#
......@@ -68,7 +70,7 @@ module Pod
namespaced_path.mkpath unless File.exist?(namespaced_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)
Dir.chdir(namespaced_path) do
FileUtils.ln_sf(source, relative_header_path.basename)
......
......@@ -5,25 +5,36 @@ module Pod
class << self
include Config::Mixin
# @return [Source::Aggregate] the aggregate of all the sources known to
# this installation of CocoaPods.
# @return [Source::Aggregate] The aggregate of all the sources with the
# known Pods.
#
def aggregate
Source::Aggregate.new(config.repos_dir)
dirs = config.repos_dir.children.select(&:directory?)
Source::Aggregate.new(dirs)
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.
#
def all
aggregate.all
dirs = config.repos_dir.children.select(&:directory?)
dirs.map { |repo| Source.new(repo) }
end
# @return [Array<Specification::Set>] the list of all the specification
# sets know to this installation of CocoaPods.
# @return [Source] The CocoaPods Master Repo source.
#
def all_sets
aggregate.all_sets
def master
sources(['master'])
end
# Search all the sources to match the set for the given dependency.
......@@ -126,10 +137,7 @@ module Pod
Config.instance.search_index_file
end
public
# @!group Updating Sources
#-----------------------------------------------------------------------#
extend Executable
executable :git
......@@ -267,10 +275,7 @@ module Pod
end
end
public
# @!group Master repo
#-----------------------------------------------------------------------#
# @return [Pathname] The path of the master repo.
#
......@@ -287,8 +292,6 @@ module Pod
master_repo_dir.exist? && repo_compatible?(master_repo_dir)
end
#-----------------------------------------------------------------------#
private
# @return [Bool] Whether the given path is writable by the current user.
......@@ -307,7 +310,7 @@ module Pod
# The name of the source.
#
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
raise Informative, "Unable to find the `#{name}` repo."
end
......@@ -320,10 +323,23 @@ module Pod
# @return [Source] The list of the git sources.
#
def git_sources
aggregate.all.select do |source|
all.select do |source|
git_repo?(source.data_provider.repo)
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
......@@ -71,8 +71,8 @@ module Pod
# @return [Pathname] the folder where to store the support files of this
# library.
#
def support_files_root
@sandbox.library_support_files_dir(name)
def support_files_dir
sandbox.target_support_files_dir(name)
end
# @param [String] variant
......@@ -83,41 +83,42 @@ module Pod
#
def xcconfig_path(variant = nil)
if variant
support_files_root + "#{label}.#{variant.downcase}.xcconfig"
support_files_dir + "#{label}.#{variant.downcase}.xcconfig"
else
support_files_root + "#{label}.xcconfig"
support_files_dir + "#{label}.xcconfig"
end
end
# @return [Pathname] the absolute path of the private xcconfig file.
#
def xcconfig_private_path
support_files_root + "#{label}-Private.xcconfig"
support_files_dir + "#{label}-Private.xcconfig"
end
# @return [Pathname] the absolute path of the header file which contains
# the information about the installed pods.
#
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
# @return [Pathname] the absolute path of the prefix header file.
#
def prefix_header_path
support_files_root + "#{label}-prefix.pch"
support_files_dir + "#{label}-prefix.pch"
end
# @return [Pathname] the absolute path of the bridge support file.
#
def bridge_support_path
support_files_root + "#{label}.bridgesupport"
support_files_dir + "#{label}.bridgesupport"
end
# @return [Pathname] the path of the dummy source generated by CocoaPods
#
def dummy_source_path
support_files_root + "#{label}-dummy.m"
support_files_dir + "#{label}-dummy.m"
end
#-------------------------------------------------------------------------#
......
......@@ -102,20 +102,20 @@ module Pod
# the file type.
#
def acknowledgements_basepath
support_files_root + "#{label}-acknowledgements"
support_files_dir + "#{label}-acknowledgements"
end
# @return [Pathname] The absolute path of the copy resources script.
#
def copy_resources_script_path
support_files_root + "#{label}-resources.sh"
support_files_dir + "#{label}-resources.sh"
end
# @return [String] The xcconfig path of the root from the `$(SRCROOT)`
# variable of the user's project.
#
def relative_pods_root
"${SRCROOT}/#{support_files_root.relative_path_from(client_root)}"
"${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}"
end
# @param [String] config_name The build configuration name to get the xcconfig for
......
......@@ -19,7 +19,7 @@ module Pod
@specs = specs
@target_definition = target_definition
@sandbox = sandbox
@build_headers = Sandbox::HeadersStore.new(sandbox, 'BuildHeaders')
@build_headers = Sandbox::HeadersStore.new(sandbox, 'Build')
@file_accessors = []
end
......@@ -80,8 +80,8 @@ module Pod
else
raise Informative, "The subspecs of `#{pod_name}` are linked to " \
"different build configurations for the `#{target_definition}` " \
'target. CocoaPods does not support subspecs across different ' \
'build configurations.'
'target. CocoaPods does not currently support subspecs across ' \
'different build configurations.'
end
end
......
......@@ -145,7 +145,9 @@ module Pod
#
def path(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}`"
else
''
......
......@@ -124,10 +124,8 @@ module Pod
#
# @note Uses the `:path` option of the Podfile.
#
attr_writer :local
def local?
@local
end
attr_accessor :local
alias_method :local?, :local
# @return [Bool] Whether the validator should fail only on errors or also
# on warnings.
......
Subproject commit cba2640d5c2e410d8b9d8e401d3ad65904ef8bd4
Subproject commit 64203384a3ac363eab602bc6f09004d483f594e1
......@@ -15,9 +15,9 @@ module Pod
it 'converts a podspec to JSON and prints it to STDOUT' do
out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec'))
out.should.match /"name":"BananaLib"/
out.should.match /"version":"1.0"/
out.should.match /"description":"Full of chunky bananas."/
out.should.match /"name": "BananaLib"/
out.should.match /"version": "1.0"/
out.should.match /"description": "Full of chunky bananas."/
end
end
......
......@@ -30,7 +30,7 @@ module Pod
@sut.any_instance.stubs(:clone_template)
dir = SpecHelper.temporary_directory + 'TestPod'
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
run_command('lib', 'create', 'TestPod')
end
......
......@@ -18,7 +18,7 @@ module Pod
end
it 'returns the new pods' do
sets = SourcesManager.all_sets
sets = SourcesManager.aggregate.all_sets
jsonkit_set = sets.find { |s| s.name == 'JSONKit' }
dates = {
'BananaLib' => Time.now,
......@@ -30,7 +30,7 @@ module Pod
end
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' }
out = run_command('list')
......
......@@ -68,8 +68,10 @@ module Pod
it 'for a single missing Pod' do
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', '--no-repo-update') }.should.raise Informative
exception.message.should.include 'Pod `Reachability` is not installed and cannot be updated'
should.raise Informative do
run_command('update', 'Reachability', '--no-repo-update')
end.message.should.include 'The `Reachability` Pod is not ' \
'installed and cannot be updated'
end
end
......
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
describe Command::Spec do
......@@ -254,7 +272,7 @@ module Pod
end
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
File.unstub(:exists?)
end
......
......@@ -65,7 +65,7 @@ CLIntegracon.configure do |c|
# Register special handling for YAML files
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'
nil # CP is not sorting array derived from hashes whose order is
# undefined in 1.8.7
......
......@@ -67,24 +67,6 @@ module Pod
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'
......
......@@ -3,19 +3,19 @@ require File.expand_path('../../spec_helper', __FILE__)
module Pod
describe Command do
it 'returns the proper command class' do
Command.parse(%w( install )).should.be.instance_of Command::Install
Command.parse(%w( list )).should.be.instance_of Command::List
Command.parse(%w( outdated )).should.be.instance_of Command::Outdated
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 lint )).should.be.instance_of Command::Repo::Lint
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( search )).should.be.instance_of Command::Search
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 lint )).should.be.instance_of Command::Spec::Lint
Command.parse(%w( init )).should.be.instance_of Command::Init
Command.parse(%w(install )).should.be.instance_of Command::Install
Command.parse(%w(list )).should.be.instance_of Command::List
Command.parse(%w(outdated )).should.be.instance_of Command::Outdated
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 lint )).should.be.instance_of Command::Repo::Lint
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(search )).should.be.instance_of Command::Search
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 lint )).should.be.instance_of Command::Spec::Lint
Command.parse(%w(init )).should.be.instance_of Command::Init
end
end
end
......@@ -6,6 +6,7 @@ module Pod
before do
dependency = Dependency.new('Reachability', :git => fixture('integration/Reachability'))
@subject = ExternalSources.from_dependency(dependency, nil)
config.sandbox.prepare
end
#--------------------------------------#
......@@ -35,18 +36,28 @@ module Pod
describe 'Subclasses helpers' do
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
sandbox = config.sandbox
@subject.send(:pre_download, sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
@subject.send(:pre_download, config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist?
sandbox.predownloaded_pods.should == ['Reachability']
sandbox.checkout_sources.should == {
config.sandbox.predownloaded_pods.should == ['Reachability']
config.sandbox.checkout_sources.should == {
'Reachability' => {
:git => fixture('integration/Reachability'),
:commit => '4ec575e4b074dcc87c44018cce656672a979b34a',
},
}
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
......@@ -13,7 +13,7 @@ module Pod
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist?
end
......
......@@ -5,45 +5,45 @@ module Pod
before do
params = { :path => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params)
dependency = Dependency.new('Reachability', params)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
end
it "creates a copy of the podspec" do
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist?
end
it "supports the deprecated local key" do
it 'supports the deprecated local key' do
params = { :local => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params)
dependency = Dependency.new('Reachability', params)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@subject.description.should.match %r|from `.*integration/Reachability`|
it 'returns the description' do
@subject.description.should.match %r{from `.*integration/Reachability`}
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)
config.sandbox.development_pods.should == {
"Reachability" => fixture('integration/Reachability').to_s
'Reachability' => fixture('integration/Reachability').to_s,
}
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)
should.raise Informative do
@subject.fetch(config.sandbox)
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')
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
......@@ -51,7 +51,7 @@ module Pod
config.sandbox.local_path_was_absolute?('Reachability').should.be.false
end
it "marks a pod as absolute" do
it 'marks a pod as absolute' do
@subject.stubs(:params).returns(:path => '/path/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
......@@ -60,27 +60,27 @@ module Pod
end
end
describe "#podspec_path" do
it "handles absolute paths" do
describe '#podspec_path' do
it 'handles absolute paths' do
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
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(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles relative paths" do
it 'handles relative paths' do
@subject.stubs(:params).returns(:path => 'Reachability')
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "expands the tilde" do
it 'expands the tilde' do
File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:path => '~/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
......@@ -95,7 +95,7 @@ module Pod
result.should.be.false
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.should.be.false
end
......@@ -112,4 +112,3 @@ module Pod
end
end
end
......@@ -5,56 +5,54 @@ module Pod
before do
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')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
end
it "creates a copy of the podspec" do
it 'creates a copy of the podspec' do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path = config.sandbox.specifications_root + 'Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@subject.description.should.match %r|from `.*Reachability/Reachability.podspec`|
it 'returns the description' do
@subject.description.should.match %r{from `.*Reachability/Reachability.podspec`}
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'))
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
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(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "handles relative paths" do
it 'handles relative paths' do
@subject.stubs(:params).returns(:podspec => 'Reachability')
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "expands the tilde" do
it 'expands the tilde' do
File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:podspec => '~/Reachability')
path = @subject.send(:podspec_uri)
path.should == ENV['HOME'] + '/Reachability/Reachability.podspec'
end
it "handles URLs" do
@subject.stubs(:params).returns(:podspec => "http://www.example.com/Reachability.podspec")
it 'handles URLs' do
@subject.stubs(:params).returns(:podspec => 'http://www.example.com/Reachability.podspec')
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
......@@ -30,10 +30,10 @@ describe Pod::Generator::Markdown do
given_path = @generator.class.path_from_basepath(basepath)
expected_path = config.sandbox.root + 'Pods-acknowledgements.markdown'
mockFile = mock
mockFile.expects(:write).with(equals(@generator.licenses))
mockFile.expects(:close)
File.expects(:new).with(equals(expected_path), equals('w')).returns(mockFile)
file = mock
file.expects(:write).with(equals(@generator.licenses))
file.expects(:close)
File.expects(:new).with(equals(expected_path), equals('w')).returns(file)
@generator.save_as(given_path)
end
end
require File.expand_path('../../../spec_helper', __FILE__)
describe "Pod::Generator::BridgeSupport" do
describe 'Pod::Generator::BridgeSupport' do
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
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) }
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) }
generator = Pod::Generator::BridgeSupport.new(headers)
def generator.gen_bridge_metadata(command)
@command = command
end
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("' '")}'}
expected = %(-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods.bridgesupport' '#{headers.join("' '")}')
generator.expects(:gen_bridge_metadata).with(expected)
generator.save_as(Pathname.new('/path/to/Pods.bridgesupport'))
end
end
end
......@@ -54,7 +54,7 @@ module Pod
:libraries => [],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios
:platform_name => :ios,
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "SenTestingKit"'
......@@ -67,7 +67,7 @@ module Pod
:libraries => ['xml2'],
:frameworks => [],
:weak_frameworks => [],
:platform_name => :ios
:platform_name => :ios,
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-l "xml2"'
......@@ -80,7 +80,7 @@ module Pod
:libraries => [],
:frameworks => ['CoreAnimation'],
:weak_frameworks => [],
:platform_name => :ios
:platform_name => :ios,
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-framework "CoreAnimation"'
......@@ -93,7 +93,7 @@ module Pod
:libraries => [],
:frameworks => [],
:weak_frameworks => ['iAd'],
:platform_name => :ios
:platform_name => :ios,
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-weak_framework "iAd"'
......@@ -106,7 +106,7 @@ module Pod
:libraries => [],
:frameworks => ['SenTestingKit'],
:weak_frameworks => [],
:platform_name => :ios
:platform_name => :ios,
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('SDKROOT')
......@@ -120,7 +120,7 @@ module Pod
:libraries => [],
:frameworks => ['SenTestingKit'],
:weak_frameworks => [],
:platform_name => :osx
:platform_name => :osx,
)
@sut.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.include('DEVELOPER_LIBRARY_DIR')
......
......@@ -29,11 +29,13 @@ module Pod
end
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
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
it 'returns the pods project' do
......
......@@ -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
path = temporary_directory + 'Pods/BananaLib'
path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath
@analyzer.send(:folder_exist?, 'BananaLib').should.be.true
......@@ -176,7 +176,7 @@ module Pod
it 'returns whether the folder containing the Pod with the given name is empty' do
@analyzer.send(:folder_empty?, 'BananaLib').should.be.true
path = temporary_directory + 'Pods/BananaLib'
path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath
File.open(path + 'file', 'w') {}
@analyzer.send(:folder_empty?, 'BananaLib').should.be.false
......
......@@ -82,7 +82,7 @@ module Pod
'Pods-SVPullToRefresh',
'Pods-libextobjc',
].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.client_root.to_s.should.include 'SampleProject'
......@@ -464,11 +464,7 @@ module Pod
e = lambda { @analyzer.send(:compute_platform_for_target_definition, target_definition, user_targets) }.should.raise Informative
e.message.should.match /Targets with different platforms/
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
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
@installer.specific_source.should.be.nil
pod_folder = config.sandbox.root + 'BananaLib'
pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist
end
......@@ -28,7 +28,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
@installer.install!
@installer.specific_source[:commit].should == '0b8b4084a43c38cfe308efa076fdeb3a64d9d2bc'
pod_folder = config.sandbox.root + 'BananaLib'
pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist
end
......@@ -36,7 +36,7 @@ module Pod
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' }
@installer.install!
@installer.specific_source[:commit].should == '446b22414597f1bb4062a62c4eed7af9627a3f1b'
pod_folder = config.sandbox.root + 'BananaLib'
pod_folder = config.sandbox.pod_dir('BananaLib')
pod_folder.should.exist
end
......@@ -53,7 +53,7 @@ module Pod
it 'cleans up directory when an error occurs during download' do
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'
mock_downloader = Object.new
......@@ -119,14 +119,14 @@ module Pod
it 'cleans the paths non used by the installation' do
@installer.install!
@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
end
it 'preserves important files like the LICENSE and the README' do
@installer.install!
@installer.clean!
readme_file = config.sandbox.root + 'BananaLib/README'
readme_file = config.sandbox.root + 'Sources/BananaLib/README'
readme_file.should.exist
end
......@@ -169,13 +169,13 @@ module Pod
@installer.send(:download_source)
paths = @installer.send(:clean_paths)
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 == [
'Pods/BananaLib/BananaLib.podspec',
'Pods/BananaLib/libPusher',
'Pods/BananaLib/sub-dir',
'Pods/BananaLib/sub-dir/sub-dir-2',
'Pods/BananaLib/sub-dir/sub-dir-2/somefile.txt',
'Pods/Sources/BananaLib/BananaLib.podspec',
'Pods/Sources/BananaLib/libPusher',
'Pods/Sources/BananaLib/sub-dir',
'Pods/Sources/BananaLib/sub-dir/sub-dir-2',
'Pods/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt',
]
end
......@@ -184,13 +184,13 @@ module Pod
paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [
'Pods/BananaLib/Classes/Banana.h',
'Pods/BananaLib/Classes/Banana.m',
'Pods/BananaLib/Classes/BananaLib.pch',
'Pods/BananaLib/Classes/BananaPrivate.h',
'Pods/BananaLib/LICENSE',
'Pods/BananaLib/README',
'Pods/BananaLib/Resources/logo-sidebar.png',
'Pods/Sources/BananaLib/Classes/Banana.h',
'Pods/Sources/BananaLib/Classes/Banana.m',
'Pods/Sources/BananaLib/Classes/BananaLib.pch',
'Pods/Sources/BananaLib/Classes/BananaPrivate.h',
'Pods/Sources/BananaLib/LICENSE',
'Pods/Sources/BananaLib/README',
'Pods/Sources/BananaLib/Resources/logo-sidebar.png',
]
end
......@@ -208,13 +208,13 @@ module Pod
paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [
'Pods/BananaLib/Classes/Banana.h',
'Pods/BananaLib/Classes/Banana.m',
'Pods/BananaLib/Classes/BananaLib.pch',
'Pods/BananaLib/Classes/BananaPrivate.h',
'Pods/BananaLib/LICENSE',
'Pods/BananaLib/README',
'Pods/BananaLib/Resources/logo-sidebar.png',
'Pods/Sources/BananaLib/Classes/Banana.h',
'Pods/Sources/BananaLib/Classes/Banana.m',
'Pods/Sources/BananaLib/Classes/BananaLib.pch',
'Pods/Sources/BananaLib/Classes/BananaPrivate.h',
'Pods/Sources/BananaLib/LICENSE',
'Pods/Sources/BananaLib/README',
'Pods/Sources/BananaLib/Resources/logo-sidebar.png',
]
end
......
......@@ -4,6 +4,7 @@ module Pod
describe Installer::AggregateTargetInstaller do
describe 'In General' do
before do
config.sandbox.prepare
@podfile = Podfile.new do
platform :ios
xcodeproj 'dummy'
......@@ -124,7 +125,8 @@ module Pod
it 'creates a header for the target which contains the information about the installed Pods' do
@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.should.include?('#define COCOAPODS_POD_AVAILABLE_BananaLib')
contents.should.include?('#define COCOAPODS_VERSION_MAJOR_BananaLib 1')
......@@ -140,7 +142,8 @@ module Pod
it 'creates a create copy resources script' do
@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')
end
......@@ -154,9 +157,10 @@ module Pod
it 'creates the acknowledgements files ' do
@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')
plist = config.sandbox.root + 'Pods-acknowledgements.plist'
plist = support_files_dir + 'Pods-acknowledgements.plist'
plist.read.should.include?('Permission is hereby granted')
end
......@@ -166,7 +170,8 @@ module Pod
build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') }
build_file.should.be.not.nil
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')
end
end
......
......@@ -4,6 +4,7 @@ module Pod
describe Installer::PodTargetInstaller do
describe 'In General' do
before do
config.sandbox.prepare
@podfile = Podfile.new do
platform :ios
xcodeproj 'dummy'
......@@ -124,7 +125,8 @@ module Pod
it "creates a prefix header, including the contents of the specification's prefix header" do
@spec.prefix_header_contents = '#import "BlocksKit.h"'
@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
expected = <<-EOS.strip_heredoc
#ifdef __OBJC__
......@@ -144,7 +146,8 @@ module Pod
build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' }
build_file.should.be.not.nil
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')
end
......
......@@ -15,7 +15,7 @@ module Pod
@pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1'
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
)
@pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Test'] = configuration
......@@ -28,8 +28,6 @@ module Pod
file_ref = @project.new_file(path)
config = @target.build_configuration_list['Release']
config.base_configuration_reference = file_ref
File.expects(:exist?).returns(true)
File.expects(:delete).with(path)
XCConfigIntegrator.integrate(@pod_bundle, [@target])
@project.files.find { |f| f.path == path }.should.be.nil
end
......
......@@ -20,7 +20,7 @@ module Pod
@pod_bundle.client_root = project_path.dirname
@pod_bundle.user_target_uuids = [@target.uuid]
configuration = Xcodeproj::Config.new(
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1'
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
)
@pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Test'] = configuration
......@@ -41,6 +41,15 @@ module Pod
@target_integrator.integrate!
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
@target_integrator.integrate!
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.nil?
......@@ -58,7 +67,7 @@ module Pod
@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.strip.should == "\"${SRCROOT}/../Pods/Pods-resources.sh\""
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\""
end
it 'adds a Check Manifest.lock build phase to each target' do
......@@ -66,7 +75,7 @@ module Pod
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Check Pods Manifest.lock' }
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
cat << EOM
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
end
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
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
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
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
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
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
#--------------------------------------#
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
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
......
......@@ -52,7 +52,7 @@ module Pod
path = config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path)
group.source_tree.should == '<group>'
group.path.should == 'BananaLib'
group.path.should == 'Sources/BananaLib'
Pathname.new(group.path).should.be.relative
end
......@@ -139,14 +139,13 @@ module Pod
end
it 'creates a support file group relative to the project' do
group = @project.pod_support_files_group('BananaLib')
group.source_tree.should == 'SOURCE_ROOT'
group.path.should.be.nil
group = @project.pod_support_files_group('BananaLib', 'path')
group.path.should == 'path'
end
it "doesn't duplicate the groups" do
group_1 = @project.pod_support_files_group('BananaLib')
group_2 = @project.pod_support_files_group('BananaLib')
group_1 = @project.pod_support_files_group('BananaLib', 'path')
group_2 = @project.pod_support_files_group('BananaLib', 'path')
group_1.uuid.should == group_2.uuid
end
......
......@@ -9,7 +9,7 @@ module Pod
pod 'BlocksKit', '1.5.2'
end
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
it 'returns the sandbox' do
......@@ -55,7 +55,7 @@ module Pod
platform :ios
pod 'Reachability', :podspec => podspec
end
resolver = Resolver.new(config.sandbox, podfile)
resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
resolver.resolve
specs = resolver.specs_by_target.values.flatten
specs.map(&:to_s).should == ['Reachability (3.0.0)']
......@@ -70,7 +70,7 @@ module Pod
platform :ios, '6.0'
pod 'BlocksKit', '1.5.2'
end
@resolver = Resolver.new(config.sandbox, @podfile)
@resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
end
it 'cross resolves dependencies' do
......@@ -80,7 +80,7 @@ module Pod
pod 'AFQuickLookView', '= 0.1.0' # requires 'AFNetworking', '>= 0.9.0'
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.should == ['AFNetworking (0.9.1)', 'AFQuickLookView (0.1.0)']
end
......@@ -101,6 +101,15 @@ module Pod
e.message.should.match(/platform .* not compatible/)
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
lambda { @resolver.resolve }.should.not.raise
end
......@@ -110,7 +119,7 @@ module Pod
platform :ios, '7.0'
pod 'RestKit', '0.10.3'
end
resolver = Resolver.new(config.sandbox, @podfile)
resolver = Resolver.new(config.sandbox, @podfile, [], SourcesManager.all)
resolver.resolve.values.flatten.map(&:name).sort.should == %w(
FileMD5Hash
ISO8601DateFormatter
......@@ -149,9 +158,11 @@ module Pod
end
end
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.should == %w( MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec )
specs.should == %w(
MainSpec/FirstSubSpec MainSpec/FirstSubSpec/SecondSubSpec
)
end
it "marks a specification's version to be a HEAD version" do
......@@ -160,7 +171,7 @@ module Pod
pod 'FileMD5Hash'
pod 'JSONKit', :head
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.version.should.not.be.head
jsonkit.version.should.be.head
......@@ -174,7 +185,7 @@ module Pod
pod 'JSONKit', '1.4'
pod 'JSONKit', '1.5pre'
end
resolver = Resolver.new(config.sandbox, podfile)
resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
e = lambda { resolver.resolve }.should.raise Pod::Informative
e.message.should.match(/Unable to satisfy the following requirements/)
end
......@@ -184,15 +195,31 @@ module Pod
platform :ios
pod 'JSONKit', '<= 1.5pre'
end
resolver = Resolver.new(config.sandbox, podfile)
resolver = Resolver.new(config.sandbox, podfile, [], SourcesManager.all)
version = resolver.resolve.values.flatten.first.version
version.to_s.should == '1.5pre'
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.to_s.should == '1.4'
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
#-------------------------------------------------------------------------#
......@@ -205,7 +232,7 @@ module Pod
pod 'AFNetworking', '1.0RC3'
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.should == ['AFNetworking (1.0RC3)']
end
......@@ -216,7 +243,7 @@ module Pod
pod 'AFNetworking', '~> 1.0RC3'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.0)']
......@@ -228,7 +255,7 @@ module Pod
pod 'AFNetworking', '1.0'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)']
......@@ -240,7 +267,7 @@ module Pod
pod 'AFNetworking', '< 1.0'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (0.10.1)']
......@@ -252,7 +279,7 @@ module Pod
pod 'AFNetworking', '<= 1.0'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)']
......@@ -264,7 +291,7 @@ module Pod
pod 'AFNetworking', '> 1.0', '< 1.3'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
......@@ -276,7 +303,7 @@ module Pod
pod 'AFNetworking', '>= 1.0', '< 1.3'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
......@@ -288,7 +315,7 @@ module Pod
pod 'AFNetworking', '~> 1.0', '< 1.3'
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.should != ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
......
......@@ -5,11 +5,11 @@ module Pod
before do
@sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox')
@header_dir = Sandbox::HeadersStore.new(@sandbox, 'Headers')
@header_dir = Sandbox::HeadersStore.new(@sandbox, 'Public')
end
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
it "can add namespaced headers to it's header path using symlinks and return the relative path" do
......@@ -40,11 +40,11 @@ module Pod
File.open(@sandbox.root + path, 'w') { |file| file.write('hello') }
end
@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
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
......@@ -33,16 +33,12 @@ module Pod
end
it 'returns the public headers store' do
@sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Headers'
end
it 'deletes the entire root directory on implode' do
@sandbox.implode
File.directory?(temporary_directory + 'Sandbox').should.be.false
@sandbox.public_headers.root.should ==
temporary_directory + 'Sandbox/Headers/Public'
end
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
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
specification_path = @sandbox.specification_path('BananaLib')
......@@ -52,7 +48,7 @@ module Pod
end
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)
pod_root.mkpath
@sandbox.clean_pod('BananaLib')
......@@ -66,19 +62,23 @@ module Pod
describe 'Paths' 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
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
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
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
it 'returns the directory where a local Pod is stored' do
......@@ -86,14 +86,11 @@ module Pod
@sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path')
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
tmp_sandbox = Pod::Sandbox.new('/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
......@@ -102,8 +99,8 @@ module Pod
describe 'Specification store' do
it 'loads the stored specification with the given name' do
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs')
(@sandbox.specifications_root).mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.specifications_root)
@sandbox.specification('BananaLib').name.should == 'BananaLib'
end
......@@ -120,13 +117,15 @@ module Pod
end
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
it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Local Podspecs').mkdir
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
it 'stores a podspec with a given path into the sandbox' do
......
......@@ -35,7 +35,7 @@ module Pod
#-------------------------------------------------------------------------#
describe "In general" do
describe 'In general' do
before do
Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
......@@ -43,88 +43,84 @@ module Pod
#--------------------------------------#
it "returns all the sources" do
it 'returns all the sources' do
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
it "returns all the sets" do
SourcesManager.all_sets.map(&:name).should.include?('BananaLib')
end
it "searches for the set of a dependency" do
it 'searches for the set of a dependency' do
set = SourcesManager.search(Dependency.new('BananaLib'))
set.class.should == Specification::Set
set.name.should == 'BananaLib'
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.should.be.nil
end
it "searches sets by name" do
it 'searches sets by name' do
sets = SourcesManager.search_by_name('BananaLib')
sets.all?{ |s| s.class == Specification::Set}.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true
sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any? { |s| s.name == 'BananaLib' }.should.be.true
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])
sets = SourcesManager.search_by_name('Chunky', true)
sets.all?{ |s| s.class == Specification::Set}.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true
sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any? { |s| s.name == 'BananaLib' }.should.be.true
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])
sets = SourcesManager.search_by_name('Ch[aeiou]nky', true)
sets.all?{ |s| s.class == Specification::Set}.should.be.true
sets.any?{ |s| s.name == 'BananaLib'}.should.be.true
sets.all? { |s| s.class == Specification::Set }.should.be.true
sets.any? { |s| s.name == 'BananaLib' }.should.be.true
end
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.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
SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true)
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") }
Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
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
sets = SourcesManager.search_by_name('BananaLib', true)
end
it "returns the path of the search index" do
it 'returns the path of the search index' do
SourcesManager.unstub(:search_index_path)
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
#-------------------------------------------------------------------------#
describe "Updating Sources" do
describe 'Updating Sources' do
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
SourcesManager.update(test_repo_path.basename.to_s, true)
UI.output.should.match /is up to date/
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
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)
end
it "prints a warning if the update failed" do
it 'prints a warning if the update failed' do
UI.warnings = ''
set_up_test_repo_for_update
Dir.chdir(test_repo_path) do
......@@ -134,23 +130,23 @@ module Pod
UI.warnings.should.include('not able to update the `master` repo')
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?(Pathname.new('/tmp')).should.be.false
end
it "informs the user if there is an update for CocoaPods" do
SourcesManager.stubs(:version_information).returns({ 'last' => '999.0' })
it 'informs the user if there is an update for CocoaPods' do
SourcesManager.stubs(:version_information).returns('last' => '999.0')
SourcesManager.check_version_information(temporary_directory)
UI.output.should.match /CocoaPods 999.0 is available/
end
it "raises while asked to version information of a source if it is not compatible" do
SourcesManager.stubs(:version_information).returns({ 'min' => '999.0' })
it 'raises while asked to version information of a source if it is not compatible' do
SourcesManager.stubs(:version_information).returns('min' => '999.0')
e = lambda { SourcesManager.check_version_information(temporary_directory) }.should.raise Informative
e.message.should.match /Update CocoaPods/
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.message.should.match /Update CocoaPods/
e.message.should.match /(currently using #{Pod::VERSION})/
......@@ -168,23 +164,23 @@ module Pod
SourcesManager.send(:path_writable?, path).should.be.true
end
it "returns whether a repository is compatible" do
SourcesManager.stubs(:version_information).returns({ 'min' => '0.0.1' })
it 'returns whether a repository is compatible' do
SourcesManager.stubs(:version_information).returns('min' => '0.0.1')
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.stubs(:version_information).returns({ 'min' => '999.0' })
SourcesManager.stubs(:version_information).returns('min' => '999.0')
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
end
it "returns whether there is a CocoaPods update available" do
SourcesManager.cocoapods_update?({ 'last' => '0.0.1' }).should.be.false
SourcesManager.cocoapods_update?({ 'last' => '999.0' }).should.be.true
it 'returns whether there is a CocoaPods update available' do
SourcesManager.cocoapods_update?('last' => '0.0.1').should.be.false
SourcesManager.cocoapods_update?('last' => '999.0').should.be.true
end
it "it returns an empty array for the version information if the file can't be found" do
......@@ -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/
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
config.repos_dir = SpecHelper.temporary_directory
SourcesManager.master_repo_functional?.should.be.false
......
......@@ -44,35 +44,35 @@ module Pod
end
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
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
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
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
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
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
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
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
......
......@@ -54,32 +54,45 @@ module Pod
@target_definition.store_pod('BananaLib')
@target_definition.store_pod('BananaLib/Subspec')
@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
end.message.should.match /subspecs across different build configurations/
end.message
message.should.match /subspecs across different build configurations/
end
end
describe 'Support files' 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
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
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
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
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_private_path.to_s.should.include 'Pods/Pods-BananaLib-Private.xcconfig'
@pod_target.xcconfig_path.to_s.should.include?(
'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
......
......@@ -173,11 +173,17 @@ module Pod
describe 'Screenshot validation' do
before do
@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
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.results.should.be.empty?
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