Skip to content

Commit 267f021

Browse files
authored
Merge pull request Homebrew#225316 from Homebrew/crd2pulumi
crd2pulumi 1.5.4 (new formula)
2 parents c094ce4 + 491792f commit 267f021

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.github/autobump.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ crabz
696696
cracklib
697697
crane
698698
crates-tui
699+
crd2pulumi
699700
cri-tools
700701
crispy-doom
701702
croaring

Formula/c/crd2pulumi.rb

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
class Crd2pulumi < Formula
2+
desc "Generate typed CustomResources from a Kubernetes CustomResourceDefinition"
3+
homepage "https://github.com/pulumi/crd2pulumi"
4+
url "https://github.com/pulumi/crd2pulumi/archive/refs/tags/v1.5.4.tar.gz"
5+
sha256 "3dfb4e2e7eb9633c156c78becb866836760ee4c87056d0c47a8288cef85dc14c"
6+
license "Apache-2.0"
7+
head "https://github.com/pulumi/crd2pulumi.git", branch: "master"
8+
9+
bottle do
10+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "8170fedbf98664acb53a30c8534c6c879b1726ccf71d11a15a43005e76e3db3e"
11+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "bd3797b91aa02e1f26a4f8a38e9eed076ba077c801eaa258fcc14b5b6c9f5ec3"
12+
sha256 cellar: :any_skip_relocation, arm64_ventura: "34e1288847de72027899d4fd4ad491a98b1182f1a7d601dec396435dcd79fbaa"
13+
sha256 cellar: :any_skip_relocation, sonoma: "e3e04265eaa6c1910e0d05fec10abcdd1a16609965b2ecbf3c31928a78ec87db"
14+
sha256 cellar: :any_skip_relocation, ventura: "8d722d5239b46bf83507362e64a913c85c5cbb768d4e40dfc31bfcf59baa0331"
15+
sha256 cellar: :any_skip_relocation, x86_64_linux: "3a6f39e942c24af8ab6577bed69d1ce3c27fdcad9310225d2e248448b22da5ea"
16+
end
17+
18+
depends_on "go" => :build
19+
20+
def install
21+
system "go", "build", *std_go_args(ldflags: "-s -w -X github.com/pulumi/crd2pulumi/cmd.Version=#{version}")
22+
23+
generate_completions_from_executable(bin/"crd2pulumi", "completion")
24+
end
25+
26+
test do
27+
assert_match version.to_s, shell_output("#{bin}/crd2pulumi version")
28+
29+
test_crd = testpath/"crd.yaml"
30+
test_crd.write <<~YAML
31+
apiVersion: apiextensions.k8s.io/v1
32+
kind: CustomResourceDefinition
33+
metadata:
34+
name: widgets.example.com
35+
spec:
36+
group: example.com
37+
names:
38+
kind: Widget
39+
plural: widgets
40+
singular: widget
41+
scope: Namespaced
42+
versions:
43+
- name: v1
44+
served: true
45+
storage: true
46+
schema:
47+
openAPIV3Schema:
48+
type: object
49+
properties:
50+
spec:
51+
type: object
52+
properties:
53+
size:
54+
type: string
55+
color:
56+
type: string
57+
YAML
58+
59+
# Generate TypeScript code from the CRD
60+
system bin/"crd2pulumi", "--nodejsPath", testpath/"typescript", test_crd, "--force"
61+
62+
assert_path_exists testpath/"typescript/example/v1/widget.ts"
63+
assert_match "this file was generated by crd2pulumi", (testpath/"typescript/provider.ts").read
64+
65+
# Generate Python code from the CRD
66+
system bin/"crd2pulumi", "--pythonPath", testpath/"python", "--python", test_crd
67+
assert_path_exists testpath/"python/pulumi_crds/example/v1/Widget.py"
68+
assert_match "this file was generated by crd2pulumi", (testpath/"python/pulumi_crds/provider.py").read
69+
end
70+
end

0 commit comments

Comments
 (0)