Skip to content
Closed
Changes from 3 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
23 changes: 23 additions & 0 deletions Formula/bucklespring.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Bucklespring < Formula
desc "Nostalgia bucklespring keyboard sound"
homepage "https://github.com/zevv/bucklespring"
url "https://github.com/zevv/bucklespring/archive/v1.4.0.tar.gz"
sha256 "b38b2c0ec905573a243cb9db543f8eeb92e4d040025ef338d8bcfcfd5ccd5348"
license "GPL-2.0-only"

depends_on "alure" => :build
depends_on "pkg-config" => :build

def install
inreplace "Makefile", "-Wall -Werror", "-Wall"
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't really like new formulae that require patching.
This should be submitted to upstream.

Also, I'm a bit worried, is this project actively maintained?
The last release was 4 years ago, nevertheless, it has some fresher commits.

Copy link
Author

Choose a reason for hiding this comment

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

upstream requested at zevv/bucklespring#97

ENV["PATH_AUDIO"] = prefix/"wav"
system "make"
(lib/"pkgconfig").install Dir["mac/lib/pkgconfig/*"]
bin.install "buckle"
prefix.install "wav"
end

test do
system "buckle", "-h"
Copy link
Member

Choose a reason for hiding this comment

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

Can you propose a more substantial test than checking the version or calling for help? These tests rarely ever fail even for broken installations.

We want tests that don’t require any user input and test the basic functionality of the application. For example foo build-foo input.foo is a good test and (despite their widespread use) foo --version and foo --help are bad tests.

Ref. https://docs.brew.sh/Formula-Cookbook#add-a-test-to-the-formula

Copy link
Member

Choose a reason for hiding this comment

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

We need a test that exercises the some of the functionality of the app. Version checks or usage checks (foo --version or foo --help) are not sufficient, as explained in the formula cookbook.

In most cases, a good test would involve running a simple test case: run #{bin}/foo input.txt.

  • Then you can check that the output is as expected (with assert_equal or assert_match on the output of shell_output)
  • You can also check that an output file was created, if that is expected: assert_predicate testpath/"output.txt", :exist?

Some advice for specific cases:

  • If the formula is a library, compile and run some simple code that links against it. It could be taken from upstream's documentation / source examples.
  • If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.
  • If the software cannot function without credentials, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected.
  • Same if the software requires a virtual machine, docker instance, etc. to be running.

end
end