diff options
| author | Xu Cheng | 2015-12-07 14:11:04 +0800 | 
|---|---|---|
| committer | Xu Cheng | 2015-12-09 16:56:59 +0800 | 
| commit | 2c25303949a9fa091868cbdd42fd4ff4877869fc (patch) | |
| tree | ef4127caea10735397ae530022213c526d77150b | |
| parent | 5b435db3bfc48d8bb41a5773cf6d7ae8970a55e4 (diff) | |
| download | brew-2c25303949a9fa091868cbdd42fd4ff4877869fc.tar.bz2 | |
remove unnecessary tap_args
It's now handled by Tap.fetch
| -rw-r--r-- | Library/Homebrew/cmd/readall.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/tap-info.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/tap-pin.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/tap-unpin.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/tap.rb | 11 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/test-bot.rb | 17 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/untap.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/tap_constants.rb | 2 | 
8 files changed, 28 insertions, 25 deletions
| diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb index 5e87fcbdb..4d575195e 100644 --- a/Library/Homebrew/cmd/readall.rb +++ b/Library/Homebrew/cmd/readall.rb @@ -46,7 +46,7 @@ module Homebrew      if ARGV.named.empty?        formulae = Formula.files      else -      tap = Tap.fetch(*tap_args) +      tap = Tap.fetch(ARGV.named.first)        raise TapUnavailableError, tap.name unless tap.installed?        formulae = tap.formula_files      end diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index 80f1d4e38..8139b4943 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -1,4 +1,4 @@ -require "cmd/tap" +require "tap"  module Homebrew    def tap_info @@ -6,10 +6,12 @@ module Homebrew        taps = Tap      else        taps = ARGV.named.map do |name| -        Tap.fetch(*tap_args(name)) +        Tap.fetch(name)        end      end +    raise "Homebrew/homebrew is not allowed" if taps.any?(&:core_formula_repository?) +      if ARGV.json == "v1"        print_tap_json(taps)      else diff --git a/Library/Homebrew/cmd/tap-pin.rb b/Library/Homebrew/cmd/tap-pin.rb index 80f1f762a..e906c700d 100644 --- a/Library/Homebrew/cmd/tap-pin.rb +++ b/Library/Homebrew/cmd/tap-pin.rb @@ -1,9 +1,10 @@ -require "cmd/tap" +require "tap"  module Homebrew    def tap_pin      ARGV.named.each do |name| -      tap = Tap.fetch(*tap_args(name)) +      tap = Tap.fetch(name) +      raise "Homebrew/homebrew is not allowed" if tap.core_formula_repository?        tap.pin        ohai "Pinned #{tap.name}"      end diff --git a/Library/Homebrew/cmd/tap-unpin.rb b/Library/Homebrew/cmd/tap-unpin.rb index 641b7c945..e36a68ed0 100644 --- a/Library/Homebrew/cmd/tap-unpin.rb +++ b/Library/Homebrew/cmd/tap-unpin.rb @@ -1,9 +1,10 @@ -require "cmd/tap" +require "tap"  module Homebrew    def tap_unpin      ARGV.named.each do |name| -      tap = Tap.fetch(*tap_args(name)) +      tap = Tap.fetch(name) +      raise "Homebrew/homebrew is not allowed" if tap.core_formula_repository?        tap.unpin        ohai "Unpinned #{tap.name}"      end diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index 701931f1e..08b9e8327 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -12,8 +12,7 @@ module Homebrew      elsif ARGV.first == "--list-pinned"        puts Tap.select(&:pinned?).map(&:name)      else -      user, repo = tap_args -      tap = Tap.fetch(user, repo) +      tap = Tap.fetch(ARGV.named[0])        begin          tap.install(:clone_target => ARGV.named[1],                      :full_clone   => ARGV.include?("--full")) @@ -43,12 +42,4 @@ module Homebrew      (HOMEBREW_LIBRARY/"Formula").children.each { |c| c.unlink if c.symlink? }      ignore.unlink if ignore.exist?    end - -  private - -  def tap_args(tap_name = ARGV.named.first) -    tap_name =~ HOMEBREW_TAP_ARGS_REGEX -    raise "Invalid tap name" unless $1 && $3 -    [$1, $3] -  end  end diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 498b8444d..2c5ef7f7f 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -37,20 +37,29 @@ module Homebrew    def resolve_test_tap      tap = ARGV.value("tap") -    return Tap.fetch(*tap_args(tap)) if tap +    if tap +      tap = Tap.fetch(tap) +      return tap unless tap.core_formula_repository? +    end      if ENV["UPSTREAM_BOT_PARAMS"]        bot_argv = ENV["UPSTREAM_BOT_PARAMS"].split " "        bot_argv.extend HomebrewArgvExtension        tap = bot_argv.value("tap") -      return Tap.fetch(*tap_args(tap)) if tap +      if tap +        tap = Tap.fetch(tap) +        return tap unless tap.core_formula_repository? +      end      end      if git_url = ENV["UPSTREAM_GIT_URL"] || ENV["GIT_URL"]        # Also can get tap from Jenkins GIT_URL.        url_path = git_url.sub(%r{^https?://github\.com/}, "").chomp("/") -      HOMEBREW_TAP_ARGS_REGEX =~ url_path -      return Tap.fetch($1, $3) if $1 && $3 && $3 != "homebrew" +      begin +        tap = Tap.fetch(tap) +        return tap unless tap.core_formula_repository? +      rescue +      end      end      # return nil means we are testing core repo. diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb index 2d08ae8c7..8f14258f3 100644 --- a/Library/Homebrew/cmd/untap.rb +++ b/Library/Homebrew/cmd/untap.rb @@ -1,11 +1,12 @@ -require "cmd/tap" # for tap_args +require "tap"  module Homebrew    def untap      raise "Usage is `brew untap <tap-name>`" if ARGV.empty?      ARGV.named.each do |tapname| -      tap = Tap.fetch(*tap_args(tapname)) +      tap = Tap.fetch(tapname) +      raise "Homebrew/homebrew is not allowed" if tap.core_formula_repository?        tap.uninstall      end    end diff --git a/Library/Homebrew/tap_constants.rb b/Library/Homebrew/tap_constants.rb index 6502b61d8..ce470bd4b 100644 --- a/Library/Homebrew/tap_constants.rb +++ b/Library/Homebrew/tap_constants.rb @@ -1,5 +1,3 @@ -# match expressions when taps are given as ARGS, e.g. someuser/sometap -HOMEBREW_TAP_ARGS_REGEX = %r{^([\w-]+)/(homebrew-)?([\w-]+)$}  # match taps' formulae, e.g. someuser/sometap/someformula  HOMEBREW_TAP_FORMULA_REGEX = %r{^([\w-]+)/([\w-]+)/([\w+-.]+)$}  # match core's formulae, e.g. homebrew/homebrew/someformula | 
