diff options
| author | Markus Reiter | 2016-11-14 16:50:24 +0100 |
|---|---|---|
| committer | GitHub | 2016-11-14 16:50:24 +0100 |
| commit | 3a01fbadcd14fb180635d6464f2c600a738d50b5 (patch) | |
| tree | e84414014d51503cf8dfa47e46ffec9fe26158ca /Library/Homebrew/cask/lib | |
| parent | ee143482e4323be29a60ee2965835a54eac2ace8 (diff) | |
| parent | 6c1d42386df7994607f4b6096dd75323ff9bbb3a (diff) | |
| download | brew-3a01fbadcd14fb180635d6464f2c600a738d50b5.tar.bz2 | |
Merge pull request #1362 from reitermarkus/rubocop
Update RuboCop to 0.45.0.
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/search.rb | 15 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/style.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/installer.rb | 25 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/utils.rb | 16 |
4 files changed, 29 insertions, 29 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb index 8e8f8fd75..3f73fcd2e 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/search.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb @@ -41,14 +41,15 @@ module Hbc ohai "Exact match" puts exact_match end - unless partial_matches.empty? - if extract_regexp search_term - ohai "Regexp matches" - else - ohai "Partial matches" - end - puts Formatter.columns(partial_matches) + + return if partial_matches.empty? + + if extract_regexp search_term + ohai "Regexp matches" + else + ohai "Partial matches" end + puts Formatter.columns(partial_matches) end def self.help diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index 01ba39411..e036770ab 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/style.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb @@ -23,7 +23,7 @@ module Hbc $CHILD_STATUS.success? end - RUBOCOP_CASK_VERSION = "~> 0.10.4".freeze + RUBOCOP_CASK_VERSION = "~> 0.10.5".freeze def install_rubocop Utils.capture_stderr do diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 183d1f14b..57efe97e9 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -28,22 +28,21 @@ module Hbc def self.print_caveats(cask) odebug "Printing caveats" - unless cask.caveats.empty? - output = capture_output do - cask.caveats.each do |caveat| - if caveat.respond_to?(:eval_and_print) - caveat.eval_and_print(cask) - else - puts caveat - end + return if cask.caveats.empty? + + output = capture_output do + cask.caveats.each do |caveat| + if caveat.respond_to?(:eval_and_print) + caveat.eval_and_print(cask) + else + puts caveat end end - - unless output.empty? - ohai "Caveats" - puts output - end end + + return if output.empty? + ohai "Caveats" + puts output end def self.capture_output(&block) diff --git a/Library/Homebrew/cask/lib/hbc/utils.rb b/Library/Homebrew/cask/lib/hbc/utils.rb index b442efd2f..ef3e5eda3 100644 --- a/Library/Homebrew/cask/lib/hbc/utils.rb +++ b/Library/Homebrew/cask/lib/hbc/utils.rb @@ -137,17 +137,17 @@ module Hbc def self.nowstamp_metadata_path(container_path) @timenow ||= Time.now.gmtime - if container_path.respond_to?(:join) - precision = 3 - timestamp = @timenow.strftime("%Y%m%d%H%M%S") - fraction = format("%.#{precision}f", @timenow.to_f - @timenow.to_i)[1..-1] - timestamp.concat(fraction) - container_path.join(timestamp) - end + return unless container_path.respond_to?(:join) + + precision = 3 + timestamp = @timenow.strftime("%Y%m%d%H%M%S") + fraction = format("%.#{precision}f", @timenow.to_f - @timenow.to_i)[1..-1] + timestamp.concat(fraction) + container_path.join(timestamp) end def self.size_in_bytes(files) - Array(files).reduce(0) { |a, e| a + (File.size?(e) || 0) } + Array(files).reduce(0) { |acc, elem| acc + (File.size?(elem) || 0) } end def self.capture_stderr |
