Commit c251474b authored by Fabio Pelosin's avatar Fabio Pelosin

[FileAccessor] Add #root and clean up interface

parent 9d9e4a53
...@@ -5,6 +5,8 @@ module Pod ...@@ -5,6 +5,8 @@ module Pod
# taking into account any exclude pattern and the default extensions to use # taking into account any exclude pattern and the default extensions to use
# for directories. # for directories.
# #
# @note The FileAccessor always returns absolute paths.
#
class FileAccessor class FileAccessor
HEADER_EXTENSIONS = Xcodeproj::Constants::HEADER_FILES_EXTENSIONS HEADER_EXTENSIONS = Xcodeproj::Constants::HEADER_FILES_EXTENSIONS
...@@ -31,6 +33,12 @@ module Pod ...@@ -31,6 +33,12 @@ module Pod
end end
end end
# @return [Pathname] the directory which contains the files of the Pod.
#
def root
path_list.root
end
# @return [Specification] the specification. # @return [Specification] the specification.
# #
def spec def spec
...@@ -39,8 +47,8 @@ module Pod ...@@ -39,8 +47,8 @@ module Pod
# @return [Specification] the platform used to consume the specification. # @return [Specification] the platform used to consume the specification.
# #
def platform def platform_name
spec_consumer.platform spec_consumer.platform_name
end end
# @return [String] A string suitable for debugging. # @return [String] A string suitable for debugging.
......
...@@ -13,14 +13,6 @@ module Pod ...@@ -13,14 +13,6 @@ module Pod
describe "In general" do describe "In general" do
it "returns the root" do
@accessor.path_list.should == @path_list
end
it "returns the specification" do
@accessor.spec_consumer.should == @spec_consumer
end
it "raises if the consumer is nil" do it "raises if the consumer is nil" do
e = lambda { FileAccessor.new(@path_list, nil) }.should.raise Informative e = lambda { FileAccessor.new(@path_list, nil) }.should.raise Informative
e.message.should.match /without a specification consumer/ e.message.should.match /without a specification consumer/
...@@ -34,6 +26,18 @@ module Pod ...@@ -34,6 +26,18 @@ module Pod
e.message.should.match /non existent folder/ e.message.should.match /non existent folder/
end end
it "returns the root" do
@accessor.root.should == @path_list.root
end
it "returns the specification" do
@accessor.spec.should == @spec
end
it "returns the platform for which the spec is being consumed" do
@accessor.platform_name.should == :ios
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
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