Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to Homebrew #8

Open
smallhadroncollider opened this issue Feb 2, 2020 · 15 comments
Open

Add to Homebrew #8

smallhadroncollider opened this issue Feb 2, 2020 · 15 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@smallhadroncollider
Copy link
Owner

smallhadroncollider commented Feb 2, 2020

I'd like to add brök to Homebrew, but I'll need someone else to submit it. I can provide the Formula that you need to submit. Please leave a comment if you'd like to help with this.

Thanks!

Update: Needs more stars before submitting

@smallhadroncollider smallhadroncollider added the help wanted Extra attention is needed label Feb 3, 2020
@smallhadroncollider
Copy link
Owner Author

smallhadroncollider commented Feb 3, 2020

require "language/haskell"

class Brok < Formula
  include Language::Haskell::Cabal

  desc "Find broken links in text documents"
  homepage "https://github.com/smallhadroncollider/brok"
  url "https://github.com/smallhadroncollider/brok/archive/1.0.0.tar.gz"
  sha256 "fa35be3068d6647a029c922c59a7107186cc9cb0d5f5156b72609f30c8704ad4"

  depends_on "cabal-install" => :build
  depends_on "ghc" => :build
  depends_on "hpack" => :build

  def install
    system "hpack"
    install_cabal_package
  end

  test do
    (testpath/"test.md").write <<~EOS
      Blah blah https://duckduckgo.com
    EOS

    expected = <<~EOS
      *** Checking URLs ***

      Fetching: https://duckduckgo.com
      Fetching complete

      *** Results ***

      [test.md]
      - OK (200): https://duckduckgo.com
    EOS

    assert_match expected, shell_output("#{bin}/brok --no-color test.md")
  end
end

@smallhadroncollider
Copy link
Owner Author

You'll need to:

  1. fork homebrew-core
  2. add the above code to a file called brok.rb in the Formula directory
  3. do a git commit with the message cmt 1.0.0
  4. push to your fork
  5. submit a pull request to homebrew-core repo

@smallhadroncollider
Copy link
Owner Author

If you let me know when you've done that I can jump in on the PR conversation and help with any issues.

@smallhadroncollider
Copy link
Owner Author

@tjweir Would you be able to assist?

@kahlil29
Copy link

Hey! I had done this process for cmt and if you'd like me to, I can do the same for this project as well :)

@smallhadroncollider
Copy link
Owner Author

Thanks!

@smallhadroncollider
Copy link
Owner Author

@kahlil29 Have you had a chance to look at this yet?

@kahlil29
Copy link

I'm sorry, I didn't see this notification & forgot about this task.
I'll get it released this week 👍

@smallhadroncollider
Copy link
Owner Author

@kahlil29 No worries. Thanks!

@kahlil29
Copy link

Sorry for the delay from my end with this issue.

An update:
I managed to work on this today.
There's some cabal deprecation so had to change some of the ruby dependency/import statements, got the right statements from Homebrew/homebrew-core#55253

Now the test is failing (seems like a minor escaping/text mismatch error) because running the brok executable manually works fine and produces the expected output:

==> Testing brok
==> /usr/local/Cellar/brok/1.0.0_1/bin/brok --no-color test.md
Error: brok: failed
An exception occurred within a child process:
  Test::Unit::AssertionFailedError: </\*\*\*\ Checking\ URLs\ \*\*\*\n\nFetching:\ https:\/\/duckduckgo\.com\nFetching\ complete\n\n\*\*\*\ Results\ \*\*\*\n\n\[test\.md\]\n\-\ OK\ \(200\):\ https:\/\/duckduckgo\.com\n/> was expected to be =~
<"*** Checking URLs ***\n" +
"\n" +
"\e[1F\e[2KFetching: https://duckduckgo.com\n" +
"\e[1F\e[2KFetching complete\n" +
"\n" +
"*** Results ***\n" +
"\n" +
"[test.md]\n" +
"- OK (200): https://duckduckgo.com\n">.

I'm debugging it to see if I can spot what's going wrong, haven't quite cracked it yet.

@smallhadroncollider
Copy link
Owner Author

Hmm, think it's the line clearing code (\e[2K) coming out in the results.

@smallhadroncollider
Copy link
Owner Author

Maybe just add those characters (\e[1F\e[2K) to the expected result?

@kahlil29
Copy link

Yes that does seem to be the issue.
I think I tried that but it's not that straightforward.
I think the \e is to escape a space and only the other characters need to be added. I'll play around and do some trial & error to try & get it to work.

@smallhadroncollider
Copy link
Owner Author

Yeah, I seem to remember having similar issues before I added the --no-color option. I can't remember what the solution was (or if I found one).

@smallhadroncollider
Copy link
Owner Author

@kahlil29 Did you work out what it was? Sorry, I've not had any time to work on things recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants