Commit 4d615109 authored by Fabio Pelosin's avatar Fabio Pelosin

[Installer] Respect config.clean?

parent cfd10bfb
...@@ -243,7 +243,6 @@ module Pod ...@@ -243,7 +243,6 @@ module Pod
@pod_installers ||= [] @pod_installers ||= []
pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform) pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform)
pod_installer.clean = config.clean?
pod_installer.aggressive_cache = config.aggressive_cache? pod_installer.aggressive_cache = config.aggressive_cache?
pod_installer.generate_docs = config.generate_docs? pod_installer.generate_docs = config.generate_docs?
pod_installer.install_docs = config.install_docs? pod_installer.install_docs = config.install_docs?
...@@ -252,7 +251,12 @@ module Pod ...@@ -252,7 +251,12 @@ module Pod
@installed_specs.concat(specs_by_platform.values.flatten) @installed_specs.concat(specs_by_platform.values.flatten)
end end
# Cleans the sources of the Pods if the config instructs to do so.
#
# @todo Why the @pod_installers might be empty?
#
def clean_pod_sources def clean_pod_sources
return unless config.clean?
return unless @pod_installers return unless @pod_installers
@pod_installers.each do |pod_installer| @pod_installers.each do |pod_installer|
pod_installer.clean! pod_installer.clean!
......
...@@ -24,7 +24,6 @@ module Pod ...@@ -24,7 +24,6 @@ module Pod
@sandbox = sandbox @sandbox = sandbox
@specs_by_platform = specs_by_platform @specs_by_platform = specs_by_platform
@clean = true
@generate_docs = false @generate_docs = false
@install_docs = false @install_docs = false
@aggressive_cache = false @aggressive_cache = false
...@@ -42,12 +41,6 @@ module Pod ...@@ -42,12 +41,6 @@ module Pod
# @!group Configuration # @!group Configuration
# @return [Bool] whether the file not used by CocoaPods should be
# removed.
#
attr_accessor :clean
alias_method :clean?, :clean
# @return [Bool] whether the documentation should be generated for the # @return [Bool] whether the documentation should be generated for the
# Pod. # Pod.
# #
...@@ -92,7 +85,7 @@ module Pod ...@@ -92,7 +85,7 @@ module Pod
# @return [void] # @return [void]
# #
def clean! def clean!
clean_installation if clean? && !local? clean_installation if !local?
end end
# @return [Hash] # @return [Hash]
...@@ -133,10 +126,6 @@ module Pod ...@@ -133,10 +126,6 @@ module Pod
# @return [void] # @return [void]
# #
def generate_docs def generate_docs
if @cleaned
raise Informative, "Attempt to generate the documentation from a cleaned Pod."
end
if documentation_generator.already_installed? if documentation_generator.already_installed?
UI.section " > Using existing documentation" UI.section " > Using existing documentation"
else else
...@@ -153,7 +142,6 @@ module Pod ...@@ -153,7 +142,6 @@ module Pod
# #
def clean_installation def clean_installation
clean_paths.each { |path| FileUtils.rm_rf(path) } clean_paths.each { |path| FileUtils.rm_rf(path) }
@cleaned = true
end end
#-----------------------------------------------------------------------# #-----------------------------------------------------------------------#
......
...@@ -14,10 +14,6 @@ module Pod ...@@ -14,10 +14,6 @@ module Pod
describe "In General" do describe "In General" do
it "cleans by default" do
@installer.should.clean?
end
it "doesn't generate docs by default" do it "doesn't generate docs by default" do
@installer.should.not.generate_docs? @installer.should.not.generate_docs?
end end
...@@ -105,7 +101,6 @@ module Pod ...@@ -105,7 +101,6 @@ module Pod
describe "Cleaning" do describe "Cleaning" do
it "cleans the paths non used by the installation" do it "cleans the paths non used by the installation" do
@installer.clean = true
@installer.install! @installer.install!
@installer.clean! @installer.clean!
unused_file = config.sandbox.root + 'BananaLib/sub-dir/sub-dir-2/somefile.txt' unused_file = config.sandbox.root + 'BananaLib/sub-dir/sub-dir-2/somefile.txt'
...@@ -113,21 +108,12 @@ module Pod ...@@ -113,21 +108,12 @@ module Pod
end end
it "preserves important files like the LICENSE and the README" do it "preserves important files like the LICENSE and the README" do
@installer.clean = true
@installer.install! @installer.install!
@installer.clean! @installer.clean!
readme_file = config.sandbox.root + 'BananaLib/README' readme_file = config.sandbox.root + 'BananaLib/README'
readme_file.should.exist readme_file.should.exist
end end
it "doesn't performs any cleaning if instructed to do so" do
@installer.clean = false
@installer.install!
@installer.clean!
unused_file = config.sandbox.root + 'BananaLib/sub-dir/sub-dir-2/somefile.txt'
unused_file.should.exist
end
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -181,8 +181,21 @@ module Pod ...@@ -181,8 +181,21 @@ module Pod
@installer.installed_specs.should == [spec] @installer.installed_specs.should == [spec]
end end
#--------------------------------------#
describe "#clean" do
it "it cleans only if the config instructs to do it" do
config.clean = false
@installer.send(:clean_pod_sources)
Installer::PodSourceInstaller.any_instance.expects(:install!).never
end
end end
#--------------------------------------#
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