diff options
| author | Baptiste Fontaine | 2015-12-28 13:23:22 +0100 | 
|---|---|---|
| committer | Baptiste Fontaine | 2015-12-30 00:44:46 +0100 | 
| commit | c15c9dbaf3d6bba4cf44b94963cad124952f902b (patch) | |
| tree | 4355f2ad52c5a086fa72e80835ef16e0f0e1f9bb /Library | |
| parent | 4b2eb86bbf5bb0ae76619e67be1bc99e8b68ee40 (diff) | |
| download | brew-c15c9dbaf3d6bba4cf44b94963cad124952f902b.tar.bz2 | |
Tap#issues_url added
Closes Homebrew/homebrew#47454.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/tap.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_tap.rb | 16 | 
3 files changed, 28 insertions, 2 deletions
| diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 849272610..ad4e600f6 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -235,8 +235,10 @@ class BuildError < RuntimeError            puts "#{formula} was moved to homebrew-boneyard because it has unfixable issues."            puts "Please do not file any issues about this. Sorry!"          else -          puts "If reporting this issue please do so at (not Homebrew/homebrew):" -          puts "  https://github.com/#{formula.tap}/issues" +          if issues_url = formula.tap.issues_url +            puts "If reporting this issue please do so at (not Homebrew/homebrew):" +            puts "  #{issues_url}" +          end          end        end      else diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 1acbfca4e..b038d3020 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -82,6 +82,14 @@ class Tap      (path/".git").exist?    end +  # The issues URL of this {Tap}. +  # e.g. `https://github.com/user/homebrew-repo/issues` +  def issues_url +    if official? || !custom_remote? +      "https://github.com/#{user}/homebrew-#{repo}/issues" +    end +  end +    def to_s      name    end diff --git a/Library/Homebrew/test/test_tap.rb b/Library/Homebrew/test/test_tap.rb index b8adb81f9..bd329c1d2 100644 --- a/Library/Homebrew/test/test_tap.rb +++ b/Library/Homebrew/test/test_tap.rb @@ -67,6 +67,22 @@ class TapTest < Homebrew::TestCase      refute_predicate @tap, :core_formula_repository?    end +  def test_issues_url +    t = Tap.new("someone", "foo") +    path = Tap::TAP_DIRECTORY/"someone/homebrew-foo" +    path.mkpath +    FileUtils.cd path do +      shutup { system "git", "init" } +      system "git", "remote", "add", "origin", +        "https://github.com/someone/homebrew-foo" +    end +    assert_equal "https://github.com/someone/homebrew-foo/issues", t.issues_url +    assert_equal "https://github.com/Homebrew/homebrew-foo/issues", @tap.issues_url + +    (Tap::TAP_DIRECTORY/"someone/homebrew-no-git").mkpath +    assert_nil Tap.new("someone", "no-git").issues_url +  end +    def test_files      setup_tap_files | 
