aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/cleanup.rb14
-rw-r--r--Library/Homebrew/cmd/diy.rb8
-rw-r--r--Library/Homebrew/cmd/info.rb7
-rw-r--r--Library/Homebrew/cmd/install.rb10
-rw-r--r--Library/Homebrew/cmd/reinstall.rb9
-rw-r--r--Library/Homebrew/cmd/search.rb7
6 files changed, 26 insertions, 29 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index a9d3fbcde..6e0915c9a 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -22,13 +22,13 @@ module Homebrew
ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f }
end
- if Cleanup.disk_cleanup_size > 0
- disk_space = disk_usage_readable(Cleanup.disk_cleanup_size)
- if ARGV.dry_run?
- ohai "This operation would free approximately #{disk_space} of disk space."
- else
- ohai "This operation has freed approximately #{disk_space} of disk space."
- end
+ return if Cleanup.disk_cleanup_size.zero?
+
+ disk_space = disk_usage_readable(Cleanup.disk_cleanup_size)
+ if ARGV.dry_run?
+ ohai "This operation would free approximately #{disk_space} of disk space."
+ else
+ ohai "This operation has freed approximately #{disk_space} of disk space."
end
end
end
diff --git a/Library/Homebrew/cmd/diy.rb b/Library/Homebrew/cmd/diy.rb
index 8262352f8..95ec7fe35 100644
--- a/Library/Homebrew/cmd/diy.rb
+++ b/Library/Homebrew/cmd/diy.rb
@@ -31,11 +31,9 @@ module Homebrew
def detect_version(path)
version = path.version.to_s
- if version.empty?
- raise "Couldn't determine version, set it with --version=<version>"
- else
- version
- end
+ raise "Couldn't determine version, set it with --version=<version>" if version.empty?
+
+ version
end
def detect_name(path, version)
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 2474aad57..09c832203 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -54,11 +54,8 @@ module Homebrew
end
rescue FormulaUnavailableError
# No formula with this name, try a blacklist lookup
- if (blacklist = blacklisted?(f))
- puts blacklist
- else
- raise
- end
+ raise unless (blacklist = blacklisted?(f))
+ puts blacklist
end
end
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 50439ccf9..0a6dd5a46 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -245,11 +245,11 @@ module Homebrew
end
def check_macports
- unless MacOS.macports_or_fink.empty?
- opoo "It appears you have MacPorts or Fink installed."
- puts "Software installed with other package managers causes known problems for"
- puts "Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again."
- end
+ return if MacOS.macports_or_fink.empty?
+
+ opoo "It appears you have MacPorts or Fink installed."
+ puts "Software installed with other package managers causes known problems for"
+ puts "Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again."
end
def check_cellar
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index e51aace2a..bda6022bf 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -58,10 +58,11 @@ module Homebrew
def restore_backup(keg, formula)
path = backup_path(keg)
- if path.directory?
- path.rename keg
- keg.link unless formula.keg_only?
- end
+
+ return unless path.directory?
+
+ path.rename keg
+ keg.link unless formula.keg_only?
end
def backup_path(path)
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 3f00e8a10..aa80ec589 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -171,10 +171,11 @@ module Homebrew
rescue
canonical_name = canonical_full_name = name
end
+
# Ignore aliases from results when the full name was also found
- if aliases.include?(name) && results.include?(canonical_full_name)
- next
- elsif (HOMEBREW_CELLAR/canonical_name).directory?
+ next if aliases.include?(name) && results.include?(canonical_full_name)
+
+ if (HOMEBREW_CELLAR/canonical_name).directory?
pretty_installed(name)
else
name