Commit fd03adf9 authored by Fabio Pelosin's avatar Fabio Pelosin

[Linter/Push] Properly singularize words in output.

Closes #550.
parent e05f59fc
require 'fileutils' require 'fileutils'
require 'active_support/core_ext/string/inflections'
module Pod module Pod
class Command class Command
...@@ -66,12 +67,18 @@ module Pod ...@@ -66,12 +67,18 @@ module Pod
def podspec_files def podspec_files
files = Pathname.glob(@podspec || "*.podspec") files = Pathname.glob(@podspec || "*.podspec")
raise Informative, "[!] Couldn't find .podspec file in current directory".red if files.empty? raise Informative, "[!] Couldn't find any .podspec file in current directory".red if files.empty?
files files
end end
# @return [Integer] The number of the podspec files to push.
#
def count
podspec_files.count
end
def validate_podspec_files def validate_podspec_files
UI.puts "\nValidating specs".yellow unless config.silent UI.puts "\nValidating #{'spec'.pluralize(count)}".yellow unless config.silent
lint_argv = ["lint"] lint_argv = ["lint"]
lint_argv << "--only-errors" if @allow_warnings lint_argv << "--only-errors" if @allow_warnings
lint_argv << "--silent" if config.silent lint_argv << "--silent" if config.silent
...@@ -82,7 +89,7 @@ module Pod ...@@ -82,7 +89,7 @@ module Pod
end end
def add_specs_to_repo def add_specs_to_repo
UI.puts "\nAdding the specs to the #{@repo} repo\n".yellow unless config.silent UI.puts "\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\n".yellow unless config.silent
podspec_files.each do |spec_file| podspec_files.each do |spec_file|
spec = Pod::Specification.from_file(spec_file) spec = Pod::Specification.from_file(spec_file)
output_path = File.join(repo_dir, spec.name, spec.version.to_s) output_path = File.join(repo_dir, spec.name, spec.version.to_s)
......
# encoding: utf-8 # encoding: utf-8
require 'active_support/core_ext/string/inflections'
module Pod module Pod
class Command class Command
class Spec < Command class Spec < Command
...@@ -104,8 +106,8 @@ module Pod ...@@ -104,8 +106,8 @@ module Pod
UI.puts unless config.silent? UI.puts unless config.silent?
end end
UI.puts "Analyzed #{podspecs_to_lint.count} podspecs files.\n\n" unless config.silent?
count = podspecs_to_lint.count count = podspecs_to_lint.count
UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n" unless config.silent?
if invalid_count == 0 if invalid_count == 0
lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : "All the specs passed validation." lint_passed_message = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : "All the specs passed validation."
UI.puts lint_passed_message.green << "\n\n" unless config.silent? UI.puts lint_passed_message.green << "\n\n" unless config.silent?
......
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