diff options
| author | Xu Cheng | 2015-08-06 15:45:52 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-08-06 17:23:56 +0800 |
| commit | b121e5fd7be1b1984e51caa6a369dd8faf70a57a (patch) | |
| tree | 7bf8eb9f259479e8c445e2d991bec251a2cc5324 /Library/Homebrew | |
| parent | 3f8ce5f1a95307a2a836afbbf51565d890ff676f (diff) | |
| download | brew-b121e5fd7be1b1984e51caa6a369dd8faf70a57a.tar.bz2 | |
more core file style updated by rubocop
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/bottles.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/caveats.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/aspell-dictionaries.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/audit.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/list.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/test-bot.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/config.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/debrew.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/extend/ENV/super.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula_cellar_checks.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formulary.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/hardware.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/resource.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/sandbox.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_inreplace.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/version.rb | 2 |
16 files changed, 21 insertions, 20 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index 5b0073d3b..2686f2468 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -63,12 +63,12 @@ end class Bintray def self.package(formula_name) - formula_name.to_s.gsub "+", "x" + formula_name.to_s.tr("+", "x") end def self.repository(tap = nil) return "bottles" if tap.nil? || tap == "Homebrew/homebrew" - "bottles-#{tap.sub(/^homebrew\/(homebrew-)?/i, "")}" + "bottles-#{tap.sub(%r{^homebrew/(homebrew-)?}i, "")}" end end diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 59e15ebbc..3eab3722b 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -149,8 +149,11 @@ class Caveats def plist_caveats s = [] if f.plist || (keg && keg.plist_installed?) - destination = f.plist_startup ? "/Library/LaunchDaemons" \ - : "~/Library/LaunchAgents" + destination = if f.plist_startup + "/Library/LaunchDaemons" + else + "~/Library/LaunchAgents" + end plist_filename = if f.plist f.plist_path.basename diff --git a/Library/Homebrew/cmd/aspell-dictionaries.rb b/Library/Homebrew/cmd/aspell-dictionaries.rb index f610ecfbd..754b6614e 100644 --- a/Library/Homebrew/cmd/aspell-dictionaries.rb +++ b/Library/Homebrew/cmd/aspell-dictionaries.rb @@ -16,7 +16,7 @@ module Homebrew fields = line.split('"') lang = fields[1] path = fields[3] - lang.gsub!("-", "_") + lang.tr!("-", "_") languages[lang] = path end end diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 7390b8a86..84a93859f 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -360,7 +360,7 @@ class FormulaAuditor EOS end - if desc =~ %r[([Cc]ommand ?line)] + if desc =~ /([Cc]ommand ?line)/ problem "Description should use \"command-line\" instead of \"#{$1}\"" end end diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 53985d113..068f26835 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -136,7 +136,7 @@ class PrettyListing root.children.sort.each do |pn| if pn.directory? dirs << pn - elsif block_given? and yield pn + elsif block_given? && yield(pn) puts pn other = "other " else diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 8e9e3c239..6dcd301aa 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -793,7 +793,7 @@ module Homebrew bottle_args << "--tap=#{tap}" if tap safe_system "brew", "bottle", *bottle_args - remote_repo = tap ? tap.gsub("/", "-") : "homebrew" + remote_repo = tap ? tap.tr("/", "-") : "homebrew" remote = "git@github.com:BrewTestBot/#{remote_repo}.git" tag = pr ? "pr-#{pr}" : "testing-#{number}" diff --git a/Library/Homebrew/config.rb b/Library/Homebrew/config.rb index bd8e3e53c..57cf19283 100644 --- a/Library/Homebrew/config.rb +++ b/Library/Homebrew/config.rb @@ -5,7 +5,7 @@ def cache # we do this for historic reasons, however the cache *should* be the same # directory whichever user is used and whatever instance of brew is executed home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path - if home_cache.directory? and home_cache.writable_real? + if home_cache.directory? && home_cache.writable_real? home_cache else Pathname.new("/Library/Caches/Homebrew").extend Module.new { diff --git a/Library/Homebrew/debrew.rb b/Library/Homebrew/debrew.rb index 3f21094be..7b1b50735 100644 --- a/Library/Homebrew/debrew.rb +++ b/Library/Homebrew/debrew.rb @@ -53,7 +53,7 @@ module Debrew menu.entries.each_with_index { |e, i| puts "#{i+1}. #{e.name}" } print menu.prompt unless menu.prompt.nil? - input = $stdin.gets or exit + input = $stdin.gets || exit input.chomp! i = input.to_i diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 911602919..a5892d122 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -121,7 +121,7 @@ module Superenv when "gcc-4.2" begin apple_gcc42 = Formulary.factory("apple-gcc42") - rescue FormulaUnavailableError + rescue FormulaUnavailableError end paths << apple_gcc42.opt_bin.to_s if apple_gcc42 when GNU_GCC_REGEXP diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 0c62687ac..071b3f4dd 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -152,7 +152,7 @@ module FormulaCellarChecks object files were linked against system openssl These object files were linked against the deprecated system OpenSSL. Adding `depends_on "openssl"` to the formula may help. - #{system_openssl * "\n "} + #{system_openssl * "\n "} EOS end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 9999ce8dd..b684519c6 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -43,7 +43,7 @@ class Formulary def self.class_s(name) class_name = name.capitalize class_name.gsub!(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase } - class_name.gsub!("+", "x") + class_name.tr!("+", "x") class_name end diff --git a/Library/Homebrew/os/mac/hardware.rb b/Library/Homebrew/os/mac/hardware.rb index 11cf0142a..db4fe5875 100644 --- a/Library/Homebrew/os/mac/hardware.rb +++ b/Library/Homebrew/os/mac/hardware.rb @@ -62,7 +62,7 @@ module MacCPUs when 100 # This is the only 64-bit PPC CPU type, so it's useful # to distinguish in `brew config` output and in bottle tags - MacOS.prefer_64_bit? ? :g5_64 : :g5 # PowerPC 970 + MacOS.prefer_64_bit? ? :g5_64 : :g5 # PowerPC 970 else :dunno end diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index 0c3184180..202b45774 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -57,7 +57,7 @@ class Resource # to be used as resource names without confusing software that # interacts with download_name, e.g. github.com/foo/bar def escaped_name - name.gsub("/", "-") + name.tr("/", "-") end def download_name diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index 835ed8a25..0f4881b41 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -79,7 +79,6 @@ class Sandbox end def exec(*args) - seatbelt = Tempfile.new(["homebrew", ".sb"], HOMEBREW_TEMP) seatbelt.write(@profile.dump) seatbelt.close @@ -105,7 +104,6 @@ class Sandbox ] quiet_system "syslog #{syslog_args * " "} | grep deny > #{@log}" end - end private diff --git a/Library/Homebrew/test/test_inreplace.rb b/Library/Homebrew/test/test_inreplace.rb index 7b0dfe64d..d9c4c1ab7 100644 --- a/Library/Homebrew/test/test_inreplace.rb +++ b/Library/Homebrew/test/test_inreplace.rb @@ -85,7 +85,7 @@ class InreplaceTest < Homebrew::TestCase s.sub!("f", "b") assert_equal "boo", s - s.gsub!("o", "e") + s.tr!("o", "e") assert_equal "bee", s end @@ -99,7 +99,7 @@ class InreplaceTest < Homebrew::TestCase end assert_raises(Utils::InreplaceError) do - inreplace("test") { |s| s.gsub! "d", "f" } + inreplace("test") { |s| s.tr!("d", "f") } end assert_raises(Utils::InreplaceError) do diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 5c9030cd7..d3f0417b0 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -299,7 +299,7 @@ class Version # e.g. boost_1_39_0 m = /((?:\d+_)+\d+)$/.match(stem) - return m.captures.first.gsub("_", ".") unless m.nil? + return m.captures.first.tr("_", ".") unless m.nil? # e.g. foobar-4.5.1-1 # e.g. unrtf_0.20.4-1 |
