aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2014-05-26 11:19:00 -0700
committerAdam Vandenberg2014-05-26 18:33:31 -0700
commite2ed77e058060ec6da080ed492ba591e09abbf0e (patch)
treec64ec9da7f46d9def0f67b64c0e84e0225ccab3a
parentd31db8b415ab26798dc71b77009c3a0149223de0 (diff)
downloadhomebrew-e2ed77e058060ec6da080ed492ba591e09abbf0e.tar.bz2
pluralize formulae in tap/untap
Closes #28560.
-rw-r--r--Library/Homebrew/cmd/tap.rb6
-rw-r--r--Library/Homebrew/cmd/untap.rb2
-rw-r--r--Library/Homebrew/cmd/upgrade.rb10
-rw-r--r--Library/Homebrew/utils.rb4
4 files changed, 10 insertions, 12 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index 80ebcd81e..3084ea1ab 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -27,7 +27,7 @@ module Homebrew extend self
files = []
tapd.find_formula { |file| files << file }
link_tap_formula(files)
- puts "Tapped #{files.length} formula"
+ puts "Tapped #{files.length} formula#{plural(files.length, 'e')}"
if private_tap?(repouser, repo) then puts <<-EOS.undent
It looks like you tapped a private repository. To avoid entering your
@@ -77,7 +77,7 @@ module Homebrew extend self
count += 1
end
end
- puts "Pruned #{count} dead formula"
+ puts "Pruned #{count} dead formula#{plural(count, 'e')}"
return unless HOMEBREW_REPOSITORY.join("Library/Taps").exist?
@@ -89,7 +89,7 @@ module Homebrew extend self
count += link_tap_formula(files)
end
- puts "Tapped #{count} formula"
+ puts "Tapped #{count} formula#{plural(count, 'e')}"
end
private
diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb
index bba10b07a..b71d44841 100644
--- a/Library/Homebrew/cmd/untap.rb
+++ b/Library/Homebrew/cmd/untap.rb
@@ -22,7 +22,7 @@ module Homebrew extend self
unlink_tap_formula(files)
tapd.rmtree
tapd.dirname.rmdir_if_possible
- puts "Untapped #{files.length} formula"
+ puts "Untapped #{files.length} formula#{plural(files.length, 'e')}"
end
def unlink_tap_formula paths
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 205de517d..1f9330beb 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -1,12 +1,6 @@
require 'cmd/install'
require 'cmd/outdated'
-class Fixnum
- def plural_s
- if self != 1 then "s" else "" end
- end
-end
-
module Homebrew extend self
def upgrade
Homebrew.perform_preinstall_checks
@@ -35,14 +29,14 @@ module Homebrew extend self
end
unless outdated.empty?
- oh1 "Upgrading #{outdated.length} outdated package#{outdated.length.plural_s}, with result:"
+ oh1 "Upgrading #{outdated.length} outdated package#{plural(outdated.length)}, with result:"
puts outdated.map{ |f| "#{f.name} #{f.pkg_version}" } * ", "
else
oh1 "No packages to upgrade"
end
unless upgrade_pinned? || pinned.empty?
- oh1 "Not upgrading #{pinned.length} pinned package#{pinned.length.plural_s}:"
+ oh1 "Not upgrading #{pinned.length} pinned package#{plural(pinned.length)}:"
puts pinned.map{ |f| "#{f.name} #{f.pkg_version}" } * ", "
end
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index ac84c1602..36b30d857 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -78,6 +78,10 @@ def pretty_duration s
return "%.1f minutes" % (s/60)
end
+def plural n, s="s"
+ (n == 1) ? "" : s
+end
+
def interactive_shell f=nil
unless f.nil?
ENV['HOMEBREW_DEBUG_PREFIX'] = f.prefix