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