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

bats-core 0.4.0 (new formula) #20073

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Formula/bats-core.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

class BatsCore < Formula
desc "Bash Automated Testing System"
homepage "https://github.com/bats-core/bats-core"
url "https://github.com/bats-core/bats-core/archive/v0.4.0.tar.gz"
sha256 "e3b65b50a26e3f0c33b5d0a57d74101acf096e39473294d4840635ca6206fec7"

bottle :unneeded
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop this line -- we prefer to build bottles of shell-only packages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Or maybe not...I see that we allowed for :unneeded in the original bats.)


def install
system "./install.sh", prefix
end

def caveats; <<~EOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't usually like long caveats blobs like this. If bats and bats-core can't play nice when installed at the same time, a conflicts_with statement would be a little cleaner and catch potential mistakes earlier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an example:

conflicts_with "bats", :because => "both install a `bats` binary"

bats: bash automated testing system
bats-core is the continuation of the original bats project.

IF YOU ALREADY HAVE BATS INSTALLED:
This version of bats is 0.4.0 via bats-core.

All versions up to and including 0.4.0 are identical mirrors through
both bats and bats-core.

However, to complete installation you may need to unlink, remove,
or overwrite your older bats installation.

To unlink:
brew unlink bats && brew link bats-core

To overwrite:
brew link --overwrite bats-core

To remove:
brew remove bats && brew link bats-core

For questions/issues: https://github.com/bats-core/bats-core/issues
More information can be found at: https://github.com/bats-core/bats-core
EOS
end

test do
(testpath/"testing.sh").write <<~EOS
#!/usr/bin/env bats
@test "addition using bc" {
result="$(echo 2+2 | bc)"
[ "$result" -eq 4 ]
}
EOS

chmod 0755, testpath/"testing.sh"
assert_match "addition", shell_output("./testing.sh")
end
end