Commit d3a7c80b authored by Fabio Pelosin's avatar Fabio Pelosin

Merge remote-tracking branch 'origin/sandbox_reorganization_544' into sandbox_reorganization_544

* origin/sandbox_reorganization_544:
  [Integration] Update
  [Integration] Update fixtures
  [Specs] Minor fix
  Rebuilding fixtures again.
  fixing .xcconfig tests and output.
  Fixed integration tests to work with sandbox.
  Regenerated integration files.
  Last unit test updates for sandbox.
  File references and target installer tests updated for new sandbox layout.
  Fixing more tests to look for files in the correct spots.
  Many test fixes.
  External sources and sandbox analyser spec tests fixed to work with new migrator.
  [WIP] Integrating migrator with tests.
  Initial work for sandbox reorganization

Conflicts:
	examples/AFNetworking iOS Example/AFNetworking iOS Example.xcworkspace/contents.xcworkspacedata
	lib/cocoapods/external_sources.rb
	lib/cocoapods/installer.rb
	lib/cocoapods/installer/target_installer.rb
	lib/cocoapods/sandbox.rb
	lib/cocoapods/sandbox/headers_store.rb
	spec/cocoapods-integration-specs
	spec/unit/external_sources_spec.rb
	spec/unit/generator/xcconfig/aggregate_xcconfig_spec.rb
	spec/unit/hooks/library_representation_spec.rb
	spec/unit/installer/analyzer/sandbox_analyzer_spec.rb
	spec/unit/installer/file_references_installer_spec.rb
	spec/unit/installer/pod_source_installer_spec.rb
	spec/unit/installer/target_installer/aggregate_target_installer_spec.rb
	spec/unit/installer/target_installer/pod_target_installer_spec.rb
	spec/unit/installer/user_project_integrator/target_integrator_spec.rb
	spec/unit/installer/user_project_integrator_spec.rb
	spec/unit/installer_spec.rb
	spec/unit/library_spec.rb
	spec/unit/project_spec.rb
	spec/unit/sandbox/headers_store_spec.rb
	spec/unit/sandbox_spec.rb
	spec/unit/target/aggregate_target_spec.rb
	spec/unit/target/pod_target_spec.rb
parents 47682d7e e3cfdfd6
......@@ -33,7 +33,7 @@ module Pod
#
# @return [void]
#
def run_install_with_update(update)
def run_install_with_update(update)
installer = Installer.new(config.sandbox, config.podfile, config.lockfile)
installer.update = update
installer.install!
......
......@@ -97,7 +97,7 @@ 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
......
......@@ -28,14 +28,16 @@ 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 +87,7 @@ module Pod
# @return [void]
#
def install!
migrate_installation_if_needed
resolve_dependencies
download_dependencies
generate_pods_project
......@@ -92,6 +95,13 @@ module Pod
perform_post_install_actions
end
def migrate_installation_if_needed
UI.section "Performing existing installation migration" do
migrator = Migrator.new(sandbox)
migrator.migrate!
end
end
def resolve_dependencies
UI.section 'Analyzing dependencies' do
analyze
......
module Pod
class Installer
# Migrates installations performed by previous versions of CocoaPods.
#
class Migrator
#
#
attr_reader :installation_version
#
#
attr_reader :sandbox
#
#
def initialize(sandbox)
@sandbox = sandbox
end
#
#
def migrate!
if sandbox.manifest
migrate_to_0_20 if version_minor('0.20')
end
end
#-----------------------------------------------------------------------#
private
# @!group Migration Steps
# TODO: Fix copy resources script
# TODO: Fix manifest check
# TODO: Fix xcconfig
# TODO: Group target support files
#
def migrate_to_0_20
title_options = { :verbose_prefix => "-> ".green }
UI.titled_section("Migrating to CocoaPods 0.20".green, title_options) do
mkdir(sandbox.generated_dir_root)
mkdir(sandbox.headers_root)
mkdir(sandbox.sources_root)
sandbox.root.children.each do |child|
relative = child.relative_path_from(sandbox.root)
case relative.to_s
when 'Generated'
next
when 'BuildHeaders', 'Headers'
move(child, sandbox.headers_root + relative)
else
if child.directory? && child.extname != '.xcodeproj'
move(child, sandbox.sources_root + relative)
else
move(child, sandbox.generated_dir_root + relative)
end
end
end
end
end
#-----------------------------------------------------------------------#
private
# @!group Private helpers
def version_minor(target_version)
installation_version < Version.new(target_version)
end
def installation_version
sandbox.manifest.cocoapods_version
end
def mkdir(path)
path.mkpath
end
def move(path, new_name)
path.rename(new_name)
end
#-----------------------------------------------------------------------#
end
end
end
......@@ -117,7 +117,7 @@ module Pod
add_file_to_support_group(path)
target.build_configurations.each do |c|
relative_path = path.relative_path_from(sandbox.root)
relative_path = path.relative_path_from(project.path.dirname)
c.build_settings['GCC_PREFIX_HEADER'] = relative_path.to_s
end
end
......
......@@ -100,7 +100,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.
......
......@@ -68,6 +68,7 @@ module Pod
@checkout_sources = {}
@development_pods = {}
@pods_with_absolute_path = []
FileUtils.mkdir_p(generated_dir_root)
end
# @return [Lockfile] the manifest which contains the information about the
......@@ -81,14 +82,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]
......@@ -118,13 +111,13 @@ module Pod
# @return [Pathname] the path of the manifest.
#
def manifest_path
root + 'Manifest.lock'
generated_dir_root + "Manifest.lock"
end
# @return [Pathname] the path of the Pods project.
#
def project_path
root + 'Pods.xcodeproj'
generated_dir_root + "Pods.xcodeproj"
end
# Returns the path for the directory where to store the support files of
......@@ -137,7 +130,7 @@ module Pod
#
def library_support_files_dir(_name)
# root + "Target Support Files/#{name}"
root
generated_dir_root
end
# Returns the path where the Pod with the given name is stored, taking into
......@@ -153,8 +146,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 +160,22 @@ module Pod
@pods_with_absolute_path.include? name
end
# @return [Pathname] the directory where to store the documentation.
# @return [Pathname]
#
def generated_dir_root
root + 'Generated'
end
# @return [Pathname]
#
def headers_root
generated_dir_root + 'Headers'
end
# @return [Pathname]
#
def documentation_dir
root + 'Documentation'
def sources_root
generated_dir_root + 'Sources'
end
#-------------------------------------------------------------------------#
......@@ -202,7 +206,7 @@ module Pod
#
def specifications_dir(_external_source = false)
# root + "Specifications"
root + 'Local Podspecs'
generated_dir_root + "Local Podspecs"
end
# Returns the path of the specification for the Pod with the
......
......@@ -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.generated_dir_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)
......
......@@ -36,7 +36,7 @@ module Pod
it 'pre-downloads the Pod and stores the relevant information in the sandbox' do
@subject.send(:pre_download, config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path = config.sandbox.specifications_dir + 'Reachability.podspec'
path.should.exist?
config.sandbox.predownloaded_pods.should == ['Reachability']
config.sandbox.checkout_sources.should == {
......@@ -48,8 +48,9 @@ module Pod
end
it "checks for JSON podspecs" do
path = config.sandbox.root + 'Reachability'
path = config.sandbox.pod_dir('Reachability')
podspec_path = path + 'Reachability.podspec.json'
Dir.mkdir(config.sandbox.sources_root)
Dir.mkdir(path)
File.open(podspec_path, "w") {}
Pathname.any_instance.stubs(:rmtree)
......
......@@ -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_dir + 'Reachability.podspec'
path.should.exist?
end
......
......@@ -12,7 +12,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_dir + 'Reachability.podspec'
path.should.exist?
end
......@@ -22,7 +22,7 @@ module Pod
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_dir + 'Reachability.podspec'
path.should.exist?
end
......
......@@ -12,7 +12,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_dir + 'Reachability.podspec'
path.should.exist?
end
......
......@@ -21,7 +21,7 @@ module Pod
end
it 'returns the path of the pods root relative to the user project' do
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods/Generated'
end
#-----------------------------------------------------------------------#
......@@ -53,7 +53,7 @@ module Pod
end
it 'sets the PODS_ROOT build variable' do
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
@xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods/Generated'
end
it 'adds the sandbox public headers search paths to the xcconfig, with quotes, as header search paths' do
......
......@@ -29,11 +29,11 @@ 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/Generated/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/Generated/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/Generated/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/Generated/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_root.should == config.sandbox.generated_dir_root
target.user_project_path.to_s.should.include 'SampleProject/SampleProject'
target.client_root.to_s.should.include 'SampleProject'
......
......@@ -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 + 'Generated/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 + 'Generated/Sources/BananaLib/README'
readme_file.should.exist
end
......@@ -168,14 +168,14 @@ module Pod
it 'returns the clean paths' do
@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' }
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.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/Generated/Sources/BananaLib/BananaLib.podspec",
"Pods/Generated/Sources/BananaLib/libPusher",
"Pods/Generated/Sources/BananaLib/sub-dir",
"Pods/Generated/Sources/BananaLib/sub-dir/sub-dir-2",
"Pods/Generated/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/Generated/Sources/BananaLib/Classes/Banana.h",
"Pods/Generated/Sources/BananaLib/Classes/Banana.m",
"Pods/Generated/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/Generated/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/Generated/Sources/BananaLib/LICENSE",
"Pods/Generated/Sources/BananaLib/README",
"Pods/Generated/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/Generated/Sources/BananaLib/Classes/Banana.h",
"Pods/Generated/Sources/BananaLib/Classes/Banana.m",
"Pods/Generated/Sources/BananaLib/Classes/BananaLib.pch",
"Pods/Generated/Sources/BananaLib/Classes/BananaPrivate.h",
"Pods/Generated/Sources/BananaLib/LICENSE",
"Pods/Generated/Sources/BananaLib/README",
"Pods/Generated/Sources/BananaLib/Resources/logo-sidebar.png"
]
end
......
......@@ -119,12 +119,12 @@ module Pod
@installer.install!
file = config.sandbox.root + @target.xcconfig_path('Release')
xcconfig = Xcodeproj::Config.new(file)
xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods'
xcconfig.to_hash['PODS_ROOT'].should == '${SRCROOT}/Pods/Generated'
end
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'
file = config.sandbox.generated_dir_root + '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 +140,7 @@ module Pod
it 'creates a create copy resources script' do
@installer.install!
script = config.sandbox.root + 'Pods-resources.sh'
script = config.sandbox.generated_dir_root + 'Pods-resources.sh'
script.read.should.include?('logo-sidebar.png')
end
......@@ -154,9 +154,9 @@ module Pod
it 'creates the acknowledgements files ' do
@installer.install!
markdown = config.sandbox.root + 'Pods-acknowledgements.markdown'
markdown = config.sandbox.generated_dir_root + 'Pods-acknowledgements.markdown'
markdown.read.should.include?('Permission is hereby granted')
plist = config.sandbox.root + 'Pods-acknowledgements.plist'
plist = config.sandbox.generated_dir_root + 'Pods-acknowledgements.plist'
plist.read.should.include?('Permission is hereby granted')
end
......@@ -166,7 +166,7 @@ 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'
dummy = config.sandbox.generated_dir_root + 'Pods-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods')
end
end
......
......@@ -124,7 +124,7 @@ 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'
prefix_header = config.sandbox.generated_dir_root + 'Pods-BananaLib-prefix.pch'
generated = prefix_header.read
expected = <<-EOS.strip_heredoc
#ifdef __OBJC__
......@@ -144,7 +144,7 @@ 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'
dummy = config.sandbox.generated_dir_root + 'Pods-BananaLib-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods')
end
......
......@@ -58,7 +58,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/Generated/Pods-resources.sh\""
end
it 'adds a Check Manifest.lock build phase to each target' do
......@@ -66,7 +66,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.
......
......@@ -96,7 +96,7 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
'SampleProject/SampleProject.xcodeproj',
'Pods/Pods.xcodeproj',
"Pods/Generated/Pods.xcodeproj"
]
end
......@@ -109,14 +109,14 @@ module Pod
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
'SampleProject/SampleProject.xcodeproj',
'Pods/Pods.xcodeproj',
"Pods/Generated/Pods.xcodeproj"
]
end
it "doesn't write the workspace if not needed" do
file_references = [
Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('Pods/Generated/Pods.xcodeproj', 'group'),
]
workspace = Xcodeproj::Workspace.new(file_references)
......@@ -136,13 +136,13 @@ module Pod
saved.file_references.map(&:path).should == [
'user_added_project.xcodeproj',
'SampleProject/SampleProject.xcodeproj',
'Pods/Pods.xcodeproj',
'Pods/Generated/Pods.xcodeproj',
]
end
it 'preserves the order of the projects in the workspace' do
file_references = [
Xcodeproj::Workspace::FileReference.new('Pods/Pods.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('Pods/Generated/Pods.xcodeproj', 'group'),
Xcodeproj::Workspace::FileReference.new('SampleProject/SampleProject.xcodeproj', 'group'),
]
......@@ -152,7 +152,7 @@ module Pod
@integrator.send(:create_workspace)
saved = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
saved.file_references.map(&:path).should == [
'Pods/Pods.xcodeproj',
'Pods/Generated/Pods.xcodeproj',
'SampleProject/SampleProject.xcodeproj',
]
end
......
......@@ -424,7 +424,7 @@ module Pod
it 'saves the project to the given path' do
Xcodeproj::Project.any_instance.stubs(:recreate_user_schemes)
path = temporary_directory + 'Pods/Pods.xcodeproj'
path = temporary_directory + 'Pods/Generated/Pods.xcodeproj'
@installer.pods_project.expects(:save)
@installer.send(:write_pod_project)
end
......@@ -454,7 +454,7 @@ module Pod
it 'writes the sandbox manifest' do
@installer.send(:write_lockfiles)
lockfile = Lockfile.from_file(temporary_directory + 'Pods/Manifest.lock')
lockfile = Lockfile.from_file(temporary_directory + 'Pods/Generated/Manifest.lock')
lockfile.pod_names.should == ['BananaLib']
end
......
......@@ -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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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
......@@ -222,7 +222,7 @@ module Pod
f = @project['Podfile']
f.source_tree.should == 'SOURCE_ROOT'
f.xc_language_specification_identifier.should == 'xcode.lang.ruby'
f.path.should == '../Podfile'
f.path.should == '../../Podfile'
end
#----------------------------------------#
......
......@@ -9,7 +9,7 @@ module Pod
end
it "returns it's headers root" do
@header_dir.root.should == temporary_directory + 'Sandbox/Headers'
@header_dir.root.should == temporary_directory + 'Sandbox/Generated/Headers/Headers'
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/Headers/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/Headers')
end
end
end
......@@ -33,16 +33,11 @@ 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/Generated/Headers/Headers'
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 +47,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 +61,19 @@ 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/Generated/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/Generated/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.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox/Generated'
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/Generated/Sources/JSONKit'
end
it 'returns the directory where a local Pod is stored' do
......@@ -86,14 +81,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 +94,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_dir).mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.specifications_dir)
@sandbox.specification('BananaLib').name.should == 'BananaLib'
end
......@@ -120,18 +112,18 @@ module Pod
end
it 'returns the directory where to store the specifications' do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs'
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Generated/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.root + 'Generated/Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Generated/Local Podspecs')
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec'
end
it 'stores a podspec with a given path into the sandbox' do
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path = @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec'
path.should.exist
@sandbox.specification_path('BananaLib').should == path
end
......@@ -139,7 +131,7 @@ module Pod
it 'stores a podspec with the given string into the sandbox' do
podspec_string = fixture('banana-lib/BananaLib.podspec').read
@sandbox.store_podspec('BananaLib', podspec_string)
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path = @sandbox.root + 'Generated/Local Podspecs/BananaLib.podspec'
path.should.exist
@sandbox.specification_path('BananaLib').should == path
end
......
......@@ -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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/Pods.release.xcconfig'
end
end
......
......@@ -62,24 +62,24 @@ module Pod
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/Generated/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/Generated/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/Generated/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/Generated/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/Generated/Pods-BananaLib.xcconfig'
@pod_target.xcconfig_private_path.to_s.should.include 'Pods/Generated/Pods-BananaLib-Private.xcconfig'
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