Commit 76a401c0 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4314 from CocoaPods/seg-validator-subspec-name

[Validator] Allow specifying only the subspec name
parents 187ce57c 71d3acba
......@@ -87,6 +87,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Andrea Cremaschi](https://github.com/andreacremaschi)
[#4468](https://github.com/CocoaPods/CocoaPods/issues/4468)
* Specifying relative subspec names to the linter is now supported.
[Samuel Giddins](https://github.com/segiddins)
[#1917](https://github.com/CocoaPods/CocoaPods/issues/1917)
## 0.39.0 (2015-10-09)
......
......@@ -67,7 +67,8 @@ module Pod
# Replace default spec with a subspec if asked for
a_spec = spec
if spec && @only_subspec
a_spec = spec.subspec_by_name(@only_subspec)
subspec_name = @only_subspec.start_with?(spec.root.name) ? @only_subspec : "#{spec.root.name}/#{@only_subspec}"
a_spec = spec.subspec_by_name(subspec_name)
@subspec_name = a_spec.name
end
......
......@@ -91,6 +91,36 @@ module Pod
validator.validate
validator.validation_dir.should.be == Pathname.new(Dir.tmpdir) + 'CocoaPods/Lint'
end
describe '#only_subspec' do
before do
podspec = fixture('spec-repos') + 'master/Specs/RestKit/0.22.0/RestKit.podspec.json'
@validator = Validator.new(podspec, SourcesManager.master.map(&:url))
@validator.quick = true
end
it 'handles a relative subspec name' do
@validator.only_subspec = 'CoreData'
@validator.validate
@validator.send(:subspec_name).should == 'RestKit/CoreData'
end
it 'handles an absolute subspec name' do
@validator.only_subspec = 'RestKit/CoreData'
@validator.validate
@validator.send(:subspec_name).should == 'RestKit/CoreData'
end
it 'handles a missing subspec name' do
@validator.only_subspec = 'RestKit/Missing'
should.raise(Informative) { @validator.validate }.message.
should.include 'Unable to find a specification named `RestKit/Missing`'
@validator.only_subspec = 'Missing'
should.raise(Informative) { @validator.validate }.message.
should.include 'Unable to find a specification named `RestKit/Missing`'
end
end
end
#-------------------------------------------------------------------------#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment