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

[Specification DSL] default_subspecs is only allowed at root level #305

Merged
merged 5 commits into from
Feb 4, 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
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