diff options
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/base.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cask.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cask_loader.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | 22 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/info.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/install.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/list.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/container/dmg.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/download_strategy.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/dsl.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/exceptions.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/system_command.rb | 2 |
16 files changed, 30 insertions, 36 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/base.rb b/Library/Homebrew/cask/lib/hbc/artifact/base.rb index 96349f081..2d9330b13 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/base.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/base.rb @@ -10,7 +10,7 @@ module Hbc end def self.artifact_english_article - @artifact_english_article ||= artifact_english_name =~ /^[aeiou]/i ? "an" : "a" + @artifact_english_article ||= (artifact_english_name =~ /^[aeiou]/i) ? "an" : "a" end def self.artifact_dsl_key @@ -43,7 +43,7 @@ module Hbc unless unknown_keys.empty? opoo %Q{Unknown arguments to #{description} -- #{unknown_keys.inspect} (ignored). Running "brew update; brew cleanup; brew cask cleanup" will likely fix it.} end - arguments.reject! { |k| !permitted_keys.include?(k) } + arguments.select! { |k| permitted_keys.include?(k) } # key warnings override_keys = override_arguments.keys diff --git a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb index 2ddd0cfb3..7dc772380 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/uninstall_base.rb @@ -197,9 +197,7 @@ module Hbc paths.each do |path| resolved_path = Pathname.new(path) - if path.start_with?("~") - resolved_path = resolved_path.expand_path - end + resolved_path = resolved_path.expand_path if path.start_with?("~") if resolved_path.relative? || resolved_path.split.any? { |part| part.to_s == ".." } opoo "Skipping #{Formatter.identifier(action)} for relative path '#{path}'." diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 47f3b176a..e1cdb5dea 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -66,7 +66,7 @@ module Hbc return [] if current == version # collect all installed versions that are different than tap version and return them - installed.select { |v| v != version } + installed.reject { |v| v == version } end def to_s diff --git a/Library/Homebrew/cask/lib/hbc/cask_loader.rb b/Library/Homebrew/cask/lib/hbc/cask_loader.rb index c392e6b72..1b231a097 100644 --- a/Library/Homebrew/cask/lib/hbc/cask_loader.rb +++ b/Library/Homebrew/cask/lib/hbc/cask_loader.rb @@ -54,7 +54,7 @@ module Hbc class FromURILoader < FromPathLoader def self.can_load?(ref) - !(ref.to_s !~ ::URI.regexp) + ref.to_s =~ ::URI.regexp end def initialize(url) @@ -80,7 +80,7 @@ module Hbc class FromTapLoader < FromPathLoader def self.can_load?(ref) - !(ref.to_s !~ HOMEBREW_TAP_CASK_REGEX) + ref.to_s =~ HOMEBREW_TAP_CASK_REGEX end def initialize(tapped_name) diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 0eb21b0a7..99980b88d 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -140,9 +140,7 @@ module Hbc command_name, *args = *@args command = help? ? "help" : self.class.lookup_command(command_name) - unless ENV["MACOS_VERSION"].nil? - MacOS.full_version = ENV["MACOS_VERSION"] - end + MacOS.full_version = ENV["MACOS_VERSION"] unless ENV["MACOS_VERSION"].nil? Hbc.default_tap.install unless Hbc.default_tap.installed? Hbc.init if self.class.should_init?(command) diff --git a/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb index 7ee3be337..7470e36db 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb @@ -15,7 +15,7 @@ module Hbc end def self.abstract? - !(name.split("::").last !~ /^Abstract[^a-z]/) + name.split("::").last =~ /^Abstract[^a-z]/ end def self.visible diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index fe7889b73..cd6ebbc12 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -17,17 +17,17 @@ module Hbc ohai "Contents of $LOAD_PATH", self.class.render_load_path($LOAD_PATH) ohai "Environment Variables" - environment_variables = [ - "RUBYLIB", - "RUBYOPT", - "RUBYPATH", - "RBENV_VERSION", - "CHRUBY_VERSION", - "GEM_HOME", - "GEM_PATH", - "BUNDLE_PATH", - "PATH", - "SHELL", + environment_variables = %w[ + RUBYLIB + RUBYOPT + RUBYPATH + RBENV_VERSION + CHRUBY_VERSION + GEM_HOME + GEM_PATH + BUNDLE_PATH + PATH + SHELL ] (self.class.locale_variables + environment_variables).sort.each(&self.class.method(:render_env_var)) diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb index dcfc8d9bb..2b0b49cd3 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/info.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb @@ -41,7 +41,7 @@ module Hbc puts versioned_staged_path.to_s .concat(" (") .concat(versioned_staged_path.exist? ? versioned_staged_path.abv : Formatter.error("does not exist")) - .concat(")") + .concat(")") end else puts "Not installed" @@ -49,7 +49,7 @@ module Hbc end def self.name_info(cask) - ohai cask.name.size > 1 ? "Names" : "Name" + ohai((cask.name.size > 1) ? "Names" : "Name") puts cask.name.empty? ? Formatter.error("None") : cask.name end @@ -69,7 +69,7 @@ module Hbc DSL::ORDINARY_ARTIFACT_TYPES.each do |type| next if cask.artifacts[type].empty? cask.artifacts[type].each do |artifact| - activatable_item = type == :stage_only ? "<none>" : artifact.first + activatable_item = (type == :stage_only) ? "<none>" : artifact.first puts "#{activatable_item} (#{type})" end end diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb index 5acd837b1..72f85fc69 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/install.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb @@ -24,7 +24,7 @@ module Hbc begin cask = CaskLoader.load(cask_token) Installer.new(cask, binaries: binaries?, - verbose: verbose?, + verbose: verbose?, force: force?, skip_cask_deps: skip_cask_deps?, require_sha: require_sha?).install diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb index da0223b14..ceb202bb7 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb @@ -43,7 +43,7 @@ module Hbc if checkpoint.nil? onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}" else - puts cask_tokens.count > 1 ? "#{checkpoint} #{cask}": checkpoint + puts((cask_tokens.count > 1) ? "#{checkpoint} #{cask}": checkpoint) count += 1 end end diff --git a/Library/Homebrew/cask/lib/hbc/cli/list.rb b/Library/Homebrew/cask/lib/hbc/cli/list.rb index 04dccbf85..9d2ded4be 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/list.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/list.rb @@ -12,7 +12,7 @@ module Hbc def run retval = args.any? ? list : list_installed # retval is ternary: true/false/nil - if retval.nil? && !args.any? + if retval.nil? && args.none? opoo "nothing to list" # special case: avoid exit code elsif retval.nil? raise CaskError, "nothing to list" diff --git a/Library/Homebrew/cask/lib/hbc/container/dmg.rb b/Library/Homebrew/cask/lib/hbc/container/dmg.rb index 1b96df4ec..113c6fb11 100644 --- a/Library/Homebrew/cask/lib/hbc/container/dmg.rb +++ b/Library/Homebrew/cask/lib/hbc/container/dmg.rb @@ -86,7 +86,7 @@ module Hbc Dir.chdir(mount) do Dir.glob("**/*", File::FNM_DOTMATCH).map do |path| next if skip_path?(Pathname(path)) - path == "." ? path : path.prepend("./") + (path == ".") ? path : path.prepend("./") end.compact.join("\n").concat("\n") end end diff --git a/Library/Homebrew/cask/lib/hbc/download_strategy.rb b/Library/Homebrew/cask/lib/hbc/download_strategy.rb index 935391558..4bc38e3f6 100644 --- a/Library/Homebrew/cask/lib/hbc/download_strategy.rb +++ b/Library/Homebrew/cask/lib/hbc/download_strategy.rb @@ -212,7 +212,7 @@ module Hbc class SubversionDownloadStrategy < HbVCSDownloadStrategy def cache_tag # TODO: pass versions as symbols, support :head here - version == "head" ? "svn-HEAD" : "svn" + (version == "head") ? "svn-HEAD" : "svn" end def repo_valid? diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 4707ae76a..92245e8fb 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -119,9 +119,7 @@ module Hbc def language_eval return @language if instance_variable_defined?(:@language) - if @language_blocks.nil? || @language_blocks.empty? - return @language = nil - end + return @language = nil if @language_blocks.nil? || @language_blocks.empty? MacOS.languages.map(&Locale.method(:parse)).each do |locale| key = @language_blocks.keys.detect do |strings| diff --git a/Library/Homebrew/cask/lib/hbc/exceptions.rb b/Library/Homebrew/cask/lib/hbc/exceptions.rb index 14c52e94b..b9d305a9b 100644 --- a/Library/Homebrew/cask/lib/hbc/exceptions.rb +++ b/Library/Homebrew/cask/lib/hbc/exceptions.rb @@ -113,7 +113,7 @@ module Hbc end def to_s - "Cask '#{token}' definition is invalid" + (!submsg.empty? ? ": #{submsg}" : "") + "Cask '#{token}' definition is invalid#{": #{submsg}" unless submsg.empty?}" end end diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index ac2a2346e..6414a9e80 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -94,7 +94,7 @@ module Hbc loop do readable_sources = IO.select(sources)[0] readable_sources.delete_if(&:eof?).first(1).each do |source| - type = (source == sources[0] ? :stdout : :stderr) + type = ((source == sources[0]) ? :stdout : :stderr) begin yield(type, source.readline_nonblock || "") rescue IO::WaitReadable, EOFError |
