Commit de011ef4 authored by Fabio Pelosin's avatar Fabio Pelosin

[Sandbox] Reorganize structure

parent 3f5690c7
...@@ -11,22 +11,13 @@ module Pod ...@@ -11,22 +11,13 @@ module Pod
# #
# Pods # Pods
# | # |
# +-- User
# | +-- [Target Name]-configuration.h
# | +-- Specs
# | +-- Scripts
# |
# +-- Generated
# +-- Headers # +-- Headers
# | +-- Private # | +-- Private
# | | +-- [Pod Name] # | | +-- [Pod Name]
# | +-- Public # | +-- Public
# | +-- [Pod Name] # | +-- [Pod Name]
# | # |
# +-- Sources # +-- Local Podspecs
# | +-- [Pod Name]
# |
# +-- Specs
# | +-- External Sources # | +-- External Sources
# | +-- Normal Sources # | +-- Normal Sources
# | # |
...@@ -38,12 +29,13 @@ module Pod ...@@ -38,12 +29,13 @@ module Pod
# | +-- Pods-prefix.pch # | +-- Pods-prefix.pch
# | +-- Pods.xcconfig # | +-- Pods.xcconfig
# | # |
# +-- Sources
# | +-- [Pod Name]
# |
# +-- Manifest.lock # +-- Manifest.lock
# | # |
# +-- Pods.xcodeproj # +-- Pods.xcodeproj
# #
# See #833
#
class Sandbox class Sandbox
autoload :FileAccessor, 'cocoapods/sandbox/file_accessor' autoload :FileAccessor, 'cocoapods/sandbox/file_accessor'
autoload :HeadersStore, 'cocoapods/sandbox/headers_store' autoload :HeadersStore, 'cocoapods/sandbox/headers_store'
...@@ -62,13 +54,15 @@ module Pod ...@@ -62,13 +54,15 @@ module Pod
def initialize(root) def initialize(root)
FileUtils.mkdir_p(root) FileUtils.mkdir_p(root)
@root = Pathname.new(root).realpath @root = Pathname.new(root).realpath
@public_headers = HeadersStore.new(self, 'Headers') @public_headers = HeadersStore.new(self, 'Public')
@predownloaded_pods = [] @predownloaded_pods = []
@head_pods = [] @head_pods = []
@checkout_sources = {} @checkout_sources = {}
@development_pods = {} @development_pods = {}
@pods_with_absolute_path = [] @pods_with_absolute_path = []
FileUtils.mkdir_p(generated_dir_root) FileUtils.mkdir_p(headers_root)
FileUtils.mkdir_p(sources_root)
FileUtils.mkdir_p(target_support_files_root)
end end
# @return [Lockfile] the manifest which contains the information about the # @return [Lockfile] the manifest which contains the information about the
...@@ -111,13 +105,13 @@ module Pod ...@@ -111,13 +105,13 @@ module Pod
# @return [Pathname] the path of the manifest. # @return [Pathname] the path of the manifest.
# #
def manifest_path def manifest_path
generated_dir_root + "Manifest.lock" root + "Manifest.lock"
end end
# @return [Pathname] the path of the Pods project. # @return [Pathname] the path of the Pods project.
# #
def project_path def project_path
generated_dir_root + "Pods.xcodeproj" root + "Pods.xcodeproj"
end end
# Returns the path for the directory where to store the support files of # Returns the path for the directory where to store the support files of
...@@ -128,9 +122,8 @@ module Pod ...@@ -128,9 +122,8 @@ module Pod
# #
# @return [Pathname] the path of the support files. # @return [Pathname] the path of the support files.
# #
def library_support_files_dir(_name) def target_support_files_dir(_name)
# root + "Target Support Files/#{name}" target_support_files_root
generated_dir_root
end end
# Returns the path where the Pod with the given name is stored, taking into # Returns the path where the Pod with the given name is stored, taking into
...@@ -160,22 +153,24 @@ module Pod ...@@ -160,22 +153,24 @@ module Pod
@pods_with_absolute_path.include? name @pods_with_absolute_path.include? name
end end
# @return [Pathname] # @return [Pathname] The directory where to store the headers.
# #
def generated_dir_root def headers_root
root + 'Generated' root + 'Headers'
end end
# @return [Pathname] # @return [Pathname] The directory where to store the downloaded sources of
# the Pods.
# #
def headers_root def sources_root
generated_dir_root + 'Headers' root + 'Sources'
end end
# @return [Pathname] # @return [Pathname] The directory where to store the files generated by
# CocoaPods to support the umbrella targets.
# #
def sources_root def target_support_files_root
generated_dir_root + 'Sources' root + 'Target Support Files'
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -205,8 +200,7 @@ module Pod ...@@ -205,8 +200,7 @@ module Pod
# Two folders should be created `External Sources` and `Podspecs`. # Two folders should be created `External Sources` and `Podspecs`.
# #
def specifications_dir(_external_source = false) def specifications_dir(_external_source = false)
# root + "Specifications" root + "Local Podspecs"
generated_dir_root + "Local Podspecs"
end end
# Returns the path of the specification for the Pod with the # Returns the path of the specification for the Pod with the
......
...@@ -31,7 +31,7 @@ module Pod ...@@ -31,7 +31,7 @@ module Pod
# root with the `${PODS_ROOT}` variable. # root with the `${PODS_ROOT}` variable.
# #
def search_paths def search_paths
headers_dir = root.relative_path_from(sandbox.generated_dir_root).dirname headers_dir = root.relative_path_from(sandbox.root).dirname
@search_paths.uniq.map { |path| "${PODS_ROOT}/#{headers_dir}/#{path}" } @search_paths.uniq.map { |path| "${PODS_ROOT}/#{headers_dir}/#{path}" }
end end
......
...@@ -72,7 +72,7 @@ module Pod ...@@ -72,7 +72,7 @@ module Pod
# library. # library.
# #
def support_files_root def support_files_root
@sandbox.library_support_files_dir(name) @sandbox.target_support_files_dir(name)
end end
# @param [String] variant # @param [String] variant
......
...@@ -115,7 +115,7 @@ module Pod ...@@ -115,7 +115,7 @@ module Pod
# variable of the user's project. # variable of the user's project.
# #
def relative_pods_root def relative_pods_root
"${SRCROOT}/#{support_files_root.relative_path_from(client_root)}" "${SRCROOT}/#{sandbox.root.relative_path_from(client_root)}"
end end
# @param [String] config_name The build configuration name to get the xcconfig for # @param [String] config_name The build configuration name to get the xcconfig for
......
...@@ -19,7 +19,7 @@ module Pod ...@@ -19,7 +19,7 @@ module Pod
@specs = specs @specs = specs
@target_definition = target_definition @target_definition = target_definition
@sandbox = sandbox @sandbox = sandbox
@build_headers = Sandbox::HeadersStore.new(sandbox, 'BuildHeaders') @build_headers = Sandbox::HeadersStore.new(sandbox, 'Build')
@file_accessors = [] @file_accessors = []
end end
......
...@@ -50,7 +50,6 @@ module Pod ...@@ -50,7 +50,6 @@ module Pod
it "checks for JSON podspecs" do it "checks for JSON podspecs" do
path = config.sandbox.pod_dir('Reachability') path = config.sandbox.pod_dir('Reachability')
podspec_path = path + 'Reachability.podspec.json' podspec_path = path + 'Reachability.podspec.json'
Dir.mkdir(config.sandbox.sources_root)
Dir.mkdir(path) Dir.mkdir(path)
File.open(podspec_path, "w") {} File.open(podspec_path, "w") {}
Pathname.any_instance.stubs(:rmtree) Pathname.any_instance.stubs(:rmtree)
......
...@@ -21,7 +21,7 @@ module Pod ...@@ -21,7 +21,7 @@ module Pod
end end
it 'returns the path of the pods root relative to the user project' do it 'returns the path of the pods root relative to the user project' do
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods/Generated' @generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
...@@ -53,7 +53,7 @@ module Pod ...@@ -53,7 +53,7 @@ module Pod
end end
it 'sets the PODS_ROOT build variable' do it 'sets the PODS_ROOT build variable' do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods/Generated' @xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end end
it 'adds the sandbox public headers search paths to the xcconfig, with quotes, as header search paths' do it 'adds the sandbox public headers search paths to the xcconfig, with quotes, as header search paths' do
......
...@@ -29,11 +29,11 @@ module Pod ...@@ -29,11 +29,11 @@ module Pod
end end
it 'returns the path of the prefix header' do it 'returns the path of the prefix header' do
@rep.prefix_header_path.should == temporary_directory + 'Pods/Generated/Pods-MyApp-prefix.pch' @rep.prefix_header_path.should == temporary_directory + 'Pods/Target Support Files/Pods-MyApp-prefix.pch'
end end
it 'returns the path of the copy resources script' do it 'returns the path of the copy resources script' do
@rep.copy_resources_script_path.should == temporary_directory + 'Pods/Generated/Pods-MyApp-resources.sh' @rep.copy_resources_script_path.should == temporary_directory + 'Pods/Target Support Files/Pods-MyApp-resources.sh'
end end
it 'returns the pods project' do it 'returns the pods project' do
......
...@@ -168,7 +168,7 @@ module Pod ...@@ -168,7 +168,7 @@ module Pod
it 'returns whether the folder containing the Pod with the given name exists' do it 'returns whether the folder containing the Pod with the given name exists' do
@analyzer.send(:folder_exist?, 'BananaLib').should.be.false @analyzer.send(:folder_exist?, 'BananaLib').should.be.false
path = temporary_directory + 'Pods/Generated/Sources/BananaLib' path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath path.mkpath
@analyzer.send(:folder_exist?, 'BananaLib').should.be.true @analyzer.send(:folder_exist?, 'BananaLib').should.be.true
...@@ -176,7 +176,7 @@ module Pod ...@@ -176,7 +176,7 @@ module Pod
it 'returns whether the folder containing the Pod with the given name is empty' do it 'returns whether the folder containing the Pod with the given name is empty' do
@analyzer.send(:folder_empty?, 'BananaLib').should.be.true @analyzer.send(:folder_empty?, 'BananaLib').should.be.true
path = temporary_directory + 'Pods/Generated/Sources/BananaLib' path = temporary_directory + 'Pods/Sources/BananaLib'
path.mkpath path.mkpath
File.open(path + 'file', 'w') {} File.open(path + 'file', 'w') {}
@analyzer.send(:folder_empty?, 'BananaLib').should.be.false @analyzer.send(:folder_empty?, 'BananaLib').should.be.false
......
...@@ -82,7 +82,7 @@ module Pod ...@@ -82,7 +82,7 @@ module Pod
'Pods-SVPullToRefresh', 'Pods-SVPullToRefresh',
'Pods-libextobjc', 'Pods-libextobjc',
].sort ].sort
target.support_files_root.should == config.sandbox.generated_dir_root target.support_files_root.should == config.sandbox.target_support_files_dir('Pods')
target.user_project_path.to_s.should.include 'SampleProject/SampleProject' target.user_project_path.to_s.should.include 'SampleProject/SampleProject'
target.client_root.to_s.should.include 'SampleProject' target.client_root.to_s.should.include 'SampleProject'
......
...@@ -119,14 +119,14 @@ module Pod ...@@ -119,14 +119,14 @@ module Pod
it 'cleans the paths non used by the installation' do it 'cleans the paths non used by the installation' do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
unused_file = config.sandbox.root + 'Generated/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt' unused_file = config.sandbox.root + 'Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt'
unused_file.should.not.exist unused_file.should.not.exist
end end
it 'preserves important files like the LICENSE and the README' do it 'preserves important files like the LICENSE and the README' do
@installer.install! @installer.install!
@installer.clean! @installer.clean!
readme_file = config.sandbox.root + 'Generated/Sources/BananaLib/README' readme_file = config.sandbox.root + 'Sources/BananaLib/README'
readme_file.should.exist readme_file.should.exist
end end
...@@ -169,13 +169,13 @@ module Pod ...@@ -169,13 +169,13 @@ module Pod
@installer.send(:download_source) @installer.send(:download_source)
paths = @installer.send(:clean_paths) paths = @installer.send(:clean_paths)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')} relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '')}
paths_without_git = relative_paths.reject { |p| p.include? 'Pods/Generated/Sources/BananaLib/.git' } paths_without_git = relative_paths.reject { |p| p.include? 'Pods/Sources/BananaLib/.git' }
paths_without_git.sort.should == [ paths_without_git.sort.should == [
"Pods/Generated/Sources/BananaLib/BananaLib.podspec", "Pods/Sources/BananaLib/BananaLib.podspec",
"Pods/Generated/Sources/BananaLib/libPusher", "Pods/Sources/BananaLib/libPusher",
"Pods/Generated/Sources/BananaLib/sub-dir", "Pods/Sources/BananaLib/sub-dir",
"Pods/Generated/Sources/BananaLib/sub-dir/sub-dir-2", "Pods/Sources/BananaLib/sub-dir/sub-dir-2",
"Pods/Generated/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt" "Pods/Sources/BananaLib/sub-dir/sub-dir-2/somefile.txt"
] ]
end end
...@@ -184,13 +184,13 @@ module Pod ...@@ -184,13 +184,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') } relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [ relative_paths.sort.should == [
"Pods/Generated/Sources/BananaLib/Classes/Banana.h", "Pods/Sources/BananaLib/Classes/Banana.h",
"Pods/Generated/Sources/BananaLib/Classes/Banana.m", "Pods/Sources/BananaLib/Classes/Banana.m",
"Pods/Generated/Sources/BananaLib/Classes/BananaLib.pch", "Pods/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/Generated/Sources/BananaLib/Classes/BananaPrivate.h", "Pods/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/Generated/Sources/BananaLib/LICENSE", "Pods/Sources/BananaLib/LICENSE",
"Pods/Generated/Sources/BananaLib/README", "Pods/Sources/BananaLib/README",
"Pods/Generated/Sources/BananaLib/Resources/logo-sidebar.png" "Pods/Sources/BananaLib/Resources/logo-sidebar.png"
] ]
end end
...@@ -208,13 +208,13 @@ module Pod ...@@ -208,13 +208,13 @@ module Pod
paths = @installer.send(:used_files) paths = @installer.send(:used_files)
relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') } relative_paths = paths.map { |p| p.gsub("#{temporary_directory}/", '') }
relative_paths.sort.should == [ relative_paths.sort.should == [
"Pods/Generated/Sources/BananaLib/Classes/Banana.h", "Pods/Sources/BananaLib/Classes/Banana.h",
"Pods/Generated/Sources/BananaLib/Classes/Banana.m", "Pods/Sources/BananaLib/Classes/Banana.m",
"Pods/Generated/Sources/BananaLib/Classes/BananaLib.pch", "Pods/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/Generated/Sources/BananaLib/Classes/BananaPrivate.h", "Pods/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/Generated/Sources/BananaLib/LICENSE", "Pods/Sources/BananaLib/LICENSE",
"Pods/Generated/Sources/BananaLib/README", "Pods/Sources/BananaLib/README",
"Pods/Generated/Sources/BananaLib/Resources/logo-sidebar.png" "Pods/Sources/BananaLib/Resources/logo-sidebar.png"
] ]
end end
......
...@@ -119,12 +119,13 @@ module Pod ...@@ -119,12 +119,13 @@ module Pod
@installer.install! @installer.install!
file = config.sandbox.root + @target.xcconfig_path('Release') file = config.sandbox.root + @target.xcconfig_path('Release')
xcconfig = Xcodeproj::Config.new(file) xcconfig = Xcodeproj::Config.new(file)
xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods/Generated' xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
end end
it 'creates a header for the target which contains the information about the installed Pods' do it 'creates a header for the target which contains the information about the installed Pods' do
@installer.install! @installer.install!
file = config.sandbox.generated_dir_root + 'Pods-environment.h' support_files_dir = config.sandbox.target_support_files_dir('Pods')
file = support_files_dir + 'Pods-environment.h'
contents = file.read contents = file.read
contents.should.include?('#define COCOAPODS_POD_AVAILABLE_BananaLib') contents.should.include?('#define COCOAPODS_POD_AVAILABLE_BananaLib')
contents.should.include?('#define COCOAPODS_VERSION_MAJOR_BananaLib 1') contents.should.include?('#define COCOAPODS_VERSION_MAJOR_BananaLib 1')
...@@ -140,7 +141,8 @@ module Pod ...@@ -140,7 +141,8 @@ module Pod
it 'creates a create copy resources script' do it 'creates a create copy resources script' do
@installer.install! @installer.install!
script = config.sandbox.generated_dir_root + 'Pods-resources.sh' support_files_dir = config.sandbox.target_support_files_dir('Pods')
script = support_files_dir + 'Pods-resources.sh'
script.read.should.include?('logo-sidebar.png') script.read.should.include?('logo-sidebar.png')
end end
...@@ -154,9 +156,10 @@ module Pod ...@@ -154,9 +156,10 @@ module Pod
it 'creates the acknowledgements files ' do it 'creates the acknowledgements files ' do
@installer.install! @installer.install!
markdown = config.sandbox.generated_dir_root + 'Pods-acknowledgements.markdown' support_files_dir = config.sandbox.target_support_files_dir('Pods')
markdown = support_files_dir + 'Pods-acknowledgements.markdown'
markdown.read.should.include?('Permission is hereby granted') markdown.read.should.include?('Permission is hereby granted')
plist = config.sandbox.generated_dir_root + 'Pods-acknowledgements.plist' plist = support_files_dir + 'Pods-acknowledgements.plist'
plist.read.should.include?('Permission is hereby granted') plist.read.should.include?('Permission is hereby granted')
end end
...@@ -165,8 +168,9 @@ module Pod ...@@ -165,8 +168,9 @@ module Pod
build_files = @installer.library.target.source_build_phase.files build_files = @installer.library.target.source_build_phase.files
build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') } build_file = build_files.find { |bf| bf.file_ref.path.include?('Pods-dummy.m') }
build_file.should.be.not.nil build_file.should.be.not.nil
build_file.file_ref.path.should == 'Pods-dummy.m' build_file.file_ref.path.should == 'Target Support Files/Pods-dummy.m'
dummy = config.sandbox.generated_dir_root + 'Pods-dummy.m' support_files_dir = config.sandbox.target_support_files_dir('Pods')
dummy = support_files_dir + 'Pods-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods') dummy.read.should.include?('@interface PodsDummy_Pods')
end end
end end
......
...@@ -124,7 +124,8 @@ module Pod ...@@ -124,7 +124,8 @@ module Pod
it "creates a prefix header, including the contents of the specification's prefix header" do it "creates a prefix header, including the contents of the specification's prefix header" do
@spec.prefix_header_contents = '#import "BlocksKit.h"' @spec.prefix_header_contents = '#import "BlocksKit.h"'
@installer.install! @installer.install!
prefix_header = config.sandbox.generated_dir_root + 'Pods-BananaLib-prefix.pch' support_files_dir = config.sandbox.target_support_files_dir('Pods')
prefix_header = support_files_dir + 'Pods-BananaLib-prefix.pch'
generated = prefix_header.read generated = prefix_header.read
expected = <<-EOS.strip_heredoc expected = <<-EOS.strip_heredoc
#ifdef __OBJC__ #ifdef __OBJC__
...@@ -143,8 +144,9 @@ module Pod ...@@ -143,8 +144,9 @@ module Pod
build_files = @installer.library.target.source_build_phase.files build_files = @installer.library.target.source_build_phase.files
build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' } build_file = build_files.find { |bf| bf.file_ref.display_name == 'Pods-BananaLib-dummy.m' }
build_file.should.be.not.nil build_file.should.be.not.nil
build_file.file_ref.path.should == 'Pods-BananaLib-dummy.m' build_file.file_ref.path.should == 'Target Support Files/Pods-BananaLib-dummy.m'
dummy = config.sandbox.generated_dir_root + 'Pods-BananaLib-dummy.m' support_files_dir = config.sandbox.target_support_files_dir('Pods')
dummy = support_files_dir + 'Pods-BananaLib-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods') dummy.read.should.include?('@interface PodsDummy_Pods')
end end
......
...@@ -58,7 +58,7 @@ module Pod ...@@ -58,7 +58,7 @@ module Pod
@target_integrator.integrate! @target_integrator.integrate!
target = @target_integrator.send(:native_targets).first target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' } phase = target.shell_script_build_phases.find { |bp| bp.name == 'Copy Pods Resources' }
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Generated/Pods-resources.sh\"" phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods-resources.sh\""
end end
it 'adds a Check Manifest.lock build phase to each target' do it 'adds a Check Manifest.lock build phase to each target' do
......
...@@ -96,7 +96,7 @@ module Pod ...@@ -96,7 +96,7 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [ saved.file_references.map(&:path).should == [
'SampleProject/SampleProject.xcodeproj', 'SampleProject/SampleProject.xcodeproj',
"Pods/Generated/Pods.xcodeproj" "Pods/Pods.xcodeproj"
] ]
end end
...@@ -109,14 +109,14 @@ module Pod ...@@ -109,14 +109,14 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [ saved.file_references.map(&:path).should == [
'SampleProject/SampleProject.xcodeproj', 'SampleProject/SampleProject.xcodeproj',
"Pods/Generated/Pods.xcodeproj" "Pods/Pods.xcodeproj"
] ]
end end
it "doesn't write the workspace if not needed" do it "doesn't write the workspace if not needed" do
file_references = [ file_references = [
Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'), Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('Pods/Generated/Pods.xcodeproj', 'group'), Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group'),
] ]
workspace = Xcodeproj::Workspace.new(file_references) workspace = Xcodeproj::Workspace.new(file_references)
...@@ -136,13 +136,13 @@ module Pod ...@@ -136,13 +136,13 @@ module Pod
saved.file_references.map(&:path).should == [ saved.file_references.map(&:path).should == [
'user_added_project.xcodeproj', 'user_added_project.xcodeproj',
'SampleProject/SampleProject.xcodeproj', 'SampleProject/SampleProject.xcodeproj',
'Pods/Generated/Pods.xcodeproj', 'Pods/Pods.xcodeproj',
] ]
end end
it 'preserves the order of the projects in the workspace' do it 'preserves the order of the projects in the workspace' do
file_references = [ file_references = [
Xcodeproj::Workspace::FileReference.new('Pods/Generated/Pods.xcodeproj', 'group'), Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'), Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'),
] ]
...@@ -152,7 +152,7 @@ module Pod ...@@ -152,7 +152,7 @@ module Pod
@integrator.send(:create_workspace) @integrator.send(:create_workspace)
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [ saved.file_references.map(&:path).should == [
'Pods/Generated/Pods.xcodeproj', 'Pods/Pods.xcodeproj',
'SampleProject/SampleProject.xcodeproj', 'SampleProject/SampleProject.xcodeproj',
] ]
end end
......
...@@ -424,7 +424,7 @@ module Pod ...@@ -424,7 +424,7 @@ module Pod
it 'saves the project to the given path' do it 'saves the project to the given path' do
Xcodeproj::Project.any_instance.stubs(:recreate_user_schemes) Xcodeproj::Project.any_instance.stubs(:recreate_user_schemes)
path = temporary_directory + 'Pods/Generated/Pods.xcodeproj' path = temporary_directory + 'Pods/Pods.xcodeproj'
@installer.pods_project.expects(:save) @installer.pods_project.expects(:save)
@installer.send(:write_pod_project) @installer.send(:write_pod_project)
end end
...@@ -454,7 +454,7 @@ module Pod ...@@ -454,7 +454,7 @@ module Pod
it 'writes the sandbox manifest' do it 'writes the sandbox manifest' do
@installer.send(:write_lockfiles) @installer.send(:write_lockfiles)
lockfile = Lockfile.from_file(temporary_directory + 'Pods/Generated/Manifest.lock') lockfile = Lockfile.from_file(temporary_directory + 'Pods/Manifest.lock')
lockfile.pod_names.should == ['BananaLib'] lockfile.pod_names.should == ['BananaLib']
end end
......
...@@ -36,37 +36,37 @@ module Pod ...@@ -36,37 +36,37 @@ module Pod
end end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
@lib.xcconfig_path('Release').to_s.should.include?('Pods/Generated/Pods.release.xcconfig') @lib.xcconfig_path('Release').to_s.should.include?('Pods/Target Support Files/Pods.release.xcconfig')
end end
it 'returns the absolute path of the resources script' do it 'returns the absolute path of the resources script' do
@lib.copy_resources_script_path.to_s.should.include?('Pods/Generated/Pods-resources.sh') @lib.copy_resources_script_path.to_s.should.include?('Pods/Target Support Files/Pods-resources.sh')
end end
it 'returns the absolute path of the target header file' do it 'returns the absolute path of the target header file' do
@lib.target_environment_header_path.to_s.should.include?('Pods/Generated/Pods-environment.h') @lib.target_environment_header_path.to_s.should.include?('Pods/Target Support Files/Pods-environment.h')
end end
it 'returns the absolute path of the prefix header file' do it 'returns the absolute path of the prefix header file' do
@lib.prefix_header_path.to_s.should.include?('Pods/Generated/Pods-prefix.pch') @lib.prefix_header_path.to_s.should.include?('Pods/Target Support Files/Pods-prefix.pch')
end end
it 'returns the absolute path of the bridge support file' do it 'returns the absolute path of the bridge support file' do
@lib.bridge_support_path.to_s.should.include?('Pods/Generated/Pods.bridgesupport') @lib.bridge_support_path.to_s.should.include?('Pods/Target Support Files/Pods.bridgesupport')
end end
it 'returns the absolute path of the acknowledgements files without extension' do it 'returns the absolute path of the acknowledgements files without extension' do
@lib.acknowledgements_basepath.to_s.should.include?('Pods/Generated/Pods-acknowledgements') @lib.acknowledgements_basepath.to_s.should.include?('Pods/Target Support Files/Pods-acknowledgements')
end end
#--------------------------------------# #--------------------------------------#
it 'returns the path of the resources script relative to the user project' do it 'returns the path of the resources script relative to the user project' do
@lib.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Generated/Pods-resources.sh' @lib.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Target Support Files/Pods-resources.sh'
end end
it 'returns the path of the xcconfig file relative to the user project' do it 'returns the path of the xcconfig file relative to the user project' do
@lib.xcconfig_relative_path('Release').should == 'Pods/Generated/Pods.release.xcconfig' @lib.xcconfig_relative_path('Release').should == 'Pods/Target Support Files/Pods.release.xcconfig'
end end
end end
......
...@@ -222,7 +222,7 @@ module Pod ...@@ -222,7 +222,7 @@ module Pod
f = @project['Podfile'] f = @project['Podfile']
f.source_tree.should == 'SOURCE_ROOT' f.source_tree.should == 'SOURCE_ROOT'
f.xc_language_specification_identifier.should == 'xcode.lang.ruby' f.xc_language_specification_identifier.should == 'xcode.lang.ruby'
f.path.should == '../../Podfile' f.path.should == '../Podfile'
end end
#----------------------------------------# #----------------------------------------#
......
...@@ -5,11 +5,11 @@ module Pod ...@@ -5,11 +5,11 @@ module Pod
before do before do
@sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox') @sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox')
@header_dir = Sandbox::HeadersStore.new(@sandbox, 'Headers') @header_dir = Sandbox::HeadersStore.new(@sandbox, 'Public')
end end
it "returns it's headers root" do it "returns it's headers root" do
@header_dir.root.should == temporary_directory + 'Sandbox/Generated/Headers/Headers' @header_dir.root.should == temporary_directory + 'Sandbox/Headers/Public'
end end
it "can add namespaced headers to it's header path using symlinks and return the relative path" do it "can add namespaced headers to it's header path using symlinks and return the relative path" do
...@@ -40,11 +40,11 @@ module Pod ...@@ -40,11 +40,11 @@ module Pod
File.open(@sandbox.root + path, 'w') { |file| file.write('hello') } File.open(@sandbox.root + path, 'w') { |file| file.write('hello') }
end end
@header_dir.add_files(namespace_path, relative_header_paths) @header_dir.add_files(namespace_path, relative_header_paths)
@header_dir.search_paths.should.include('${PODS_ROOT}/Headers/Headers/ExampleLib') @header_dir.search_paths.should.include('${PODS_ROOT}/Headers/Public/ExampleLib')
end end
it 'always adds the Headers root to the header search paths' do it 'always adds the Headers root to the header search paths' do
@header_dir.search_paths.should.include('${PODS_ROOT}/Headers/Headers') @header_dir.search_paths.should.include('${PODS_ROOT}/Headers/Public')
end end
end end
end end
...@@ -33,7 +33,7 @@ module Pod ...@@ -33,7 +33,7 @@ module Pod
end end
it 'returns the public headers store' do it 'returns the public headers store' do
@sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Generated/Headers/Headers' @sandbox.public_headers.root.should == temporary_directory + 'Sandbox/Headers/Public'
end end
it 'cleans any trace of the Pod with the given name' do it 'cleans any trace of the Pod with the given name' do
...@@ -61,19 +61,19 @@ module Pod ...@@ -61,19 +61,19 @@ module Pod
describe 'Paths' do describe 'Paths' do
it 'returns the path of the manifest' do it 'returns the path of the manifest' do
@sandbox.manifest_path.should == temporary_directory + 'Sandbox/Generated/Manifest.lock' @sandbox.manifest_path.should == temporary_directory + 'Sandbox/Manifest.lock'
end end
it 'returns the path of the Pods project' do it 'returns the path of the Pods project' do
@sandbox.project_path.should == temporary_directory + 'Sandbox/Generated/Pods.xcodeproj' @sandbox.project_path.should == temporary_directory + 'Sandbox/Pods.xcodeproj'
end end
it 'returns the directory for the support files of a library' do it 'returns the directory for the support files of a library' do
@sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox/Generated' @sandbox.target_support_files_dir('Pods').should == temporary_directory + 'Sandbox/Target Support Files'
end end
it 'returns the directory where a Pod is stored' do it 'returns the directory where a Pod is stored' do
@sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/Generated/Sources/JSONKit' @sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/Sources/JSONKit'
end end
it 'returns the directory where a local Pod is stored' do it 'returns the directory where a local Pod is stored' do
...@@ -112,18 +112,18 @@ module Pod ...@@ -112,18 +112,18 @@ module Pod
end end
it 'returns the directory where to store the specifications' do it 'returns the directory where to store the specifications' do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Generated/Local Podspecs' @sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs'
end end
it "returns the path to a spec file in the 'Local Podspecs' dir" do it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Generated/Local Podspecs').mkdir (@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Generated/Local Podspecs') FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs')
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec' @sandbox.specification_path('BananaLib').should == @sandbox.root + 'Local Podspecs/BananaLib.podspec'
end end
it 'stores a podspec with a given path into the sandbox' do it 'stores a podspec with a given path into the sandbox' do
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec')) @sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
path = @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec' path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path.should.exist path.should.exist
@sandbox.specification_path('BananaLib').should == path @sandbox.specification_path('BananaLib').should == path
end end
...@@ -131,7 +131,7 @@ module Pod ...@@ -131,7 +131,7 @@ module Pod
it 'stores a podspec with the given string into the sandbox' do it 'stores a podspec with the given string into the sandbox' do
podspec_string = fixture('banana-lib/BananaLib.podspec').read podspec_string = fixture('banana-lib/BananaLib.podspec').read
@sandbox.store_podspec('BananaLib', podspec_string) @sandbox.store_podspec('BananaLib', podspec_string)
path = @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec' path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path.should.exist path.should.exist
@sandbox.specification_path('BananaLib').should == path @sandbox.specification_path('BananaLib').should == path
end end
......
...@@ -44,35 +44,35 @@ module Pod ...@@ -44,35 +44,35 @@ module Pod
end end
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
@target.xcconfig_path('Release').to_s.should.include?('Pods/Generated/Pods.release.xcconfig') @target.xcconfig_path('Release').to_s.should.include?('Pods/Target Support Files/Pods.release.xcconfig')
end end
it 'returns the absolute path of the resources script' do it 'returns the absolute path of the resources script' do
@target.copy_resources_script_path.to_s.should.include?('Pods/Generated/Pods-resources.sh') @target.copy_resources_script_path.to_s.should.include?('Pods/Target Support Files/Pods-resources.sh')
end end
it 'returns the absolute path of the target header file' do it 'returns the absolute path of the target header file' do
@target.target_environment_header_path.to_s.should.include?('Pods/Generated/Pods-environment.h') @target.target_environment_header_path.to_s.should.include?('Pods/Target Support Files/Pods-environment.h')
end end
it 'returns the absolute path of the prefix header file' do it 'returns the absolute path of the prefix header file' do
@target.prefix_header_path.to_s.should.include?('Pods/Generated/Pods-prefix.pch') @target.prefix_header_path.to_s.should.include?('Pods/Target Support Files/Pods-prefix.pch')
end end
it 'returns the absolute path of the bridge support file' do it 'returns the absolute path of the bridge support file' do
@target.bridge_support_path.to_s.should.include?('Pods/Generated/Pods.bridgesupport') @target.bridge_support_path.to_s.should.include?('Pods/Target Support Files/Pods.bridgesupport')
end end
it 'returns the absolute path of the acknowledgements files without extension' do it 'returns the absolute path of the acknowledgements files without extension' do
@target.acknowledgements_basepath.to_s.should.include?('Pods/Generated/Pods-acknowledgements') @target.acknowledgements_basepath.to_s.should.include?('Pods/Target Support Files/Pods-acknowledgements')
end end
it 'returns the path of the resources script relative to the user project' do it 'returns the path of the resources script relative to the user project' do
@target.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Generated/Pods-resources.sh' @target.copy_resources_script_relative_path.should == '${SRCROOT}/Pods/Target Support Files/Pods-resources.sh'
end end
it 'returns the path of the xcconfig file relative to the user project' do it 'returns the path of the xcconfig file relative to the user project' do
@target.xcconfig_relative_path('Release').should == 'Pods/Generated/Pods.release.xcconfig' @target.xcconfig_relative_path('Release').should == 'Pods/Target Support Files/Pods.release.xcconfig'
end end
end end
......
...@@ -62,24 +62,24 @@ module Pod ...@@ -62,24 +62,24 @@ module Pod
describe 'Support files' do describe 'Support files' do
it 'returns the absolute path of the xcconfig file' do it 'returns the absolute path of the xcconfig file' do
@pod_target.xcconfig_path('Release').to_s.should.include 'Pods/Generated/Pods-BananaLib.release.xcconfig' @pod_target.xcconfig_path('Release').to_s.should.include 'Pods/Target Support Files/Pods-BananaLib.release.xcconfig'
end end
it 'returns the absolute path of the target header file' do it 'returns the absolute path of the target header file' do
@pod_target.target_environment_header_path.to_s.should.include 'Pods/Generated/Pods-environment.h' @pod_target.target_environment_header_path.to_s.should.include 'Pods/Target Support Files/Pods-environment.h'
end end
it 'returns the absolute path of the prefix header file' do it 'returns the absolute path of the prefix header file' do
@pod_target.prefix_header_path.to_s.should.include 'Pods/Generated/Pods-BananaLib-prefix.pch' @pod_target.prefix_header_path.to_s.should.include 'Pods/Target Support Files/Pods-BananaLib-prefix.pch'
end end
it 'returns the absolute path of the bridge support file' do it 'returns the absolute path of the bridge support file' do
@pod_target.bridge_support_path.to_s.should.include 'Pods/Generated/Pods-BananaLib.bridgesupport' @pod_target.bridge_support_path.to_s.should.include 'Pods/Target Support Files/Pods-BananaLib.bridgesupport'
end end
it 'returns the absolute path of the public and private xcconfig files' do it 'returns the absolute path of the public and private xcconfig files' do
@pod_target.xcconfig_path.to_s.should.include 'Pods/Generated/Pods-BananaLib.xcconfig' @pod_target.xcconfig_path.to_s.should.include 'Pods/Target Support Files/Pods-BananaLib.xcconfig'
@pod_target.xcconfig_private_path.to_s.should.include 'Pods/Generated/Pods-BananaLib-Private.xcconfig' @pod_target.xcconfig_private_path.to_s.should.include 'Pods/Target Support Files/Pods-BananaLib-Private.xcconfig'
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment