diff --git a/CHANGELOG.md b/CHANGELOG.md index 56a45f0b0..af1359d2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/cocoapods-core/specification.rb b/lib/cocoapods-core/specification.rb index dd70c0873..082e49347 100644 --- a/lib/cocoapods-core/specification.rb +++ b/lib/cocoapods-core/specification.rb @@ -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] the name of the default subspecs if provided. # def default_subspecs # TODO: remove singular form and update the JSON specs. @@ -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] the dependencies on subspecs. # def subspec_dependencies(platform = nil) diff --git a/lib/cocoapods-core/specification/dsl.rb b/lib/cocoapods-core/specification/dsl.rb index 3451e1626..b4d00e83b 100644 --- a/lib/cocoapods-core/specification/dsl.rb +++ b/lib/cocoapods-core/specification/dsl.rb @@ -1349,7 +1349,8 @@ def subspec(name, &block) attribute :default_subspecs, :container => Array, :singularize => true, - :multi_platform => false + :multi_platform => false, + :root_only => true #-----------------------------------------------------------------------# diff --git a/spec/specification/dsl_spec.rb b/spec/specification/dsl_spec.rb index 729346369..7a5743e25 100644 --- a/spec/specification/dsl_spec.rb +++ b/spec/specification/dsl_spec.rb @@ -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 diff --git a/spec/specification/linter_spec.rb b/spec/specification/linter_spec.rb index e70d039c2..b934c6720 100644 --- a/spec/specification/linter_spec.rb +++ b/spec/specification/linter_spec.rb @@ -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