Commit b2fcbbb2 authored by Fabio Pelosin's avatar Fabio Pelosin

[PodSourceInstaller] Minor tweaks

parent 1168e907
......@@ -8,9 +8,6 @@ module Pod
#
class PodSourceInstaller
# TODO: local option specs.
# TODO: add tests for multi platform / subspecs issues.
# @return [Sandbox]
#
attr_reader :sandbox
......@@ -27,10 +24,16 @@ module Pod
@sandbox = sandbox
@specs_by_platform = specs_by_platform
@clean = true
@generate_docs = false
@install_docs = false
@agressive_cache = false
@clean = true
@generate_docs = false
@install_docs = false
@aggressive_cache = false
end
# @return [String] A string suitable for debugging.
#
def inspect
"<#{self.class} sandbox=#{sandbox.root} pod=#{root_spec.name}"
end
#-----------------------------------------------------------------------#
......@@ -57,15 +60,6 @@ module Pod
attr_accessor :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
# Pod.
#
......@@ -78,6 +72,15 @@ module Pod
attr_accessor :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
......@@ -195,7 +198,7 @@ module Pod
@downloader = self.class.downloader_class.for_target(root, root_spec.source.dup)
@downloader.cache_root = CACHE_ROOT
@downloader.max_cache_size = MAX_CACHE_SIZE
@downloader.agressive_cache = agressive_cache?
@downloader.aggressive_cache = aggressive_cache?
@downloader
end
......@@ -324,7 +327,7 @@ module Pod
#
def header_mappings(headers_sandbox, consumer, headers)
dir = headers_sandbox
dir = base_dir + consumer.header_dir if consumer.header_dir
dir = dir + consumer.header_dir if consumer.header_dir
mappings = {}
headers.each do |header|
......
......@@ -3,9 +3,32 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod
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
# 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
it "doesn't installs the docs by default" do
@installer.should.not.install_docs?
end
it "doesn't use an aggressive cache by default" do
@installer.should.not.aggressive_cache?
end
end
......@@ -13,13 +36,6 @@ module Pod
describe "Installation" 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 "Download" do
it "downloads the source" do
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :tag => 'v1.0' }
......@@ -40,7 +56,7 @@ module Pod
it "returns the checkout options of the downloader if any" do
@spec.source = { :git => SpecHelper.fixture('banana-lib'), :branch => 'topicbranch' }
@installer.install!
@installer.install!
@installer.specific_source[:commit].should == "446b22414597f1bb4062a62c4eed7af9627a3f1b"
pod_folder = config.sandbox.root + 'BananaLib'
pod_folder.should.exist
......@@ -124,35 +140,72 @@ module Pod
end
end
#--------------------------------------#
#-------------------------------------------------------------------------#
describe "Options" do
describe "Private Helpers" 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
describe "#clean_paths" do
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
end
#--------------------------------------#
describe "#used_files" do
describe "Specifications details" do
xit "handles Pods which return different file patterns per platform" do
end
xit "handles Pods with multiple subspecs activated" do
end
end
#--------------------------------------#
end
describe "#header_mappings" do
#-------------------------------------------------------------------------#
xit "can handle the mappings headers of subspecs" do
describe "Private Helpers" do
end
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
#--------------------------------------#
xit "returns the header mappings" do
end
xit "returns the header mappings including subspecs" do
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