Commit 3ca4bf3d authored by Eloy Duran's avatar Eloy Duran

Refactor

parent 419af929
......@@ -3,9 +3,8 @@ module Pod
class Install < Command
def run
if spec = Specification.from_podfile(podfile)
#config.clean = false
spec.install_dependent_specifications!
spec.create_static_library!
spec.create_static_library_project!
else
$stderr.puts "No Podfile found in current working directory."
end
......
......@@ -119,35 +119,33 @@ module Pod
end
end
def create_static_library!
puts "==> Creating static library"
source_files, frameworks, header_search_paths = [], [], []
def create_static_library_project!
puts "==> Creating static library project"
project = XcodeProject.static_library
resolved_dependent_specification_sets.each do |set|
# In case the set is only part of other pods we don't need to build
# the pod itself.
next if set.only_part_of_other_pod?
spec = set.podspec
spec.read(:source_files).each do |pattern|
pattern = spec.pod_destroot + pattern
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
source_files.concat(Dir.glob(pattern.to_s).map { |f| Pathname.new(f) })
end
if f = spec.read(:frameworks)
frameworks.concat(f)
Dir.glob(pattern.to_s).each do |file|
file = Pathname.new(file)
file = file.relative_path_from(config.project_pods_root)
project.add_source_file(file)
end
end
if s = spec.read(:header_search_paths)
header_search_paths.concat(s)
if frameworks = spec.read(:frameworks)
frameworks.each { |framework| project.add_framework(framework) }
end
end
project = XcodeProject.static_library
source_files.each do |file|
file = file.relative_path_from(config.project_pods_root)
project.add_source_file(file)
if search_paths = spec.read(:header_search_paths)
search_paths.each { |path| project.add_header_search_path(path) }
end
end
frameworks.each { |framework| project.add_framework(framework) }
project.add_header_search_paths(header_search_paths)
project.create_in(config.project_pods_root)
end
......
......@@ -69,11 +69,9 @@ module Pod
add_file_to_list('PBXFrameworksBuildPhase', build_file_uuid)
end
def add_header_search_paths(paths)
objects_by_isa('XCBuildConfiguration').each do |uuid, object|
existing_paths = object['buildSettings']['HEADER_SEARCH_PATHS'] ||= []
p paths
existing_paths.concat(paths)
def add_header_search_path(path)
objects_by_isa('XCBuildConfiguration').each do |_, object|
(object['buildSettings']['HEADER_SEARCH_PATHS'] ||= []) << path
end
end
......@@ -94,7 +92,6 @@ module Pod
def add_file_to_list(isa, build_file_uuid)
object_uuid, object = objects_by_isa(isa).first
object['files'] << build_file_uuid
#objects[object_uuid] = object
end
def add_file_to_group(file_ref_uuid, name)
......@@ -102,7 +99,6 @@ module Pod
object['isa'] == 'PBXGroup' && object['name'] == name
end
object['children'] << file_ref_uuid
#objects[object_uuid] = object
end
def objects
......
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