Commit d691d0bb authored by Fabio Pelosin's avatar Fabio Pelosin

Clean-up

parent 602d23f6
...@@ -36,11 +36,11 @@ module Pod ...@@ -36,11 +36,11 @@ module Pod
add_resources add_resources
end end
#-----------------------------------------------------------------------#
private private
# @!group Installation Steps # @!group Installation Steps
#---------------------------------------------------------------------#
# Reads the file accessors contents from the file system. # Reads the file accessors contents from the file system.
# #
...@@ -103,17 +103,11 @@ module Pod ...@@ -103,17 +103,11 @@ module Pod
end end
#-----------------------------------------------------------------------#
private private
# @!group Private Helpers # @!group Private Helpers
#---------------------------------------------------------------------#
# TODO
#
def pods_project
sandbox.project
end
# @return [Array<Sandbox::FileAccessor>] The file accessors for all the # @return [Array<Sandbox::FileAccessor>] The file accessors for all the
# specs platform combinations. # specs platform combinations.
...@@ -138,15 +132,15 @@ module Pod ...@@ -138,15 +132,15 @@ module Pod
file_accessors.each do |file_accessor| file_accessors.each do |file_accessor|
paths = file_accessor.send(file_accessor_key) paths = file_accessor.send(file_accessor_key)
paths.each do |path| paths.each do |path|
group = pods_project.group_for_spec(file_accessor.spec.name, group_key) group = sandbox.project.group_for_spec(file_accessor.spec.name, group_key)
pods_project.add_file_reference(path, group) sandbox.project.add_file_reference(path, group)
end end
end end
end end
#-----------------------------------------------------------------------# #---------------------------------------------------------------------#
end end
end end
end end
end end
...@@ -25,11 +25,11 @@ module Pod ...@@ -25,11 +25,11 @@ module Pod
@library = library @library = library
end end
private
#-----------------------------------------------------------------------# private
# @!group Installation steps # @!group Installation steps
#---------------------------------------------------------------------#
# Adds the target for the library to the Pods project with the # Adds the target for the library to the Pods project with the
# appropriate build configurations. # appropriate build configurations.
...@@ -90,11 +90,11 @@ module Pod ...@@ -90,11 +90,11 @@ module Pod
# #
attr_reader :target attr_reader :target
private
#-----------------------------------------------------------------------# private
# @!group Private helpers. # @!group Private helpers.
#---------------------------------------------------------------------#
# @return [Project] the Pods project of the sandbox. # @return [Project] the Pods project of the sandbox.
# #
...@@ -128,6 +128,6 @@ module Pod ...@@ -128,6 +128,6 @@ module Pod
end end
end end
end end
end end
...@@ -9,7 +9,7 @@ module Pod ...@@ -9,7 +9,7 @@ module Pod
@pod_target.file_accessors = [@file_accessor] @pod_target.file_accessors = [@file_accessor]
config.sandbox.project = Project.new(config.sandbox.project_path) config.sandbox.project = Project.new(config.sandbox.project_path)
config.sandbox.project.add_pod_group('BananaLib', fixture('banana-lib')) config.sandbox.project.add_pod_group('BananaLib', fixture('banana-lib'))
@installer = Installer::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [@pod_target]) @sut = Installer::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [@pod_target])
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
...@@ -19,18 +19,18 @@ module Pod ...@@ -19,18 +19,18 @@ module Pod
it "adds the files references of the source files the Pods project" do it "adds the files references of the source files the Pods project" do
@file_accessor.path_list.read_file_system @file_accessor.path_list.read_file_system
@file_accessor.path_list.expects(:read_file_system) @file_accessor.path_list.expects(:read_file_system)
@installer.install! @sut.install!
end end
it "adds the files references of the source files the Pods project" do it "adds the files references of the source files the Pods project" do
@installer.install! @sut.install!
file_ref = config.sandbox.project['Pods/BananaLib/Source Files/Banana.m'] file_ref = config.sandbox.project['Pods/BananaLib/Source Files/Banana.m']
file_ref.should.be.not.nil file_ref.should.be.not.nil
file_ref.path.should == "Classes/Banana.m" file_ref.path.should == "Classes/Banana.m"
end end
it "adds the file references of the frameworks of the project" do it "adds the file references of the frameworks of the project" do
@installer.install! @sut.install!
group = config.sandbox.project.group_for_spec('BananaLib', :frameworks_and_libraries) group = config.sandbox.project.group_for_spec('BananaLib', :frameworks_and_libraries)
file_ref = group['Bananalib.framework'] file_ref = group['Bananalib.framework']
file_ref.should.be.not.nil file_ref.should.be.not.nil
...@@ -38,7 +38,7 @@ module Pod ...@@ -38,7 +38,7 @@ module Pod
end end
it "adds the file references of the libraries of the project" do it "adds the file references of the libraries of the project" do
@installer.install! @sut.install!
group = config.sandbox.project.group_for_spec('BananaLib', :frameworks_and_libraries) group = config.sandbox.project.group_for_spec('BananaLib', :frameworks_and_libraries)
file_ref = group['libBananalib.a'] file_ref = group['libBananalib.a']
file_ref.should.be.not.nil file_ref.should.be.not.nil
...@@ -46,7 +46,7 @@ module Pod ...@@ -46,7 +46,7 @@ module Pod
end end
it "adds the files references of the resources the Pods project" do it "adds the files references of the resources the Pods project" do
@installer.install! @sut.install!
file_ref = config.sandbox.project['Pods/BananaLib/Resources/logo-sidebar.png'] file_ref = config.sandbox.project['Pods/BananaLib/Resources/logo-sidebar.png']
file_ref.should.be.not.nil file_ref.should.be.not.nil
file_ref.path.should == "Resources/logo-sidebar.png" file_ref.path.should == "Resources/logo-sidebar.png"
...@@ -64,23 +64,23 @@ module Pod ...@@ -64,23 +64,23 @@ module Pod
pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] pod_target_1.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
pod_target_2 = PodTarget.new([], nil, config.sandbox) pod_target_2 = PodTarget.new([], nil, config.sandbox)
pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')] pod_target_2.file_accessors = [fixture_file_accessor('banana-lib/BananaLib.podspec')]
installer = Installer::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2]) @sut = Installer::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [pod_target_1, pod_target_2])
roots = installer.send(:file_accessors).map { |fa| fa.path_list.root } roots = @sut.send(:file_accessors).map { |fa| fa.path_list.root }
roots.should == [fixture('banana-lib'), fixture('banana-lib')] roots.should == [fixture('banana-lib'), fixture('banana-lib')]
end end
it "handles libraries empty libraries without file accessors" do it "handles libraries empty libraries without file accessors" do
pod_target_1 = PodTarget.new([], nil, config.sandbox) pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = [] pod_target_1.file_accessors = []
installer = Installer::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [pod_target_1]) @sut = Installer::PodsProjectGenerator::FileReferencesInstaller.new(config.sandbox, [pod_target_1])
roots = installer.send(:file_accessors).should == [] roots = @sut.send(:file_accessors).should == []
end end
end end
describe "#add_file_accessors_paths_to_pods_group" do describe "#add_file_accessors_paths_to_pods_group" do
it "adds the paths of the paths of the file accessor corresponding to the given key to the Pods project" do it "adds the paths of the paths of the file accessor corresponding to the given key to the Pods project" do
@installer.send(:add_file_accessors_paths_to_pods_group, :source_files, :source_files) @sut.send(:add_file_accessors_paths_to_pods_group, :source_files, :source_files)
group = config.sandbox.project.group_for_spec('BananaLib', :source_files) group = config.sandbox.project.group_for_spec('BananaLib', :source_files)
group.children.map(&:name).sort.should == ["Banana.h", "Banana.m", "BananaPrivate.h"] group.children.map(&:name).sort.should == ["Banana.h", "Banana.m", "BananaPrivate.h"]
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