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

Deprecated attributes #87

Merged
merged 3 commits into from
Apr 2, 2014
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
[Joshua Kalpin][Kapin]
[#50](https://github.com/CocoaPods/Core/pull/50)

* Added `deprecated` and `deprecated_in_favor_of` attributes to Specification
DSL.
[Paul Young](https://github.com/paulyoung)
[#87](https://github.com/CocoaPods/Core/pull/87)

## 0.31.1

##### Enhancements
Expand Down
32 changes: 32 additions & 0 deletions lib/cocoapods-core/specification/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,38 @@ module DSL
#
root_attribute :prepare_command

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

# @!method deprecated=(flag)
#
# Whether the library has been deprecated.
#
# @example
#
# spec.deprecated = true
#
# @param [Bool] flag
# whether the library has been deprecated.
#
root_attribute :deprecated, {
:types => [TrueClass, FalseClass],
:default_value => false,
}

# @!method deprecated_in_favor_of=(deprecated_in_favor_of)
#
# The name of the Pod that this one has been deprecated in favor of.
#
# @example
#
# spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
#
# @param [String] deprecated_in_favor_of
# the name of the Pod that this one has been deprecated in
# favor of.
#
root_attribute :deprecated_in_favor_of

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

# @!group Platform
Expand Down
13 changes: 13 additions & 0 deletions lib/cocoapods-core/specification/root_attribute_accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ def prepare_command
command.strip_heredoc.chomp if command
end

# @return [Bool] Whether the Pod has been deprecated.
#
def deprecated
attributes_hash["deprecated"]
end

# @return [String] The name of the Pod that this one has been
# deprecated in favor of.
#
def deprecated_in_favor_of
attributes_hash["deprecated_in_favor_of"]
end

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

private
Expand Down
10 changes: 10 additions & 0 deletions spec/specification/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ module Pod
@spec.prepare_command = "ruby build_files.rb"
@spec.attributes_hash["prepare_command"].should == "ruby build_files.rb"
end

it "allows to specify whether the Pod has been deprecated" do
@spec.deprecated = true
@spec.attributes_hash["deprecated"].should == true
end

it "allows to specify the name of the Pod that this one has been deprecated in favor of" do
@spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
@spec.attributes_hash["deprecated_in_favor_of"].should == 'NewMoreAwesomePod'
end
end

#-----------------------------------------------------------------------------#
Expand Down
10 changes: 10 additions & 0 deletions spec/specification/root_attribute_accessors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,15 @@ module Pod
@spec.prepare_command.should == 'ruby prepare_script.rb'
end

it "returns whether the Pod has been deprecated" do
@spec.deprecated = true
@spec.deprecated.should == true
end

it "returns the name of the Pod that this one has been deprecated in favor of" do
@spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
@spec.deprecated_in_favor_of.should == 'NewMoreAwesomePod'
end

end
end