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

[Installer] Respect config.clean?

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