Commit c904e2a9 authored by Fabio Pelosin's avatar Fabio Pelosin

[FileAccessor] Include directories in #preserve_paths

parent c251474b
...@@ -54,7 +54,7 @@ module Pod ...@@ -54,7 +54,7 @@ module Pod
# @return [String] A string suitable for debugging. # @return [String] A string suitable for debugging.
# #
def inspect def inspect
"<#{self.class} spec=#{spec.name} platform=#{spec_consumer.platform} root=#{path_list.root}>" "<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{path_list.root}>"
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
...@@ -91,17 +91,13 @@ module Pod ...@@ -91,17 +91,13 @@ module Pod
# specification grouped by destination. # specification grouped by destination.
# #
def resources def resources
options = { paths_for_attribute(:resources, true)
:exclude_patterns => spec_consumer.exclude_files,
:include_dirs => true,
}
expanded_paths(spec_consumer.resources, options)
end end
# @return [Array<Pathname>] the files of the specification to preserve. # @return [Array<Pathname>] the files of the specification to preserve.
# #
def preserve_paths def preserve_paths
paths_for_attribute(:preserve_paths) paths_for_attribute(:preserve_paths, true)
end end
# @return [Pathname] The of the prefix header file of the specification. # @return [Pathname] The of the prefix header file of the specification.
...@@ -144,11 +140,12 @@ module Pod ...@@ -144,11 +140,12 @@ module Pod
# #
# @return [Array<Pathname>] the paths. # @return [Array<Pathname>] the paths.
# #
def paths_for_attribute(attribute) def paths_for_attribute(attribute, include_dirs = false)
file_patterns = spec_consumer.send(attribute) file_patterns = spec_consumer.send(attribute)
options = { options = {
:exclude_patterns => spec_consumer.exclude_files, :exclude_patterns => spec_consumer.exclude_files,
:dir_pattern => glob_for_attribute(attribute) :dir_pattern => glob_for_attribute(attribute),
:include_dirs => include_dirs,
} }
expanded_paths(file_patterns, options) expanded_paths(file_patterns, options)
end end
......
...@@ -80,12 +80,21 @@ module Pod ...@@ -80,12 +80,21 @@ module Pod
] ]
end end
it "returns the preserve path" do it "includes folders in the resources" do
@accessor.resources.should.include?(@root + "Resources/sub_dir")
end
it "returns the preserve paths" do
@accessor.preserve_paths.sort.should == [ @accessor.preserve_paths.sort.should == [
@root + "preserve_me.txt" @root + "preserve_me.txt"
] ]
end end
it "includes folders in the preserve paths" do
@spec_consumer.stubs(:preserve_paths).returns(["Resources"])
@accessor.preserve_paths.should.include?(@root + "Resources")
end
it "returns the prefix header of the specification" do it "returns the prefix header of the specification" do
@accessor.prefix_header.should == @root + 'Classes/BananaLib.pch' @accessor.prefix_header.should == @root + 'Classes/BananaLib.pch'
end end
...@@ -120,7 +129,8 @@ module Pod ...@@ -120,7 +129,8 @@ module Pod
file_patterns = ["Classes/*.{h,m}", "Vendor"] file_patterns = ["Classes/*.{h,m}", "Vendor"]
options = { options = {
:exclude_patterns => ["Classes/**/osx/**/*", "Resources/**/osx/**/*"], :exclude_patterns => ["Classes/**/osx/**/*", "Resources/**/osx/**/*"],
:dir_pattern => "*.{h,hpp,hh,m,mm,c,cpp}" :dir_pattern => "*.{h,hpp,hh,m,mm,c,cpp}",
:include_dirs => false,
} }
@spec.exclude_files = options[:exclude_patterns] @spec.exclude_files = options[:exclude_patterns]
@accessor.expects(:expanded_paths).with(file_patterns, options) @accessor.expects(:expanded_paths).with(file_patterns, options)
......
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