Commit 587ee30a authored by Fabio Pelosin's avatar Fabio Pelosin

Implement disabled specs

parent 82f47ffc
...@@ -105,11 +105,11 @@ module Pod ...@@ -105,11 +105,11 @@ module Pod
sandbox.public_headers.add_search_path(headers_sandbox) sandbox.public_headers.add_search_path(headers_sandbox)
consumer = file_accessor.spec_consumer consumer = file_accessor.spec_consumer
header_mappings(headers_sandbox, consumer, file_accessor.headers, file_accessor.path_list.root).each do |namespaced_path, files| header_mappings(headers_sandbox, consumer, file_accessor.headers).each do |namespaced_path, files|
sandbox.build_headers.add_files(namespaced_path, files) sandbox.build_headers.add_files(namespaced_path, files)
end end
header_mappings(headers_sandbox, consumer, file_accessor.public_headers, file_accessor.path_list.root).each do |namespaced_path, files| header_mappings(headers_sandbox, consumer, file_accessor.public_headers).each do |namespaced_path, files|
sandbox.public_headers.add_files(namespaced_path, files) sandbox.public_headers.add_files(namespaced_path, files)
end end
end end
...@@ -131,7 +131,15 @@ module Pod ...@@ -131,7 +131,15 @@ module Pod
# Computes the destination sub-directory in the sandbox # Computes the destination sub-directory in the sandbox
# #
# @param [] # @param [Pathname] headers_sandbox
# The sandbox where the headers links should be stored for this
# Pod.
#
# @param [Specification::Consumer] consumer
# The consumer for which the headers need to be linked.
#
# @param [Array<Pathname>] headers
# The absolute paths of the headers which need to be mapped.
# #
# @return [Hash{Pathname => Array<Pathname>}] A hash containing the # @return [Hash{Pathname => Array<Pathname>}] A hash containing the
# headers folders as the keys and the absolute paths of the # headers folders as the keys and the absolute paths of the
...@@ -140,7 +148,7 @@ module Pod ...@@ -140,7 +148,7 @@ module Pod
# TODO This is being overridden in the RestKit 0.9.4 spec and that # TODO This is being overridden in the RestKit 0.9.4 spec and that
# override should be fixed. # override should be fixed.
# #
def header_mappings(headers_sandbox, consumer, headers, root) def header_mappings(headers_sandbox, consumer, headers)
dir = headers_sandbox dir = headers_sandbox
dir = dir + consumer.header_dir if consumer.header_dir dir = dir + consumer.header_dir if consumer.header_dir
...@@ -148,7 +156,9 @@ module Pod ...@@ -148,7 +156,9 @@ module Pod
headers.each do |header| headers.each do |header|
sub_dir = dir sub_dir = dir
if consumer.header_mappings_dir if consumer.header_mappings_dir
sub_dir = sub_dir + header.relative_path_from(consumer.header_mappings_dir).dirname header_mappings_dir = Pathname.new(consumer.header_mappings_dir)
relative_path = header.relative_path_from(header_mappings_dir)
sub_dir = sub_dir + relative_path.dirname
end end
mappings[sub_dir] ||= [] mappings[sub_dir] ||= []
mappings[sub_dir] << header mappings[sub_dir] << header
......
...@@ -279,6 +279,7 @@ module Pod ...@@ -279,6 +279,7 @@ module Pod
] ]
files.compact! files.compact!
files.flatten! files.flatten!
files.uniq!
files.map!{ |path| path.to_s } files.map!{ |path| path.to_s }
files.reject! { |path| path == "" } #TODO files.reject! { |path| path == "" } #TODO
files files
......
...@@ -346,7 +346,7 @@ module Pod ...@@ -346,7 +346,7 @@ module Pod
# For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h # For more information, see: http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
# #
# @param [Specification::Consumer] consumer # @param [Specification::Consumer] consumer
# The consumer for the specification for wich the compiler flags # The consumer for the specification for which the compiler flags
# are needed. # are needed.
# #
# @return [String] The compiler flags. # @return [String] The compiler flags.
......
...@@ -160,7 +160,8 @@ module Pod ...@@ -160,7 +160,8 @@ module Pod
globs[attrbute] globs[attrbute]
end end
# Matches the given patterns to the file present in the root of the path list. # Matches the given patterns to the file present in the root of the path
# list.
# #
# @param [Array<String, FileList>] patterns # @param [Array<String, FileList>] patterns
# The patterns to expand. # The patterns to expand.
......
...@@ -60,7 +60,7 @@ module Pod ...@@ -60,7 +60,7 @@ module Pod
# @param [Pathname] relative_header_path # @param [Pathname] relative_header_path
# the path of the header file relative to the sandbox. # the path of the header file relative to the sandbox.
# #
# @note This method adds the files are added to the search paths. # @note This method adds the files to the search paths.
# #
# @return [Pathname] # @return [Pathname]
# #
......
...@@ -48,12 +48,12 @@ module Pod ...@@ -48,12 +48,12 @@ module Pod
end end
root_length = root.to_s.length+1 root_length = root.to_s.length+1
paths = Dir.glob(root + "**/*", File::FNM_DOTMATCH) paths = Dir.glob(root + "**/*", File::FNM_DOTMATCH)
paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." } absolute_dirs = paths.select { |path| File.directory?(path) }
dirs = paths.select { |path| File.directory?(path) } relative_dirs = absolute_dirs.map { |p| p[root_length..-1] }
dirs = dirs.map { |p| p[root_length..-1] } absolute_paths = paths.reject { |p| p == "#{root}/." || p == "#{root}/.." }
paths = paths.map { |p| p[root_length..-1] } relative_paths = absolute_paths.map { |p| p[root_length..-1] }
@files = paths - dirs @files = relative_paths - relative_dirs
@dirs = dirs.map { |d| d.gsub(/\/\.\.?$/,'') }.uniq @dirs = relative_dirs.map { |d| d.gsub(/\/\.\.?$/,'') }.uniq
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
...@@ -82,9 +82,8 @@ module Pod ...@@ -82,9 +82,8 @@ module Pod
# #
def relative_glob(patterns, dir_pattern = nil, exclude_patterns = nil) def relative_glob(patterns, dir_pattern = nil, exclude_patterns = nil)
return [] if patterns.empty? return [] if patterns.empty?
patterns = [ patterns ] if patterns.is_a? String
list = patterns.map do |pattern| list = Array(patterns).map do |pattern|
if pattern.is_a?(String) if pattern.is_a?(String)
pattern += '/' + dir_pattern if directory?(pattern) && dir_pattern pattern += '/' + dir_pattern if directory?(pattern) && dir_pattern
expanded_patterns = dir_glob_equivalent_patterns(pattern) expanded_patterns = dir_glob_equivalent_patterns(pattern)
...@@ -152,15 +151,18 @@ module Pod ...@@ -152,15 +151,18 @@ module Pod
else else
patterns = [ pattern ] patterns = [ pattern ]
values_by_set.each do |set, values| values_by_set.each do |set, values|
patterns = patterns.map do |pattern| patterns = patterns.map do |old_pattern|
values.map do |value| values.map do |value|
pattern.gsub(set, value) old_pattern.gsub(set, value)
end end
end.flatten end.flatten
end end
patterns patterns
end end
end end
end # PathList
end # LocalPod #-----------------------------------------------------------------------#
end # Pod
end
end
end
...@@ -253,8 +253,7 @@ module Pod ...@@ -253,8 +253,7 @@ module Pod
UI.warn "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow UI.warn "Skipping compilation with `xcodebuild' because it can't be found.\n".yellow
else else
UI.message "\nBuilding with xcodebuild.\n".yellow do UI.message "\nBuilding with xcodebuild.\n".yellow do
messages = [] output = Dir.chdir(config.sandbox_root) { xcodebuild }
output = Dir.chdir(config.sandbox_root) { `xcodebuild clean build 2>&1` }
UI.puts output UI.puts output
parsed_output = parse_xcodebuild_output(output) parsed_output = parse_xcodebuild_output(output)
parsed_output.each do |message| parsed_output.each do |message|
...@@ -276,10 +275,10 @@ module Pod ...@@ -276,10 +275,10 @@ module Pod
# #
def check_file_patterns def check_file_patterns
[:source_files, :resources, :preserve_paths].each do |attr_name| [:source_files, :resources, :preserve_paths].each do |attr_name|
attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name } # file_attr = Specification::DSL.attributes.values.find{|attr| attr.name == attr_name }
# if !attr.empty?(spec) && file_accessor.send(attr_name).empty? if !file_accessor.spec_consumer.send(attr_name).empty? && file_accessor.send(attr_name).empty?
# error "The `#{attr_name}` pattern did not match any file." error "The `#{attr_name}` pattern did not match any file."
# end end
end end
unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] ) unless file_accessor.license || spec.license && ( spec.license[:type] == 'Public Domain' || spec.license[:text] )
...@@ -364,5 +363,15 @@ module Pod ...@@ -364,5 +363,15 @@ module Pod
new.gsub!(/^ */,' ') new.gsub!(/^ */,' ')
end end
end end
# @return [String] Executes xcodebuild in the current working directory and
# returns its output (bot STDOUT and STDERR).
#
def xcodebuild
`xcodebuild clean build 2>&1`
end
#-------------------------------------------------------------------------#
end end
end end
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Installer::PodSourceInstaller do describe Installer::FileReferencesInstaller do
before do before do
file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec') @file_accessor = fixture_file_accessor('banana-lib/BananaLib.podspec')
@library = Library.new(nil) @library = Library.new(nil)
@library.file_accessors = [file_accessor] @library.file_accessors = [@file_accessor]
@project = Project.new(config.sandbox.project_path) @project = Project.new(config.sandbox.project_path)
@installer = Installer::FileReferencesInstaller.new(config.sandbox, [@library], @project) @installer = Installer::FileReferencesInstaller.new(config.sandbox, [@library], @project)
end end
...@@ -54,7 +54,7 @@ module Pod ...@@ -54,7 +54,7 @@ module Pod
it "links the public headers" do it "links the public headers" do
@installer.install! @installer.install!
headers_root = config.sandbox.public_headers.root headers_root = config.sandbox.public_headers.root
public_header = headers_root+ 'BananaLib/Banana.h' public_header = headers_root + 'BananaLib/Banana.h'
private_header = headers_root + 'BananaLib/BananaPrivate.h' private_header = headers_root + 'BananaLib/BananaPrivate.h'
public_header.should.exist public_header.should.exist
private_header.should.not.exist private_header.should.not.exist
...@@ -66,17 +66,57 @@ module Pod ...@@ -66,17 +66,57 @@ module Pod
describe "Private Helpers" do describe "Private Helpers" do
xit "returns the unique file accessors" do it "returns the file accessors" do
library_1 = Library.new(nil) library_1 = Library.new(nil)
library_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] library_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
library_2 = Library.new(nil) library_2 = Library.new(nil)
library_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] library_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
installer = Installer::FileReferencesInstaller.new(config.sandbox, [library_1, library_2], @project) installer = Installer::FileReferencesInstaller.new(config.sandbox, [library_1, library_2], @project)
installer.send(:file_accessors).count.should == 1 roots = installer.send(:file_accessors).map { |fa| fa.path_list.root }
roots.should == [fixture('banana-lib'), fixture('banana-lib')]
end
it "handles libraries empty libraries without file accessors" do
library_1 = Library.new(nil)
library_1.file_accessors = []
installer = Installer::FileReferencesInstaller.new(config.sandbox, [library_1], @project)
roots = installer.send(:file_accessors).should == []
end end
xit "handles libraries without pods and hence without file accessors" do it "returns the header mappings" do
headers_sandbox = Pathname.new('BananaLib')
consumer = @file_accessor.spec_consumer
headers = [Pathname.new('BananaLib/Banana.h')]
mappings = @installer.send(:header_mappings, headers_sandbox, consumer, headers)
mappings.should == {
headers_sandbox => [Pathname.new('BananaLib/Banana.h')]
}
end
it "takes into account the header dir specified in the spec" do
headers_sandbox = Pathname.new('BananaLib')
consumer = @file_accessor.spec_consumer
headers = [Pathname.new('BananaLib/Banana.h')]
consumer.stubs(:header_dir).returns('Sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, consumer, headers)
mappings.should == {
(headers_sandbox + 'Sub_dir') => [Pathname.new('BananaLib/Banana.h')]
}
end
it "takes into account the header mappings dir specified in the spec" do
headers_sandbox = Pathname.new('BananaLib')
consumer = @file_accessor.spec_consumer
headers = [
Pathname.new('BananaLib/sub_dir/dir_1/banana_1.h'),
Pathname.new('BananaLib/sub_dir/dir_2/banana_2.h'),
]
consumer.stubs(:header_mappings_dir).returns('BananaLib/sub_dir')
mappings = @installer.send(:header_mappings, headers_sandbox, consumer, headers)
mappings.should == {
(headers_sandbox + 'dir_1') => [Pathname.new('BananaLib/sub_dir/dir_1/banana_1.h')],
(headers_sandbox + 'dir_2') => [Pathname.new('BananaLib/sub_dir/dir_2/banana_2.h')],
}
end end
end end
......
...@@ -154,40 +154,63 @@ module Pod ...@@ -154,40 +154,63 @@ module Pod
#--------------------------------------# #--------------------------------------#
describe "Specifications details" do
xit "handles Pods which return different file patterns per platform" do
end
xit "handles Pods with multiple subspecs activated" do
end
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "Private Helpers" do describe "Private Helpers" do
xit "returns the clean paths" do it "returns the clean paths" do
@installer.send(:download_source) @installer.send(:download_source)
@installer.send(:clean_paths).should == [] 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.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"
]
end end
xit "returns the used files" do it "returns the used files" do
@installer.send(:download_source) @installer.send(:download_source)
@installer.send(:used_files).should == [] 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"
]
end end
xit "returns the header mappings" do it "handles Pods with multiple file accessors" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
end spec.source = { :git => SpecHelper.fixture('banana-lib') }
spec.source_files = []
xit "returns the header mappings including subspecs" do spec.ios.source_files = 'Classes/*.h'
spec.osx.source_files = 'Classes/*.m'
ios_spec = spec.dup
osx_spec = spec.dup
specs_by_platform = { :ios => [ios_spec], :osx => [osx_spec] }
@installer = Installer::PodSourceInstaller.new(config.sandbox, specs_by_platform)
@installer.send(:download_source)
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"
]
end end
end end
......
...@@ -48,11 +48,6 @@ module Pod ...@@ -48,11 +48,6 @@ module Pod
#--------------------------------------# #--------------------------------------#
xit "sets the deployment target of the native target" do
# Test iOS and OS X
# @see https://github.com/CocoaPods/CocoaPods/commit/76b5b7f9c02a4d36425bde745ecd6d7ff289a00d
end
it 'adds the target for the static library to the project' do it 'adds the target for the static library to the project' do
@installer.install! @installer.install!
@project.targets.count.should == 1 @project.targets.count.should == 1
...@@ -87,17 +82,21 @@ module Pod ...@@ -87,17 +82,21 @@ module Pod
target.build_settings('Release')["VALIDATE_PRODUCT"].should == "YES" target.build_settings('Release')["VALIDATE_PRODUCT"].should == "YES"
end end
it "sets IPHONEOS_DEPLOYMENT_TARGET for iOS targets" do it "sets the platform and the deployment target for iOS targets" do
@installer.install! @installer.install!
target = @project.targets.first target = @project.targets.first
target.platform_name.should == :ios
target.deployment_target.should == "6.0"
target.build_settings('Debug')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0" target.build_settings('Debug')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
target.build_settings('AppStore')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0" target.build_settings('AppStore')["IPHONEOS_DEPLOYMENT_TARGET"].should == "6.0"
end end
it "sets MACOSX_DEPLOYMENT_TARGET for OS X targets" do it "sets the platform and the deployment target for OS X targets" do
@library.platform = Platform.new(:osx, '10.8') @library.platform = Platform.new(:osx, '10.8')
@installer.install! @installer.install!
target = @project.targets.first target = @project.targets.first
target.platform_name.should == :osx
target.deployment_target.should == "10.8"
target.build_settings('Debug')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8" target.build_settings('Debug')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
target.build_settings('AppStore')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8" target.build_settings('AppStore')["MACOSX_DEPLOYMENT_TARGET"].should == "10.8"
end end
......
...@@ -56,7 +56,7 @@ module Pod ...@@ -56,7 +56,7 @@ module Pod
@installer.install! @installer.install!
end end
it "marks all pods as added if there is no lockfile" do xit "marks all pods as added if there is no lockfile" do
true.should.be.true true.should.be.true
# @installer.pods_added_from_the_lockfile.should == ['JSONKit'] # @installer.pods_added_from_the_lockfile.should == ['JSONKit']
end end
......
...@@ -56,19 +56,17 @@ module Pod ...@@ -56,19 +56,17 @@ module Pod
validator.validated?.should.be.false validator.validated?.should.be.false
end end
unless skip_xcodebuild? it "uses xcodebuild to generate notes and warnings" do
it "uses xcodebuild to generate notes and warnings" do validator = Validator.new(podspec_path)
validator = Validator.new(podspec_path) validator.stubs(:check_file_patterns)
validator.stubs(:check_file_patterns) validator.stubs(:xcodebuild).returns("file.m:1:1: warning: direct access to objective-c's isa is deprecated")
validator.validate validator.validate
first = validator.results.map(&:to_s).first first = validator.results.map(&:to_s).first
first.should.include "[xcodebuild]" first.should.include "[xcodebuild]"
first.should.include "[OS X - iOS]" validator.result_type.should == :note
validator.result_type.should == :note
end
end end
xit "checks for file patterns" do it "checks for file patterns" do
file = write_podspec(stub_podspec(/s\.source_files = 'JSONKit\.\*'/, "s.source_files = 'wrong_paht.*'")) file = write_podspec(stub_podspec(/s\.source_files = 'JSONKit\.\*'/, "s.source_files = 'wrong_paht.*'"))
validator = Validator.new(file) validator = Validator.new(file)
validator.stubs(:build_pod) validator.stubs(:build_pod)
......
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