Commit d35acaba authored by Fabio Pelosin's avatar Fabio Pelosin

[LocalPod] Cleaning fixes and code clean up.

parent 6bbbdbac
module Pod module Pod
class LocalPod class LocalPod
attr_reader :top_specification, :specifications attr_reader :top_specification, :specifications
# TODO: fix accross the app
attr_reader :sandbox attr_reader :sandbox
def initialize(specification, sandbox, platform) def initialize(specification, sandbox, platform)
...@@ -69,7 +68,7 @@ module Pod ...@@ -69,7 +68,7 @@ module Pod
reject { |d| d =~ /\/\.\.?$/ }. # Remove the `.` and `..` paths reject { |d| d =~ /\/\.\.?$/ }. # Remove the `.` and `..` paths
select { |d| File.directory?(d) }. # Get only directories or symlinks to directories select { |d| File.directory?(d) }. # Get only directories or symlinks to directories
each do |d| each do |d|
FileUtils.rm_rf(d) if File.symlink?(d) || (Dir.entries(d) == %w[ . .. ]) # Remove the dirs/symlink only if it is empty FileUtils.rm_rf(d) if File.symlink?(d) || (Dir.entries(d) == %w[ . .. ]) # Remove the symlink and the empty dirs
end end
end end
...@@ -88,26 +87,23 @@ module Pod ...@@ -88,26 +87,23 @@ module Pod
end end
def clean_paths def clean_paths
paths = expanded_paths('**/*').reject {|p| p.directory? } expanded_paths('**/{*,.*}').reject { |p| p.directory? } - used_files
# TODO: deprecate Specification#clean_paths
paths = @top_specification.clean_paths unless @top_specification.clean_paths.empty?
paths - used_files
end end
def used_files def used_files
source_files(false) + resources(false) + [ readme_file, license_file, prefix_header_file ] + expanded_paths('*.podspec') + preserve_paths source_files(false) + resources(false) + [ readme_file, license_file, prefix_header_file ] + preserve_paths
end end
def readme_file def readme_file
expanded_paths('README.*').first expanded_paths(%w[README* readme*]).first
end end
def license_file def license_file
expanded_paths(%w[ LICENSE licence.txt ]).first expanded_paths(%w[ LICENSE* licence* ]).first
end end
def preserve_paths def preserve_paths
chained_expanded_paths(:preserve_paths) chained_expanded_paths(:preserve_paths) + expanded_paths(%w[ *.podspec notice* NOTICE* ])
end end
def header_files def header_files
...@@ -127,13 +123,11 @@ module Pod ...@@ -127,13 +123,11 @@ module Pod
#TODO: fix #TODO: fix
def add_to_target(target) def add_to_target(target)
implementation_files.each do |file| implementation_files.each do |file|
# TODO: respect the compiler flags of each subspec
target.add_source_file(file, nil, top_specification.compiler_flags.strip) target.add_source_file(file, nil, top_specification.compiler_flags.strip)
end end
end end
def compiler_flags
end
def requires_arc? def requires_arc?
top_specification.requires_arc top_specification.requires_arc
......
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