Skip to content

Instantly share code, notes, and snippets.

View apainintheneck's full-sized avatar

Kevin apainintheneck

View GitHub Profile
@apainintheneck
apainintheneck / README.md
Created May 12, 2023 06:38
Testing the new service name DSL.

Overview

The idea here is to test the new service name DSL on the two formulae in homebrew/core that will need it right away. The xinit and dbus packages previously redefined the Formula#plist_name method which worked previously but now doesn't work at all with the API. To improve the situation and make it easier to serialize we're in the process of adding a new DSL.

service do
  plist_name "name"
  service_name "name"
end
@apainintheneck
apainintheneck / incorrect_caveats.txt
Created April 23, 2023 08:21
The caveats functions that don't currently work the Homebrew JSON API.
[./Formula/gawk.rb]
def caveats
on_macos do
<<~EOS
GNU "awk" has been installed as "gawk".
If you need to use it as "awk", you can add a "gnubin" directory
to your PATH from your ~/.bashrc and/or ~/.zshrc like:
PATH="#{opt_libexec}/gnubin:$PATH"
EOS
@apainintheneck
apainintheneck / caveats-query.fish
Created April 23, 2023 08:20
Script to search for caveats functions that don't work with the new Homebrew JSON API.
#!/usr/bin/env fish
# This probably should work in any shell as long as `brew` is in your path.
cd (brew --repo homebrew/core)
awk '
is_caveats(), is_end() {
# save caveats function text
caveats_buffer[++caveats_idx] = $0
@apainintheneck
apainintheneck / parse_basename.md
Created April 18, 2023 02:45
The results of different basename parsing methods in Homebrew.
Before After URL
ACE TAO-7.1.0.tar.bz2 ACE+TAO-7.1.0.tar.bz2 https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-7_1_0/ACE+TAO-7.1.0.tar.bz2
ncbi-blast-2.13.0 -src.tar.gz ncbi-blast-2.13.0+-src.tar.gz https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.13.0/ncbi-blast-2.13.0+-src.tar.gz
bonnie -2.00a.tgz bonnie++-2.00a.tgz https://www.coker.com.au/bonnie++/bonnie++-2.00a.tgz
bupstash-v0.12.0-src deps.tar.gz bupstash-v0.12.0-src+deps.tar.gz https://github.com/andrewchambers/bupstash/releases/download/v0.12.0/bupstash-v0.12.0-src+deps.tar.gz
capnproto-c -0.10.4.tar.gz capnproto-c++-0.10.4.tar.gz https://capnproto.org/capnproto-c++-0.10.4.tar.gz
dump1090-mutability_1.15~20180310.4a16df3 dfsg.orig.tar.gz dump1090-mutability_1.15~20180310.4a16df3+dfsg.orig.tar.gz http://archive.ubuntu.com/ubuntu/pool/universe/d/dump1090-mutability/dump1090-mutability_1.15~20180310.4a16df3+dfsg.orig.tar.gz
dvd rw-tools-7.1.tar.gz dvd+rw-tools-7.1.tar.gz http://fy.chalmers.se/~
@apainintheneck
apainintheneck / test_parse_basename.rb
Created April 18, 2023 02:43
Generates the differences in basename parsing after changes to `AbstractFileDownloadStrategy#parse_basename`.
# A script to compare the results of `AbstractFileDownloadStrategy#parse_basename` in the codebase.
# - https://github.com/Homebrew/brew/pull/15258
require "set"
# -----
# Functions
# -----
# The current version present in the codebase.
@apainintheneck
apainintheneck / brew-api-readall.rb
Last active September 4, 2023 17:27
Test whether packages can be loaded from the generated JSON API. Mimics `brew readable` but for the API.
# Test whether formulae and casks are loading correctly from the API.
#
# Edit: I actually turned this into it's own brew command `brew api-readall-test`.
# - https://github.com/apainintheneck/homebrew-dev-utils
require "formula"
require "cask"
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
@apainintheneck
apainintheneck / serialization-differences.txt
Created March 22, 2023 06:56
These are the differences between serializing services from formulae loaded from taps or from the API hash.
{:run=>[#<Pathname:/usr/local/opt/activemq/bin/activemq>, "console"], :run_type=>:immediate, :working_dir=>"/usr/local/opt/activemq/libexec"}
{:run=>["/usr/local/opt/activemq/bin/activemq", "console"], :run_type=>:immediate, :working_dir=>"/usr/local/opt/activemq/libexec"}
{:run=>[#<Pathname:/usr/local/opt/aliddns/bin/aliddns>, "-c", #<Pathname:/usr/local/etc/aliddns/aliddns.yaml>], :run_type=>:immediate, :keep_alive=>{:always=>true}, :log_path=>"/usr/local/var/log/aliddns.log", :error_log_path=>"/usr/local/var/log/aliddns.log"}
{:run=>["/usr/local/opt/aliddns/bin/aliddns", "-c", "/usr/local/etc/aliddns/aliddns.yaml"], :run_type=>:immediate, :keep_alive=>{:always=>true}, :log_path=>"/usr/local/var/log/aliddns.log", :error_log_path=>"/usr/local/var/log/aliddns.log"}
{:run=>[#<Pathname:/usr/local/opt/apache-archiva/bin/archiva>, "console"], :run_type=>:immediate, :environment_variables=>{:ARCHIVA_BASE=>"/usr/local/var/archiva"}, :log_path=>"/usr/local/var/archiva/logs/launchd.log"}
{:run=>["/usr/local/opt/apa
@apainintheneck
apainintheneck / service-block-testing.rb
Last active April 1, 2023 14:53
brew: Testing for adding service blocks to the formula API.
# Test whether service blocks are loading correctly from the API.
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
unless CoreTap.instance.installed?
raise "The core tap needs to be installed to run these tests!"
end
# Get the names of all core formulas with service blocks.
# Note: We don't load the formulae here since we will have to load
@apainintheneck
apainintheneck / vopen.fish
Last active April 20, 2023 07:47
Fish script to open your clipboard as a file in your editor on MacOS.
function vopen --description 'open the clipboard as a file in your editor'
if test (count $argv) != 1
echo "Usage: vopen FILENAME"
return 1
end
set --local filename $argv[1]
set --local filepath "$HOME/Desktop/$filename"
if test -e $filepath
@apainintheneck
apainintheneck / remaining-cask-gen-diffs.txt
Created February 20, 2023 04:03
`Cask#to_h` diff when casks are loaded from source or from the API.
--- lyx ---
44,48d43
< "/Applications/LyX.app/Contents/MacOS/lyxeditor"
< ]
< },
< {
< "binary": [
65a61,65
> "binary": [