Commit b241c56f authored by Fabio Pelosin's avatar Fabio Pelosin
parent 96b9bad9
...@@ -7,7 +7,7 @@ GIT ...@@ -7,7 +7,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Core.git remote: https://github.com/CocoaPods/Core.git
revision: d7ffa0b6464370ee20805c7c53ed36509ad072bb revision: 15a071e1be2cf9ba0f56ab3fe1dc8ac14f6bd9ec
branch: master branch: master
specs: specs:
cocoapods-core (0.32.1) cocoapods-core (0.32.1)
......
...@@ -495,42 +495,11 @@ module Pod ...@@ -495,42 +495,11 @@ module Pod
# #
def run_pre_install_hooks def run_pre_install_hooks
UI.message "- Running pre install hooks" do UI.message "- Running pre install hooks" do
analysis_result.specifications.each do |spec|
executed = false
libraries_using_spec(spec).each do |lib|
lib_representation = library_rep(lib)
executed ||= run_spec_pre_install_hook(spec, lib_representation)
end
UI.message "- #{spec.name}" if executed
end
executed = run_podfile_pre_install_hook executed = run_podfile_pre_install_hook
UI.message "- Podfile" if executed UI.message "- Podfile" if executed
end end
end end
# Runs the pre install hook of the given specification with the given
# library representation.
#
# @param [Specification] spec
# The spec for which the pre install hook should be run.
#
# @param [Hooks::LibraryRepresentation] lib_representation
# The library representation to be passed as an argument to the
# hook.
#
# @raise Raises an informative if the hooks raises.
#
# @return [Bool] Whether the hook was run.
#
def run_spec_pre_install_hook(spec, lib_representation)
spec.pre_install!(pod_rep(spec.root.name), lib_representation)
rescue => e
raise Informative, "An error occurred while processing the pre-install " \
"hook of #{spec}." \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
# Runs the pre install hook of the Podfile # Runs the pre install hook of the Podfile
# #
# @raise Raises an informative if the hooks raises. # @raise Raises an informative if the hooks raises.
...@@ -554,42 +523,11 @@ module Pod ...@@ -554,42 +523,11 @@ module Pod
# #
def run_post_install_hooks def run_post_install_hooks
UI.message "- Running post install hooks" do UI.message "- Running post install hooks" do
analysis_result.specifications.each do |spec|
executed = false
libraries_using_spec(spec).each do |lib|
lib_representation = library_rep(lib)
executed ||= run_spec_post_install_hook(spec, lib_representation)
end
UI.message "- #{spec.name}" if executed
end
executed = run_podfile_post_install_hook executed = run_podfile_post_install_hook
UI.message "- Podfile" if executed UI.message "- Podfile" if executed
end end
end end
# Runs the post install hook of the given specification with the given
# library representation.
#
# @param [Specification] spec
# The spec for which the post install hook should be run.
#
# @param [Hooks::LibraryRepresentation] lib_representation
# The library representation to be passed as an argument to the
# hook.
#
# @raise Raises an informative if the hooks raises.
#
# @return [Bool] Whether the hook was run.
#
def run_spec_post_install_hook(spec, lib_representation)
spec.post_install!(lib_representation)
rescue => e
raise Informative, "An error occurred while processing the post-install " \
"hook of #{spec}." \
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
end
# Runs the post install hook of the Podfile # Runs the post install hook of the Podfile
# #
# @raise Raises an informative if the hooks raises. # @raise Raises an informative if the hooks raises.
......
Subproject commit 367aaee9111972a40d0569155f40cf6bb63e4634 Subproject commit 801c5e9bb1d9f2ca11ebba09013c7c8a4329d780
...@@ -360,13 +360,6 @@ describe "Integration" do ...@@ -360,13 +360,6 @@ describe "Integration" do
describe "Runs the Podfile callbacks" do describe "Runs the Podfile callbacks" do
check "install --no-repo-update", "install_podfile_callbacks" check "install --no-repo-update", "install_podfile_callbacks"
end end
# @todo add tests for all the hooks API
#
describe "Runs the specification callbacks" do
check "install --no-repo-update", "install_spec_callbacks"
end
end end
#--------------------------------------# #--------------------------------------#
......
...@@ -491,9 +491,6 @@ module Pod ...@@ -491,9 +491,6 @@ module Pod
library_rep = stub() library_rep = stub()
@installer.expects(:installer_rep).returns(installer_rep) @installer.expects(:installer_rep).returns(installer_rep)
@installer.expects(:pod_rep).with('JSONKit').returns(pod_rep)
@installer.expects(:library_rep).with(@aggregate_target).returns(library_rep)
@spec.expects(:pre_install!)
@installer.podfile.expects(:pre_install!).with(installer_rep) @installer.podfile.expects(:pre_install!).with(installer_rep)
@installer.send(:run_pre_install_hooks) @installer.send(:run_pre_install_hooks)
end end
...@@ -503,8 +500,6 @@ module Pod ...@@ -503,8 +500,6 @@ module Pod
target_installer_data = stub() target_installer_data = stub()
@installer.expects(:installer_rep).returns(installer_rep) @installer.expects(:installer_rep).returns(installer_rep)
@installer.expects(:library_rep).with(@aggregate_target).returns(target_installer_data)
@spec.expects(:post_install!)
@installer.podfile.expects(:post_install!).with(installer_rep) @installer.podfile.expects(:post_install!).with(installer_rep)
@installer.send(:run_post_install_hooks) @installer.send(:run_post_install_hooks)
end end
...@@ -520,11 +515,7 @@ module Pod ...@@ -520,11 +515,7 @@ module Pod
@installer.stubs(:pod_targets).returns([pod_target_ios, pod_target_osx]) @installer.stubs(:pod_targets).returns([pod_target_ios, pod_target_osx])
@installer.stubs(:installer_rep).returns(stub()) @installer.stubs(:installer_rep).returns(stub())
@installer.stubs(:library_rep).with(@aggregate_target).returns(target_installer_data).twice
@installer.podfile.expects(:pre_install!) @installer.podfile.expects(:pre_install!)
@spec.expects(:post_install!).with(target_installer_data).once
@installer.send(:run_pre_install_hooks) @installer.send(:run_pre_install_hooks)
@installer.send(:run_post_install_hooks) @installer.send(:run_post_install_hooks)
end end
...@@ -561,9 +552,7 @@ module Pod ...@@ -561,9 +552,7 @@ module Pod
libs = @installer.send(:libraries_using_spec, @spec) libs = @installer.send(:libraries_using_spec, @spec)
libs.map(&:name).should == ['Pods'] libs.map(&:name).should == ['Pods']
end end
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