Commit b2fcbbb2 authored by Fabio Pelosin's avatar Fabio Pelosin

[PodSourceInstaller] Minor tweaks

parent 1168e907
...@@ -8,9 +8,6 @@ module Pod ...@@ -8,9 +8,6 @@ module Pod
# #
class PodSourceInstaller class PodSourceInstaller
# TODO: local option specs.
# TODO: add tests for multi platform / subspecs issues.
# @return [Sandbox] # @return [Sandbox]
# #
attr_reader :sandbox attr_reader :sandbox
...@@ -30,7 +27,13 @@ module Pod ...@@ -30,7 +27,13 @@ module Pod
@clean = true @clean = true
@generate_docs = false @generate_docs = false
@install_docs = false @install_docs = false
@agressive_cache = false @aggressive_cache = false
end
# @return [String] A string suitable for debugging.
#
def inspect
"<#{self.class} sandbox=#{sandbox.root} pod=#{root_spec.name}"
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
...@@ -57,15 +60,6 @@ module Pod ...@@ -57,15 +60,6 @@ module Pod
attr_accessor :clean attr_accessor :clean
alias_method :clean?, :clean alias_method :clean?, :clean
# @return [Bool] whether the downloader should always check against the
# remote if issues might be generated (mostly useful to speed up
# testing).
#
# @note This might be removed in future.
#
attr_accessor :agressive_cache
alias_method :agressive_cache?, :agressive_cache
# @return [Bool] whether the documentation should be generated for the # @return [Bool] whether the documentation should be generated for the
# Pod. # Pod.
# #
...@@ -78,6 +72,15 @@ module Pod ...@@ -78,6 +72,15 @@ module Pod
attr_accessor :install_docs attr_accessor :install_docs
alias_method :install_docs?, :install_docs alias_method :install_docs?, :install_docs
# @return [Bool] whether the downloader should always check against the
# remote if issues might be generated (mostly useful to speed up
# testing).
#
# @note This might be removed in future.
#
attr_accessor :aggressive_cache
alias_method :aggressive_cache?, :aggressive_cache
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
public public
...@@ -195,7 +198,7 @@ module Pod ...@@ -195,7 +198,7 @@ module Pod
@downloader = self.class.downloader_class.for_target(root, root_spec.source.dup) @downloader = self.class.downloader_class.for_target(root, root_spec.source.dup)
@downloader.cache_root = CACHE_ROOT @downloader.cache_root = CACHE_ROOT
@downloader.max_cache_size = MAX_CACHE_SIZE @downloader.max_cache_size = MAX_CACHE_SIZE
@downloader.agressive_cache = agressive_cache? @downloader.aggressive_cache = aggressive_cache?
@downloader @downloader
end end
...@@ -324,7 +327,7 @@ module Pod ...@@ -324,7 +327,7 @@ module Pod
# #
def header_mappings(headers_sandbox, consumer, headers) def header_mappings(headers_sandbox, consumer, headers)
dir = headers_sandbox dir = headers_sandbox
dir = base_dir + consumer.header_dir if consumer.header_dir dir = dir + consumer.header_dir if consumer.header_dir
mappings = {} mappings = {}
headers.each do |header| headers.each do |header|
......
...@@ -3,23 +3,39 @@ require File.expand_path('../../../spec_helper', __FILE__) ...@@ -3,23 +3,39 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Installer::PodSourceInstaller do describe Installer::PodSourceInstaller do
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@spec.source = { :git => SpecHelper.fixture('banana-lib') }
specs_by_platform = { :ios => [@spec] }
@installer = Installer::PodSourceInstaller.new(config.sandbox, specs_by_platform)
end
#-------------------------------------------------------------------------#
describe "In General" do describe "In General" do
# TODO: describe defaults it "cleans by default" do
@installer.should.clean?
end
it "doesn't generate docs by default" do
@installer.should.not.generate_docs?
end end
#-------------------------------------------------------------------------# it "doesn't installs the docs by default" do
@installer.should.not.install_docs?
end
describe "Installation" do it "doesn't use an aggressive cache by default" do
@installer.should.not.aggressive_cache?
end
before do
@spec = fixture_spec('banana-lib/BananaLib.podspec')
@spec.source = { :git => SpecHelper.fixture('banana-lib') }
specs_by_platform = { :ios => [@spec] }
@installer = Installer::PodSourceInstaller.new(config.sandbox, specs_by_platform)
end end
#-------------------------------------------------------------------------#
describe "Installation" do
describe "Download" do describe "Download" do
it "downloads the source" do it "downloads the source" do
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' } @spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
...@@ -124,35 +140,72 @@ module Pod ...@@ -124,35 +140,72 @@ module Pod
end end
#--------------------------------------#
describe "Options" do
it "doesn't downloads the source if the pod was already downloaded" do
@installer.stubs(:predownloaded?).returns(true)
@installer.expects(:download_source).never
@installer.stubs(:clean_installation)
@installer.stubs(:link_headers)
@installer.install!
end
it "doesn't downloads the source if the pod has a local source" do
@installer.local_path = 'Some Path'
@installer.expects(:download_source).never
@installer.stubs(:clean_installation)
@installer.stubs(:link_headers)
@installer.install!
end end
#-------------------------------------------------------------------------# it "doesn't clean the installation if the pod has a local source" do
@installer.local_path = 'Some Path'
@installer.expects(:clean_installation).never
@installer.stubs(:link_headers)
@installer.install!
end
describe "Private Helpers" do end
#--------------------------------------# #--------------------------------------#
describe "#clean_paths" do describe "Specifications details" do
xit "handles Pods which return different file patterns per platform" do
end end
#--------------------------------------# xit "handles Pods with multiple subspecs activated" do
describe "#used_files" do end
end end
#--------------------------------------# end
#-------------------------------------------------------------------------#
describe "#header_mappings" do describe "Private Helpers" do
xit "can handle the mappings headers of subspecs" do xit "returns the clean paths" do
@installer.send(:download_source)
@installer.send(:clean_paths).should == []
end
xit "returns the used files" do
@installer.send(:download_source)
@installer.send(:used_files).should == []
end end
xit "returns the header mappings" do
end end
#--------------------------------------# xit "returns the header mappings including subspecs" do
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