Skip to content

Commit

Permalink
Merge pull request #87 from paulyoung/deprecated-attributes
Browse files Browse the repository at this point in the history
Deprecated attributes
  • Loading branch information
fabiopelosin committed Apr 2, 2014
2 parents 1801fa2 + 0faf37b commit 57e0ae3
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
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

0 comments on commit 57e0ae3

Please sign in to comment.