Skip to content

Commit 9c88ff5

Browse files
authored
Merge pull request #217297 from botantony/hjson
hjson 4.4.0 (new formula)
2 parents 9c99b1c + 8720bca commit 9c88ff5

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

.github/autobump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,7 @@ hexo
14591459
hexyl
14601460
hfstospell
14611461
hgrep
1462+
hjson
14621463
hickory-dns
14631464
hidapi
14641465
highlight

Formula/h/hjson.rb

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
class Hjson < Formula
2+
desc "Convert JSON to HJSON and vice versa"
3+
homepage "https://hjson.github.io/"
4+
url "https://github.com/hjson/hjson-go/archive/refs/tags/v4.4.0.tar.gz"
5+
sha256 "ba09dd33d655d99578f78722035e136449fcc6eaf1dc1b12eef1f0bb858749d4"
6+
license "MIT"
7+
head "https://github.com/hjson/hjson-go.git", branch: "master"
8+
9+
bottle do
10+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "a524276874872d3ffbfee5f62065b5a6f6e23471ca54462b1c51d4871629fdd3"
11+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "a524276874872d3ffbfee5f62065b5a6f6e23471ca54462b1c51d4871629fdd3"
12+
sha256 cellar: :any_skip_relocation, arm64_ventura: "a524276874872d3ffbfee5f62065b5a6f6e23471ca54462b1c51d4871629fdd3"
13+
sha256 cellar: :any_skip_relocation, sonoma: "820698eab9d0e0387089b4ef8bae5241a467b5cadbddfc75637aab484af2029f"
14+
sha256 cellar: :any_skip_relocation, ventura: "820698eab9d0e0387089b4ef8bae5241a467b5cadbddfc75637aab484af2029f"
15+
sha256 cellar: :any_skip_relocation, x86_64_linux: "601b7b091f0d37b1d40e798903dc3fa4fe1a4dbf80caa7de60cce49ad5831707"
16+
end
17+
18+
depends_on "go" => :build
19+
20+
def install
21+
system "go", "build", *std_go_args(ldflags: "-s -w -X main.Version=#{version}"), "./hjson-cli"
22+
end
23+
24+
test do
25+
assert_match version.to_s, shell_output("#{bin}/hjson -v")
26+
27+
(testpath/"test.hjson").write <<~HJSON
28+
{
29+
# comment
30+
// a comment too
31+
/*
32+
* multiline comments
33+
*/
34+
rate: 1000
35+
key: value
36+
text: look ma, no quotes!
37+
commas:
38+
{
39+
one: 1
40+
two: 2
41+
}
42+
trailing:
43+
{
44+
one: 1
45+
two: 2
46+
}
47+
haiku:
48+
'''
49+
JSON I love you.
50+
But you strangle my expression.
51+
This is so much better.
52+
'''
53+
favNumbers:
54+
[
55+
1
56+
2
57+
3
58+
6
59+
42
60+
]
61+
}
62+
HJSON
63+
64+
(testpath/"expected.json").write <<~JSON
65+
{
66+
commas:
67+
{
68+
one: 1
69+
two: 2
70+
}
71+
favNumbers:
72+
[
73+
1
74+
2
75+
3
76+
6
77+
42
78+
]
79+
haiku:
80+
'''
81+
JSON I love you.
82+
But you strangle my expression.
83+
This is so much better.
84+
'''
85+
key: value
86+
rate: 1000
87+
text: look ma, no quotes!
88+
trailing:
89+
{
90+
one: 1
91+
two: 2
92+
}
93+
}
94+
JSON
95+
96+
assert_equal (testpath/"expected.json").read, shell_output("#{bin}/hjson #{testpath}/test.hjson")
97+
end
98+
end

0 commit comments

Comments
 (0)