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

formulae(n - o): use language-specific heredoc delimiters #199906

Merged
merged 34 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7b57bbb
nanopb: use language-specific heredoc delimiters
cho-m Dec 3, 2024
93f1def
naturaldocs: use language-specific heredoc delimiters
cho-m Dec 3, 2024
178d666
nbdime: use language-specific heredoc delimiters
cho-m Dec 3, 2024
46c0f9a
nco: use language-specific heredoc delimiters
cho-m Dec 3, 2024
51cc570
netlistsvg: use language-specific heredoc delimiters
cho-m Dec 3, 2024
f49bfbf
networkit: use language-specific heredoc delimiters
cho-m Dec 3, 2024
4f39463
newman: use language-specific heredoc delimiters
cho-m Dec 3, 2024
0cdfeb1
nginx: use language-specific heredoc delimiters
cho-m Dec 3, 2024
bd51b0a
nickel: use language-specific heredoc delimiters
cho-m Dec 3, 2024
fe589f1
ninja: use language-specific heredoc delimiters
cho-m Dec 3, 2024
e9989b2
nlohmann-json: use language-specific heredoc delimiters
cho-m Dec 3, 2024
b3a7a87
node_exporter: use language-specific heredoc delimiters
cho-m Dec 3, 2024
36b6601
notmuch: use language-specific heredoc delimiters
cho-m Dec 3, 2024
49fa5f4
npm-check-updates: use language-specific heredoc delimiters
cho-m Dec 3, 2024
2748fb2
npush: use language-specific heredoc delimiters
cho-m Dec 3, 2024
d0149bc
ntl: use language-specific heredoc delimiters
cho-m Dec 3, 2024
7938130
nuget: use language-specific heredoc delimiters
cho-m Dec 3, 2024
4690e0b
numpy: use language-specific heredoc delimiters
cho-m Dec 3, 2024
13a9a72
nvchecker: use language-specific heredoc delimiters
cho-m Dec 3, 2024
2ba0f69
nvm: use language-specific heredoc delimiters
cho-m Dec 3, 2024
cd04205
ocicl: use language-specific heredoc delimiters
cho-m Dec 3, 2024
3a2b0ab
octave: use language-specific heredoc delimiters
cho-m Dec 3, 2024
44e2972
octosql: use language-specific heredoc delimiters
cho-m Dec 3, 2024
05b0fd9
odin: use language-specific heredoc delimiters
cho-m Dec 3, 2024
9ddac2e
opendbx: use language-specific heredoc delimiters
cho-m Dec 3, 2024
2eda079
opentelemetry-cpp: use language-specific heredoc delimiters
cho-m Dec 3, 2024
9060238
opentofu: use language-specific heredoc delimiters
cho-m Dec 3, 2024
fcefb4b
opentsdb: use language-specific heredoc delimiters
cho-m Dec 3, 2024
aefee4f
openvino: use language-specific heredoc delimiters
cho-m Dec 3, 2024
550fbc7
oras: use language-specific heredoc delimiters
cho-m Dec 3, 2024
ef4d394
ormolu: use language-specific heredoc delimiters
cho-m Dec 3, 2024
2014a1f
osc: use language-specific heredoc delimiters
cho-m Dec 3, 2024
7b05d47
osmium-tool: use language-specific heredoc delimiters
cho-m Dec 3, 2024
2e036e0
osmosis: use language-specific heredoc delimiters
cho-m Dec 3, 2024
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
4 changes: 2 additions & 2 deletions Formula/n/nanopb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ def install
end

test do
(testpath/"test.proto").write <<~EOS
(testpath/"test.proto").write <<~PROTO
syntax = "proto2";

message Test {
required string test_field = 1;
}
EOS
PROTO

system Formula["protobuf"].bin/"protoc",
"--proto_path=#{testpath}", "--plugin=#{bin}/protoc-gen-nanopb",
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/naturaldocs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def install
arch = Hardware::CPU.intel? ? "x64" : Hardware::CPU.arch.to_s

libexec.install Dir["*"]
(bin/"naturaldocs").write <<~EOS
(bin/"naturaldocs").write <<~BASH
#!/bin/bash
mono #{libexec}/NaturalDocs.exe "$@"
EOS
BASH

libexec.install_symlink etc/"naturaldocs" => "config"

Expand Down
8 changes: 4 additions & 4 deletions Formula/n/nbdime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def install
end

test do
(testpath/"old.ipynb").write <<~EOS
(testpath/"old.ipynb").write <<~JSON
{
"cells": [
{
Expand Down Expand Up @@ -106,8 +106,8 @@ def install
"nbformat": 4,
"nbformat_minor": 1
}
EOS
(testpath/"new.ipynb").write <<~EOS
JSON
(testpath/"new.ipynb").write <<~JSON
{
"cells": [
{
Expand Down Expand Up @@ -150,7 +150,7 @@ def install
"nbformat": 4,
"nbformat_minor": 1
}
EOS
JSON
# sadly no special exit code if files are the same
diff_output = shell_output("#{bin}/nbdiff --no-color old.ipynb new.ipynb")
assert_match "nbdiff old.ipynb new.ipynb", diff_output
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nco.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def install
(buildpath/"include").install "lib/cpp/antlr"
(buildpath/"lib").install "lib/cpp/src/libantlr.a"

(buildpath/"bin/antlr").write <<~EOS
(buildpath/"bin/antlr").write <<~SH
#!/bin/sh
exec "#{Formula["openjdk"].opt_bin}/java" -classpath "#{buildpath}/libexec/antlr.jar" antlr.Tool "$@"
EOS
SH

chmod 0755, buildpath/"bin/antlr"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/netlistsvg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def install
end

test do
(testpath/"dff.v").write <<~EOS
(testpath/"dff.v").write <<~VERILOG
module DFF (output reg Q, input C, D, R);
always @(posedge C)
if (~R) begin
Expand All @@ -28,7 +28,7 @@ module DFF (output reg Q, input C, D, R);
Q <= D;
end
endmodule
EOS
VERILOG
system "yosys -q -p \"prep -top DFF; write_json dff.json\" dff.v"
system bin/"netlistsvg", "dff.json", "-o", "dff.svg"
assert_predicate testpath/"dff.svg", :exist?
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/networkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def install
end

test do
system python3, "-c", <<~EOS
system python3, "-c", <<~PYTHON
import networkit as nk
G = nk.graph.Graph(3)
G.addEdge(0,1)
Expand All @@ -66,6 +66,6 @@ def install
assert G.degree(0) == 2
assert G.degree(1) == 2
assert G.degree(2) == 2
EOS
PYTHON
end
end
4 changes: 2 additions & 2 deletions Formula/n/newman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def install

test do
path = testpath/"test-collection.json"
path.write <<~EOS
path.write <<~JSON
{
"info": {
"_postman_id": "db95eac2-6e1c-48c0-8c3a-f83c5341d4dd",
Expand Down Expand Up @@ -59,7 +59,7 @@ def install
}
]
}
EOS
JSON

assert_match "newman", shell_output("#{bin}/newman run #{path}")
assert_equal version.to_s, shell_output("#{bin}/newman --version").strip
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nginx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def caveats
end

test do
(testpath/"nginx.conf").write <<~EOS
(testpath/"nginx.conf").write <<~NGINX
worker_processes 4;
error_log #{testpath}/error.log;
pid #{testpath}/nginx.pid;
Expand All @@ -175,7 +175,7 @@ def caveats
error_log #{testpath}/error.log;
}
}
EOS
NGINX
system bin/"nginx", "-t", "-c", testpath/"nginx.conf"
end
end
4 changes: 2 additions & 2 deletions Formula/n/nickel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def install
test do
assert_match version.to_s, shell_output("#{bin}/nickel --version")

(testpath/"program.ncl").write <<~EOS
(testpath/"program.ncl").write <<~NICKEL
let s = "world" in "Hello, " ++ s
EOS
NICKEL

output = shell_output("#{bin}/nickel eval program.ncl")
assert_match "Hello, world", output
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/ninja.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def install
end

test do
(testpath/"build.ninja").write <<~EOS
(testpath/"build.ninja").write <<~NINJA
cflags = -Wall

rule cc
command = gcc $cflags -c $in -o $out

build foo.o: cc foo.c
EOS
NINJA
system bin/"ninja", "-t", "targets"
port = free_port
fork do
Expand Down
8 changes: 4 additions & 4 deletions Formula/n/nlohmann-json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def install
end

test do
(testpath/"test.cc").write <<~EOS
(testpath/"test.cc").write <<~CPP
#include <iostream>
#include <nlohmann/json.hpp>

Expand All @@ -39,12 +39,12 @@ def install
};
std::cout << j << std::endl;
}
EOS
CPP

system ENV.cxx, "test.cc", "-I#{include}", "-std=c++11", "-o", "test"
std_output = <<~EOS
std_output = <<~JSON
{"list":[1,0,2],"name":"Niels","object":{"happy":true,"nothing":null},"pi":3.141}
EOS
JSON
assert_match std_output, shell_output("./test")
end
end
4 changes: 2 additions & 2 deletions Formula/n/node_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def install

touch etc/"node_exporter.args"

(bin/"node_exporter_brew_services").write <<~EOS
(bin/"node_exporter_brew_services").write <<~BASH
#!/bin/bash
exec #{bin}/node_exporter $(<#{etc}/node_exporter.args)
EOS
BASH
end

def caveats
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/notmuch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ def install
end

test do
(testpath/".notmuch-config").write <<~EOS
(testpath/".notmuch-config").write <<~INI
[database]
path=#{testpath}/Mail
EOS
INI
(testpath/"Mail").mkpath
assert_match "0 total", shell_output("#{bin}/notmuch new")

Expand Down
4 changes: 2 additions & 2 deletions Formula/n/npm-check-updates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ def install

test do
test_package_json = testpath/"package.json"
test_package_json.write <<~EOS
test_package_json.write <<~JSON
{
"dependencies": {
"express": "1.8.7",
"lodash": "3.6.1"
}
}
EOS
JSON

system bin/"ncu", "-u"

Expand Down
4 changes: 2 additions & 2 deletions Formula/n/npush.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def install
inreplace "Makefile", "$(PROGRAM) $(OBJECTS)", "$(PROGRAM) $(OBJECTS) -lncurses" unless OS.mac?
system "make"
pkgshare.install ["npush", "levels"]
(bin/"npush").write <<~EOS
(bin/"npush").write <<~SH
#!/bin/sh
cd "#{pkgshare}" && exec ./npush $@
EOS
SH
end
end
4 changes: 2 additions & 2 deletions Formula/n/ntl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install
end

test do
(testpath/"square.cc").write <<~EOS
(testpath/"square.cc").write <<~CPP
#include <iostream>
#include <NTL/ZZ.h>

Expand All @@ -56,7 +56,7 @@ def install
std::cout << NTL::power(a, 2);
return 0;
}
EOS
CPP
gmp = Formula["gmp"]
flags = %W[
-std=c++11
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nuget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class Nuget < Formula

def install
libexec.install "nuget.exe" => "nuget.exe"
(bin/"nuget").write <<~EOS
(bin/"nuget").write <<~BASH
#!/bin/bash
mono #{libexec}/nuget.exe "$@"
EOS
BASH
end

test do
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/numpy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ def caveats
test do
pythons.each do |python|
python3 = python.opt_libexec/"bin/python"
system python3, "-c", <<~EOS
system python3, "-c", <<~PYTHON
import numpy as np
t = np.ones((3,3), int)
assert t.sum() == 9
assert np.dot(t, t).sum() == 27
EOS
PYTHON
end
end
end
4 changes: 2 additions & 2 deletions Formula/n/nvchecker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def install

test do
file = testpath/"example.toml"
file.write <<~EOS
file.write <<~TOML
[nvchecker]
source = "pypi"
pypi = "nvchecker"
EOS
TOML

out = shell_output("#{bin}/nvchecker -c #{file} --logger=json | jq '.[\"version\"]' ").strip
assert_equal "\"#{version}\"", out
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ class Nvm < Formula
end

def install
(prefix/"nvm.sh").write <<~EOS
(prefix/"nvm.sh").write <<~SH
# $NVM_DIR should be "$HOME/.nvm" by default to avoid user-installed nodes destroyed every update
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
\\. #{libexec}/nvm.sh
# "nvm exec" and certain 3rd party scripts expect "nvm.sh" and "nvm-exec" to exist under $NVM_DIR
[ -e "$NVM_DIR" ] || mkdir -p "$NVM_DIR"
[ -e "$NVM_DIR/nvm.sh" ] || ln -s #{opt_libexec}/nvm.sh "$NVM_DIR/nvm.sh"
[ -e "$NVM_DIR/nvm-exec" ] || ln -s #{opt_libexec}/nvm-exec "$NVM_DIR/nvm-exec"
EOS
SH
libexec.install "nvm.sh", "nvm-exec"
prefix.install_symlink libexec/"nvm-exec"
bash_completion.install "bash_completion" => "nvm"
Expand Down
4 changes: 2 additions & 2 deletions Formula/o/ocicl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def install
LISP

# Write a shell script to wrap ocicl
(bin/"ocicl").write <<~EOS
(bin/"ocicl").write <<~LISP
#!/usr/bin/env -S sbcl --core #{libexec}/ocicl.core --script
(uiop:restore-image)
(ocicl:main)
EOS
LISP
end

test do
Expand Down
12 changes: 6 additions & 6 deletions Formula/o/octave.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,22 @@ def install
# This is supposed to crash octave if there is a problem with BLAS
system bin/"octave", "--eval", "single ([1+i 2+i 3+i]) * single ([ 4+i ; 5+i ; 6+i])"
# Test basic compilation
(testpath/"oct_demo.cc").write <<~EOS
(testpath/"oct_demo.cc").write <<~CPP
#include <octave/oct.h>
DEFUN_DLD (oct_demo, args, /*nargout*/, "doc str")
{ return ovl (42); }
EOS
system bin/"octave", "--eval", <<~EOS
CPP
system bin/"octave", "--eval", <<~MATLAB
mkoctfile ('-v', '-std=c++11', '-L#{lib}/octave/#{version}', 'oct_demo.cc');
assert(oct_demo, 42)
EOS
MATLAB
# Test FLIBS environment variable
system bin/"octave", "--eval", <<~EOS
system bin/"octave", "--eval", <<~MATLAB
args = strsplit (mkoctfile ('-p', 'FLIBS'));
args = args(~cellfun('isempty', args));
mkoctfile ('-v', '-std=c++11', '-L#{lib}/octave/#{version}', args{:}, 'oct_demo.cc');
assert(oct_demo, 42)
EOS
MATLAB
ENV["QT_QPA_PLATFORM"] = "minimal"
system bin/"octave", "--gui"
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/o/octosql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def install
ENV["OCTOSQL_NO_TELEMETRY"] = "1"

test_json = testpath/"test.json"
test_json.write <<~EOS
test_json.write <<~JSON
{"field1": "value", "field2": 42, "field3": {"field4": "eulav", "field5": 24}}
{"field1": "value", "field2": 42, "field3": {"field5": "eulav", "field6": "value"}}
EOS
JSON

expected = <<~EOS
+---------+--------+--------------------------+
Expand Down
Loading
Loading