diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c79ccb45..ed34d02fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ [Samuel Giddins](https://github.com/segiddins) [#328](https://github.com/CocoaPods/Core/issues/328) +* Specifying multiple `post_install` hooks in a Podfile raises an error. + [Daniel Tomlinson](https://github.com/dantoml) + [#334](https://github.com/CocoaPods/Core/pull/334) + ##### Bug Fixes * None. diff --git a/lib/cocoapods-core/podfile/dsl.rb b/lib/cocoapods-core/podfile/dsl.rb index 0f768669e..ee2a48058 100644 --- a/lib/cocoapods-core/podfile/dsl.rb +++ b/lib/cocoapods-core/podfile/dsl.rb @@ -741,6 +741,7 @@ def pre_install(&block) # @return [void] # def post_install(&block) + raise Informative, 'Specifying multiple `post_install` hooks is unsupported.' if @post_install_callback @post_install_callback = block end end diff --git a/spec/podfile/dsl_spec.rb b/spec/podfile/dsl_spec.rb index 2003d9d98..9ddef4849 100644 --- a/spec/podfile/dsl_spec.rb +++ b/spec/podfile/dsl_spec.rb @@ -445,6 +445,20 @@ module Pod end.post_install!(:an_installer) yielded.should == :an_installer end + + it 'raises when post_install is called multiple times' do + should.raise(Informative) do + Podfile.new do + target 'App' do + post_install do |installer| + end + + post_install do |installer| + end + end + end + end.message.should == 'Specifying multiple `post_install` hooks is unsupported.' + end end #-------------------------------------------------------------------------#