/
sql-translator.rb
129 lines (105 loc) 路 5.12 KB
/
sql-translator.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
require "language/perl"
class SqlTranslator < Formula
include Language::Perl::Shebang
desc "Manipulate structured data definitions (SQL and more)"
homepage "https://github.com/dbsrgits/sql-translator/"
url "https://cpan.metacpan.org/authors/id/I/IL/ILMARI/SQL-Translator-1.62.tar.gz"
sha256 "0acd4ff9ac3a2f8d5d67199aac02cdc127e03888e479c51c7bbdc21b85c1ce24"
license any_of: ["Artistic-1.0-Perl", "GPL-1.0-or-later"]
revision 2
bottle do
sha256 cellar: :any_skip_relocation, arm64_sonoma: "78517f7f8c11b9e601ed833b1d9d150504bf1025593cc5118eb28b8aca635395"
sha256 cellar: :any_skip_relocation, arm64_ventura: "a9130885a44e325a2bac38b12376f2256999c29ec25ebe9c68205abadfd6626b"
sha256 cellar: :any_skip_relocation, arm64_monterey: "a9130885a44e325a2bac38b12376f2256999c29ec25ebe9c68205abadfd6626b"
sha256 cellar: :any_skip_relocation, sonoma: "abfe61301d558ba8458966977b541d98287ee8eb61f7f2561a4b82aa93ba40b9"
sha256 cellar: :any_skip_relocation, ventura: "4c2d1a17220491814d9cb9e728b17c78f1ed7de30403d956f612dc95e25d3221"
sha256 cellar: :any_skip_relocation, monterey: "4c2d1a17220491814d9cb9e728b17c78f1ed7de30403d956f612dc95e25d3221"
sha256 cellar: :any_skip_relocation, x86_64_linux: "9e6eb190aaf0e23c87a415f8794c292bf9443b6d8c65ada6736693392fe74608"
end
uses_from_macos "perl"
on_linux do
resource "Moo" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Moo-2.003006.tar.gz"
sha256 "bcb2092ab18a45005b5e2e84465ebf3a4999d8e82a43a09f5a94d859ae7f2472"
end
resource "Module::Runtime" do
url "https://cpan.metacpan.org/authors/id/Z/ZE/ZEFRAM/Module-Runtime-0.016.tar.gz"
sha256 "68302ec646833547d410be28e09676db75006f4aa58a11f3bdb44ffe99f0f024"
end
resource "Sub::Quote" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Sub-Quote-2.006006.tar.gz"
sha256 "6e4e2af42388fa6d2609e0e82417de7cc6be47223f576592c656c73c7524d89d"
end
resource "Try::Tiny" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Try-Tiny-0.30.tar.gz"
sha256 "da5bd0d5c903519bbf10bb9ba0cb7bcac0563882bcfe4503aee3fb143eddef6b"
end
resource "Import::Into" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Import-Into-1.002005.tar.gz"
sha256 "bd9e77a3fb662b40b43b18d3280cd352edf9fad8d94283e518181cc1ce9f0567"
end
resource "Role::Tiny" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/Role-Tiny-2.001004.tar.gz"
sha256 "92ba5712850a74102c93c942eb6e7f62f7a4f8f483734ed289d08b324c281687"
end
resource "Class::Method::Modifiers" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Class-Method-Modifiers-2.13.tar.gz"
sha256 "ab5807f71018a842de6b7a4826d6c1f24b8d5b09fcce5005a3309cf6ea40fd63"
end
resource "DBI" do
url "https://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz"
sha256 "8a2b993db560a2c373c174ee976a51027dd780ec766ae17620c20393d2e836fa"
end
resource "Carp::Clan" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Carp-Clan-6.08.tar.gz"
sha256 "c75f92e34422cc5a65ab05d155842b701452434e9aefb649d6e2289c47ef6708"
end
resource "Parse::RecDescent" do
url "https://cpan.metacpan.org/authors/id/J/JT/JTBRAUN/Parse-RecDescent-1.967015.tar.gz"
sha256 "1943336a4cb54f1788a733f0827c0c55db4310d5eae15e542639c9dd85656e37"
end
end
resource "File::ShareDir::Install" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/File-ShareDir-Install-0.13.tar.gz"
sha256 "45befdf0d95cbefe7c25a1daf293d85f780d6d2576146546e6828aad26e580f9"
end
resource "Package::Variant" do
url "https://cpan.metacpan.org/authors/id/M/MS/MSTROUT/Package-Variant-1.003002.tar.gz"
sha256 "b2ed849d2f4cdd66467512daa3f143266d6df810c5fae9175b252c57bc1536dc"
end
resource "strictures" do
url "https://cpan.metacpan.org/authors/id/H/HA/HAARG/strictures-2.000006.tar.gz"
sha256 "09d57974a6d1b2380c802870fed471108f51170da81458e2751859f2714f8d57"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resources.each do |r|
r.stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make"
system "make", "install"
end
end
system "perl", "Makefile.PL", "--defaultdeps",
"INSTALL_BASE=#{libexec}",
"INSTALLSITESCRIPT=#{bin}",
"INSTALLSITEMAN1DIR=#{man1}",
"INSTALLSITEMAN3DIR=#{man3}"
system "make", "install"
# Disable dynamic selection of perl which may cause segfault when an
# incompatible perl is picked up.
# https://github.com/Homebrew/homebrew-core/issues/4936
rewrite_shebang detected_perl_shebang, *bin.children
bin.env_script_all_files libexec/"bin", PERL5LIB: ENV["PERL5LIB"]
end
test do
command = "#{bin}/sqlt -f MySQL -t PostgreSQL --no-comments -"
sql_input = "create table sqlt ( id int AUTO_INCREMENT );"
sql_output = <<~EOS
CREATE TABLE "sqlt" (
"id" serial
);
EOS
assert_equal sql_output, pipe_output(command, sql_input)
end
end