Permalink
Browse files

Finish installer and integration specs.

  • Loading branch information...
1 parent 3655f6e commit b27e1d2c48a3fce99e3b3f2ba6f15e73db735053 @alloy alloy committed Sep 16, 2011
@@ -71,7 +71,7 @@ def generate_project
end
def write_files!
- xproj.create_in(config.project_pods_root)
+ xcodeproj.create_in(config.project_pods_root)
xcconfig.create_in(config.project_pods_root)
end
end
@@ -24,12 +24,25 @@ def to_hash
@template
end
- def find_object(conditions)
- objects.find do |_, object|
+ def find_objects(conditions)
+ objects.select do |_, object|
object.objectsForKeys(conditions.keys, notFoundMarker:Object.new) == conditions.values
end
end
+ def find_object(conditions)
+ find_objects(conditions).first
+ end
+
+ def source_files
+ conditions = { 'isa' => 'PBXFileReference', 'sourceTree' => 'SOURCE_ROOT' }
+ find_objects(conditions).map do |_, object|
+ if %w{ .h .m .mm .c .cpp }.include?(File.extname(object['path']))
+ Pathname.new(object['path'])
+ end
+ end.compact
+ end
+
def add_source_file(file)
file_ref_uuid = add_file_reference(file, 'SOURCE_ROOT')
add_file_to_group(file_ref_uuid, 'Pods')
View
@@ -50,11 +50,17 @@ def set.specification
installer = SpecHelper::Installer.new(spec)
installer.install!
- (config.project_pods_root + 'Reachability.podspec').should.exist
- (config.project_pods_root + 'ASIHTTPRequest.podspec').should.exist
- (config.project_pods_root + 'ASIWebPageRequest.podspec').should.exist
- (config.project_pods_root + 'JSONKit.podspec').should.exist
- (config.project_pods_root + 'SSZipArchive.podspec').should.exist
+ root = config.project_pods_root
+ (root + 'Reachability.podspec').should.exist
+ (root + 'ASIHTTPRequest.podspec').should.exist
+ (root + 'ASIWebPageRequest.podspec').should.exist
+ (root + 'JSONKit.podspec').should.exist
+ (root + 'SSZipArchive.podspec').should.exist
+
+ (root + 'Pods.xcconfig').read.should == installer.xcconfig.to_s
+
+ project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s
+ NSDictionary.dictionaryWithContentsOfFile(project_file).should == installer.xcodeproj.to_hash
puts "\n[!] Compiling static library..."
Dir.chdir(config.project_pods_root) do
@@ -17,28 +17,48 @@
[
'ASIHTTPRequest',
['Classes'],
- "{Classes,External/Reachability}/*.{h,m}"
+ "{Classes,External/Reachability}/*.{h,m}",
+ {
+ "USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)",
+ "ALWAYS_SEARCH_USER_PATHS" => "YES",
+ "OTHER_LDFLAGS" => "-framework SystemConfiguration -framework CFNetwork " \
+ "-framework MobileCoreServices -l z.1.2.3"
+ }
],
[
'Reachability',
["External/Reachability/*.h", "External/Reachability/*.m"],
- "External/Reachability/*.{h,m}"
+ "External/Reachability/*.{h,m}",
+ {
+ "USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)",
+ "ALWAYS_SEARCH_USER_PATHS" => "YES"
+ }
],
[
'ASIWebPageRequest',
['**/ASIWebPageRequest.*'],
- "{Classes,Classes/ASIWebPageRequest,External/Reachability}/*.{h,m}"
+ "{Classes,Classes/ASIWebPageRequest,External/Reachability}/*.{h,m}",
+ {
+ "USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)",
+ "ALWAYS_SEARCH_USER_PATHS" => "YES",
+ "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2",
+ "OTHER_LDFLAGS" => "-l xml2.2.7.3 -framework SystemConfiguration " \
+ "-framework CFNetwork -framework MobileCoreServices -l z.1.2.3"
+ }
],
- ].each do |name, patterns, expected_pattern|
+ ].each do |name, patterns, expected_pattern, xcconfig|
Pod::Source.reset!
Pod::Spec::Set.reset!
installer = Pod::Installer.new(Pod::Spec.new { dependency(name); source_files(*patterns) })
expected = (stubbed_destroot(installer) + expected_pattern).glob.map do |file|
file.relative_path_from(config.project_pods_root)
end
+ installer.generate_project
installer.source_files.size.should == expected.size
installer.source_files.sort.should == expected.sort
- #installer.xproj.source_files.sort.should == expected.sort
+ installer.xcodeproj.source_files.size.should == expected.size
+ installer.xcodeproj.source_files.sort.should == expected.sort
+ installer.xcconfig.to_hash.should == xcconfig
end
end
@@ -66,4 +66,10 @@
project_file = (temporary_directory + 'Pods.xcodeproj/project.pbxproj')
NSDictionary.dictionaryWithContentsOfFile(project_file.to_s).should == @project.to_hash
end
+
+ it "returns all source files" do
+ files = [Pathname.new('/some/file.h'), Pathname.new('/some/file.m')]
+ files.each { |file| @project.add_source_file(file) }
+ @project.source_files.sort.should == files.sort
+ end
end

0 comments on commit b27e1d2

Please sign in to comment.