63 строки
2.3 KiB
Ruby
63 строки
2.3 KiB
Ruby
class MssqlToolsAT17611 < Formula
|
|
desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)"
|
|
homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx"
|
|
url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.6.1.1.tar.gz"
|
|
version "17.6.1.1"
|
|
sha256 "0f1f4096edcf72086c4ec518bf1ec8842da3fe5d1ee2375542b9bf5fa37e49ea"
|
|
|
|
depends_on "unixodbc"
|
|
depends_on "openssl"
|
|
depends_on "msodbcsql17"
|
|
|
|
def check_eula_acceptance?
|
|
if ENV["HOMEBREW_ACCEPT_EULA"] != "y" && ENV["HOMEBREW_ACCEPT_EULA"] != "Y"
|
|
puts "The license terms for this product can be downloaded from"
|
|
puts "http://go.microsoft.com/fwlink/?LinkId=746949 and found in"
|
|
puts "/usr/local/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',"
|
|
puts "you indicate that you accept the license terms."
|
|
puts ""
|
|
loop do
|
|
puts "Do you accept the license terms? (Enter YES or NO)"
|
|
accept_eula = STDIN.gets.chomp
|
|
if accept_eula
|
|
break if accept_eula.casecmp("YES").zero?
|
|
if accept_eula.casecmp("NO").zero?
|
|
puts "Installation terminated: License terms not accepted."
|
|
return false
|
|
else
|
|
puts "Please enter YES or NO"
|
|
end
|
|
else
|
|
puts "Installation terminated: Could not prompt for license acceptance."
|
|
puts "If you are performing an unattended installation, you may set"
|
|
puts "HOMEBREW_ACCEPT_EULA to Y to indicate your acceptance of the license terms."
|
|
return false
|
|
end
|
|
end
|
|
end
|
|
true
|
|
end
|
|
|
|
def install
|
|
return false unless check_eula_acceptance?
|
|
|
|
chmod 0444, "bin/sqlcmd"
|
|
chmod 0444, "bin/bcp"
|
|
chmod 0444, "share/resources/en_US/BatchParserGrammar.dfa"
|
|
chmod 0444, "share/resources/en_US/BatchParserGrammar.llr"
|
|
chmod 0444, "share/resources/en_US/bcp.rll"
|
|
chmod 0444, "share/resources/en_US/SQLCMD.rll"
|
|
chmod 0644, "usr/share/doc/mssql-tools/LICENSE.txt"
|
|
chmod 0644, "usr/share/doc/mssql-tools/THIRDPARTYNOTICES.txt"
|
|
|
|
cp_r ".", prefix.to_s
|
|
end
|
|
|
|
test do
|
|
out = shell_output("#{bin}/sqlcmd -?")
|
|
assert_match "Microsoft (R) SQL Server Command Line Tool", out
|
|
out = shell_output("#{bin}/bcp -v")
|
|
assert_match "BCP - Bulk Copy Program for Microsoft SQL Server", out
|
|
end
|
|
end
|