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

Move depracted? method from Presenter to a DSL helper in specification #157

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions lib/cocoapods-core/specification/root_attribute_accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ def deprecated_in_favor_of
attributes_hash['deprecated_in_favor_of']
end

# @return [Bool] Wether the pod is deprecated either in favor of some other
# pod or simply deprecated.
#
def deprecated?
deprecated || !deprecated_in_favor_of.nil?
end

#---------------------------------------------------------------------#

private
Expand Down
9 changes: 1 addition & 8 deletions lib/cocoapods-core/specification/set/presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ def description
spec.description || spec.summary
end

# @return [Bool] Wether the pod is deprecated either in favor of some other
# pod or simply deprecated.
#
def deprecated?
spec.deprecated || !spec.deprecated_in_favor_of.nil?
end

# @return [String] A string that describes the deprecation of the pod.
# If the pod is deprecated in favor of another pod it will contain
# information about that. If the pod is not deprecated returns nil.
Expand All @@ -140,7 +133,7 @@ def deprecated?
# "[DEPRECATED in favor of NewAwesomePod]"
#
def deprecation_description
if deprecated?
if spec.deprecated?
description = "[DEPRECATED"
if spec.deprecated_in_favor_of.nil?
description += "]"
Expand Down
11 changes: 11 additions & 0 deletions spec/specification/root_attribute_accessors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,16 @@ module Pod
@spec.deprecated_in_favor_of.should == 'NewMoreAwesomePod'
end

it 'it returns wether it is deprecated either by deprecated or deprecated_in_favor_of' do
@spec.deprecated = true
@spec.deprecated?.should == true
@spec.deprecated = false

@spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
@spec.deprecated?.should == true
@spec.deprecated_in_favor_of = nil

@spec.deprecated?.should == false
end
end
end
12 changes: 0 additions & 12 deletions spec/specification/set/presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ module Pod
@presenter.sources.should == %w(master test_repo)
end

it 'returns the correct deprecation status when the spec is deprecated' do
@presenter.deprecated?.should == false
@presenter.spec.deprecated = true
@presenter.deprecated?.should == true
end

it 'returns the correct deprecation status when the spec is deprecated in favor of another pod' do
@presenter.deprecated?.should == false
@presenter.spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
@presenter.deprecated?.should == true
end

it 'returns the correct deprecation description' do
@presenter.deprecation_description.should.nil?
@presenter.spec.deprecated = true
Expand Down