Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSL] Raise when specifying multiple post_install hooks #334

Merged
merged 2 commits into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions lib/cocoapods-core/podfile/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions spec/podfile/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

#-------------------------------------------------------------------------#
Expand Down