Permalink
Browse files

[Linter/Push] Properly singularize words in output.

Closes #550.
  • Loading branch information...
1 parent e05f59f commit fd03adf9c9c6fb5da4ca87168ce709fe18078f74 @fabiopelosin fabiopelosin committed Oct 10, 2012
Showing with 13 additions and 4 deletions.
  1. +10 −3 lib/cocoapods/command/push.rb
  2. +3 −1 lib/cocoapods/command/spec.rb
@@ -1,4 +1,5 @@
require 'fileutils'
+require 'active_support/core_ext/string/inflections'
module Pod
class Command
@@ -66,12 +67,18 @@ def check_repo_status
def podspec_files
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
end
+ # @return [Integer] The number of the podspec files to push.
+ #
+ def count
+ podspec_files.count
+ end
+
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 << "--only-errors" if @allow_warnings
lint_argv << "--silent" if config.silent
@@ -82,7 +89,7 @@ def validate_podspec_files
end
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|
spec = Pod::Specification.from_file(spec_file)
output_path = File.join(repo_dir, spec.name, spec.version.to_s)
@@ -1,5 +1,7 @@
# encoding: utf-8
+require 'active_support/core_ext/string/inflections'
+
module Pod
class Command
class Spec < Command
@@ -104,8 +106,8 @@ def lint
UI.puts unless config.silent?
end
- UI.puts "Analyzed #{podspecs_to_lint.count} podspecs files.\n\n" unless config.silent?
count = podspecs_to_lint.count
+ UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n" unless config.silent?
if invalid_count == 0
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?

0 comments on commit fd03adf

Please sign in to comment.