Skip to content

Commit

Permalink
Merge pull request #305 from CocoaPods/mr-fix-subspecs-default
Browse files Browse the repository at this point in the history
[Specification DSL] default_subspecs is only allowed at root level
  • Loading branch information
mrackwitz committed Feb 4, 2016
2 parents b11d2c3 + 7b37513 commit 2cc334e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

##### Enhancements

* None.
* The linter rejects `default_subspecs` defined in subspecs of podspecs.
They were never taken into account for subspecs.
[Marius Rackwitz](https://github.com/mrackwitz)
[Core#305](https://github.com/CocoaPods/Core/pull/305)

##### Bug Fixes

Expand Down
5 changes: 4 additions & 1 deletion lib/cocoapods-core/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def subspec_by_name(relative_name, raise_if_missing = true)
end
end

# @return [Array] the name of the default subspecs if provided.
# @return [Array<String>] the name of the default subspecs if provided.
#
def default_subspecs
# TODO: remove singular form and update the JSON specs.
Expand All @@ -259,6 +259,9 @@ def default_subspecs
# {#default_subspecs} or each of its children subspecs that are
# compatible with its platform.
#
# @param [Platform] platform
# return only dependencies supported on the given platform.
#
# @return [Array<Dependency>] the dependencies on subspecs.
#
def subspec_dependencies(platform = nil)
Expand Down
3 changes: 2 additions & 1 deletion lib/cocoapods-core/specification/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,8 @@ def subspec(name, &block)
attribute :default_subspecs,
:container => Array,
:singularize => true,
:multi_platform => false
:multi_platform => false,
:root_only => true

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

Expand Down
2 changes: 1 addition & 1 deletion spec/specification/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module Pod
@spec.attributes_hash['platforms']['ios'].should == '6.0'
end

it "doesnt' allows to specify the deployment target without a platform" do
it "doesn't allows to specify the deployment target without a platform" do
e = lambda { @spec.deployment_target = '6.0' }.should.raise Informative
e.message.should.match /declared only per platform/
end
Expand Down
7 changes: 7 additions & 0 deletions spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,13 @@ def result_should_include(*values)
@subspec.module_map = 'subspec.modulemap'
result_should_include('module_map', 'can\'t set', 'for subspecs')
end

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

it 'fails a specification with a subspec with default subspecs' do
@subspec.default_subspecs = 'Spec'
result_should_include('default_subspecs', 'can\'t set', 'for subspecs')
end
end
end
end

0 comments on commit 2cc334e

Please sign in to comment.