Commit f92bab08 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge pull request #1635 from opentable/multi-liblint

Enhance pod lib lint to support multiple Spec files in the folder
parents c407fe67 50a39b3c
......@@ -30,6 +30,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Florian Hanke](https://github.com/floere)
[#1643][https://github.com/CocoaPods/CocoaPods/pull/1643]
* pod lib lint now accepts multiple podspecs in the same folder.
[kra Larivain/OpenTable](https://github.com/opentable)
[#1635](https://github.com/CocoaPods/CocoaPods/pull/1635)
###### Bug Fixes
* Fixed a bug which resulted in `pod lib lint` not being able to find the
......
......@@ -97,6 +97,7 @@ module Pod
@quick = argv.flag?('quick')
@only_errors = argv.flag?('only-errors')
@clean = argv.flag?('clean', true)
@podspecs_paths = argv.arguments!
super
end
......@@ -106,27 +107,29 @@ module Pod
def run
UI.puts
validator = Validator.new(podspec_to_lint)
validator.local = true
validator.quick = @quick
validator.no_clean = !@clean
validator.only_errors = @only_errors
validator.validate
unless @clean
UI.puts "Pods project available at `#{validator.validation_dir}/Pods/Pods.xcodeproj` for inspection."
UI.puts
end
if validator.validated?
UI.puts "#{validator.spec.name} passed validation.".green
else
message = "#{validator.spec.name} did not pass validation."
if @clean
message << "\nYou can use the `--no-clean` option to inspect " \
"any issue."
podspecs_to_lint.each do |podspec|
validator = Validator.new(podspec)
validator.local = true
validator.quick = @quick
validator.no_clean = !@clean
validator.only_errors = @only_errors
validator.validate
unless @clean
UI.puts "Pods project available at `#{validator.validation_dir}/Pods/Pods.xcodeproj` for inspection."
UI.puts
end
if validator.validated?
UI.puts "#{validator.spec.name} passed validation.".green
else
message = "#{validator.spec.name} did not pass validation."
if @clean
message << "\nYou can use the `--no-clean` option to inspect " \
"any issue."
end
raise Informative, message
end
raise Informative, message
end
end
......@@ -142,11 +145,14 @@ module Pod
# @raise If no podspec is found.
# @raise If multiple podspecs are found.
#
def podspec_to_lint
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}')
raise Informative, "Unable to find a podspec in the working directory" if podspecs.count.zero?
raise Informative, "Multiple podspecs detected in the working directory" if podspecs.count > 1
podspecs.first
def podspecs_to_lint
if !@podspecs_paths.empty? then
Array(@podspecs_paths)
else
podspecs = Pathname.glob(Pathname.pwd + '*.podspec{.yaml,}')
raise Informative, "Unable to find a podspec in the working directory" if podspecs.count.zero?
podspecs
end
end
end
......
......@@ -12,5 +12,23 @@ module Pod
lambda { run_command('lib', 'create', 'Pod Name With Spaces') }.should.raise CLAide::Help
end
end
describe Command::Lib::Lint do
it "lints the current working directory" do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
end
end
it "lints a single spec in the current working directory" do
Dir.chdir(fixture('integration/Reachability')) do
cmd = command('lib', 'lint', 'Reachability.podspec', '--quick', '--only-errors')
cmd.run
UI.output.should.include "passed validation"
end
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