Use ActiveSupport Object#blank? and #present?
This commit is contained in:
parent
a4d9b4816d
commit
955214abc0
@ -75,7 +75,7 @@ module Cask
|
||||
|
||||
ohai "Homebrew Cask Taps:"
|
||||
[default_tap, *alt_taps].each do |tap|
|
||||
if tap.path.nil? || tap.path.to_s.empty?
|
||||
if tap.path.blank?
|
||||
puts none_string
|
||||
else
|
||||
puts "#{tap.path} (#{cask_count_for_tap(tap)})"
|
||||
|
||||
@ -961,7 +961,7 @@ module Homebrew
|
||||
def audit_version
|
||||
if version.nil?
|
||||
problem "missing version"
|
||||
elsif version.to_s.empty?
|
||||
elsif version.blank?
|
||||
problem "version is set to an empty string"
|
||||
elsif !version.detected_from_url?
|
||||
version_text = version
|
||||
|
||||
@ -453,7 +453,7 @@ module Homebrew
|
||||
tag = tag.to_s.delete ":"
|
||||
|
||||
unless tag.empty?
|
||||
if !bottle_hash["bottle"]["tags"][tag].to_s.empty?
|
||||
if bottle_hash["bottle"]["tags"][tag].present?
|
||||
mismatches << "#{key} => #{tag}"
|
||||
else
|
||||
bottle.send(key, old_value => tag.to_sym)
|
||||
|
||||
@ -1109,7 +1109,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
|
||||
def source_modified_time
|
||||
out, = system_command("bzr", args: ["log", "-l", "1", "--timezone=utc", cached_location])
|
||||
timestamp = out.chomp
|
||||
raise "Could not get any timestamps from bzr!" if timestamp.to_s.empty?
|
||||
raise "Could not get any timestamps from bzr!" if timestamp.blank?
|
||||
Time.parse(timestamp)
|
||||
end
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
def check_xdg_data_dirs
|
||||
return if ENV["XDG_DATA_DIRS"].to_s.empty?
|
||||
return if ENV["XDG_DATA_DIRS"].blank?
|
||||
return if ENV["XDG_DATA_DIRS"].split("/").include?(HOMEBREW_PREFIX/"share")
|
||||
<<~EOS
|
||||
Homebrew's share was not found in your XDG_DATA_DIRS but you have
|
||||
|
||||
@ -130,6 +130,7 @@ require "extend/pathname"
|
||||
require "extend/module"
|
||||
require "extend/predicable"
|
||||
require "extend/string"
|
||||
require "active_support/core_ext/object/blank"
|
||||
|
||||
require "constants"
|
||||
require "exceptions"
|
||||
|
||||
@ -142,8 +142,7 @@ module Homebrew
|
||||
hash, short_hash, *commit_message, relative_path =
|
||||
Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp)
|
||||
|
||||
if hash.to_s.empty? || short_hash.to_s.empty? ||
|
||||
relative_path.to_s.empty?
|
||||
if hash.blank? || short_hash.blank? || relative_path.blank?
|
||||
ofail "No previously deleted formula found." unless silent
|
||||
return
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user