diff options
| author | Jack Nagel | 2015-05-26 19:49:43 -0400 |
|---|---|---|
| committer | Jack Nagel | 2015-05-26 19:51:30 -0400 |
| commit | be0a1e76353ce1a1546b85c8bab80521a89d08ec (patch) | |
| tree | fe173e239e62d5998c280b8655f44f549d780356 /Library | |
| parent | 13540f85abd75a3ac68c7b26b5be95d0b3921aff (diff) | |
| download | brew-be0a1e76353ce1a1546b85c8bab80521a89d08ec.tar.bz2 | |
Check empty? to avoid introducing nils
[].last => nil
[].max => nil
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/bottle.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb index a06545d42..caae9859c 100644 --- a/Library/Homebrew/cmd/bottle.rb +++ b/Library/Homebrew/cmd/bottle.rb @@ -125,14 +125,17 @@ module Homebrew return ofail "Formula has no stable version: #{f.name}" end - if ARGV.include? '--no-revision' - bottle_revision = 0 - else + bottle_revision = 0 + + unless ARGV.include? "--no-revision" ohai "Determining #{f.name} bottle revision..." versions = FormulaVersions.new(f) bottle_revisions = versions.bottle_version_map("origin/master")[f.pkg_version] - bottle_revisions.pop if bottle_revisions.last.to_i > 0 - bottle_revision = bottle_revisions.any? ? bottle_revisions.max.to_i + 1 : 0 + + unless bottle_revisions.empty? + bottle_revisions.pop if bottle_revisions.last > 0 + bottle_revision = bottle_revisions.max + 1 + end end filename = Bottle::Filename.create(f, bottle_tag, bottle_revision) |
