From 2f37e40e38b0cc91d12e00a7dd92d7d2fd5a4646 Mon Sep 17 00:00:00 2001 From: David Engel Date: Wed, 21 Mar 2018 15:09:14 -0600 Subject: [PATCH] Brew audit fixes. --- Aliases/msodbcsql17@17.0 | 1 + Aliases/msodbcsql@13.1 | 1 + Aliases/mssql-tools@17.0 | 1 + Formula/msodbcsql.rb | 57 +++++++++++++++--------------- Formula/msodbcsql17.rb | 12 +++---- Formula/msodbcsql17@17.0.1.1.rb | 16 ++++----- Formula/msodbcsql@13.1.7.0.rb | 61 +++++++++++++++++---------------- Formula/msodbcsql@13.1.9.2.rb | 61 +++++++++++++++++---------------- Formula/mssql-tools.rb | 31 +++++++++-------- Formula/mssql-tools@14.0.6.0.rb | 30 +++++++++------- Formula/mssql-tools@17.0.1.1.rb | 31 +++++++++-------- 11 files changed, 160 insertions(+), 142 deletions(-) create mode 120000 Aliases/msodbcsql17@17.0 create mode 120000 Aliases/msodbcsql@13.1 create mode 120000 Aliases/mssql-tools@17.0 mode change 100755 => 100644 Formula/msodbcsql.rb mode change 100755 => 100644 Formula/msodbcsql@13.1.7.0.rb diff --git a/Aliases/msodbcsql17@17.0 b/Aliases/msodbcsql17@17.0 new file mode 120000 index 0000000..4a5e3b8 --- /dev/null +++ b/Aliases/msodbcsql17@17.0 @@ -0,0 +1 @@ +../Formula/msodbcsql17.rb \ No newline at end of file diff --git a/Aliases/msodbcsql@13.1 b/Aliases/msodbcsql@13.1 new file mode 120000 index 0000000..d4188fd --- /dev/null +++ b/Aliases/msodbcsql@13.1 @@ -0,0 +1 @@ +../Formula/msodbcsql.rb \ No newline at end of file diff --git a/Aliases/mssql-tools@17.0 b/Aliases/mssql-tools@17.0 new file mode 120000 index 0000000..7c50107 --- /dev/null +++ b/Aliases/mssql-tools@17.0 @@ -0,0 +1 @@ +../Formula/mssql-tools.rb \ No newline at end of file diff --git a/Formula/msodbcsql.rb b/Formula/msodbcsql.rb old mode 100755 new mode 100644 index a7e209e..feb68cf --- a/Formula/msodbcsql.rb +++ b/Formula/msodbcsql.rb @@ -1,43 +1,32 @@ class Msodbcsql < Formula desc "ODBC Driver for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" - url "http://download.microsoft.com/download/4/9/5/495639C0-79E4-45A7-B65A-B264071C3D9A/msodbcsql-13.1.9.2.tar.gz" - version "13.1.9.2" + url "https://download.microsoft.com/download/4/9/5/495639C0-79E4-45A7-B65A-B264071C3D9A/msodbcsql-13.1.9.2.tar.gz" sha256 "06f4f45bbf16438d681227c6eeada89cbf03a78c61338bdc5eda51ab0e314e5d" option "without-registration", "Don't register the driver in odbcinst.ini" - def caveats; <<~EOS - If you installed this formula with the registration option (default), you'll - need to manually remove [ODBC Driver 13 for SQL Server] section from - odbcinst.ini after the formula is uninstalled. This can be done by executing - the following command: - odbcinst -u -d -n "ODBC Driver 13 for SQL Server" - EOS - end - depends_on "unixodbc" depends_on "openssl" - def check_eula_acceptance - if ENV["ACCEPT_EULA"] != "y" and ENV["ACCEPT_EULA"] != "Y" then + def check_eula_acceptance? + if ENV["ACCEPT_EULA"] != "y" && ENV["ACCEPT_EULA"] != "Y" puts "The license terms for this product can be downloaded from" puts "https://aka.ms/odbc131eula and found in" puts "/usr/local/share/doc/msodbcsql/LICENSE.txt . By entering 'YES'," puts "you indicate that you accept the license terms." puts "" - while true do + loop do puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp - if accept_eula then - if accept_eula == "YES" then - break - elsif accept_eula == "NO" then + if accept_eula + break if accept_eula == "YES" + if accept_eula == "NO" puts "Installation terminated: License terms not accepted." return false else puts "Please enter YES or NO" - end + end else puts "Installation terminated: Could not prompt for license acceptance." puts "If you are performing an unattended installation, you may set" @@ -46,13 +35,11 @@ class Msodbcsql < Formula end end end - return true + true end def install - if !check_eula_acceptance - return false - end + return false unless check_eula_acceptance? chmod 0444, "lib/libmsodbcsql.13.dylib" chmod 0444, "share/msodbcsql/resources/en_US/msodbcsqlr13.rll" @@ -61,11 +48,27 @@ class Msodbcsql < Formula chmod 0644, "share/doc/msodbcsql/LICENSE.txt" chmod 0644, "share/doc/msodbcsql/RELEASE_NOTES" - cp_r ".", "#{prefix}" + cp_r ".", prefix.to_s - if !build.without? "registration" - system "odbcinst -u -d -n \"ODBC Driver 13 for SQL Server\"" - system "odbcinst -i -d -f ./odbcinst.ini" + if build.with? "registration" + system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 13 for SQL Server\"" + system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" + end + end + + def caveats; <<~EOS + If you installed this formula with the registration option (default), you'll + need to manually remove [ODBC Driver 13 for SQL Server] section from + odbcinst.ini after the formula is uninstalled. This can be done by executing + the following command: + odbcinst -u -d -n "ODBC Driver 13 for SQL Server" + EOS + end + + test do + if build.with? "registration" + out = shell_output("#{Formula["unixodbc"].opt_bin}/odbcinst -q -d") + assert_match "ODBC Driver 13 for SQL Server", out end end end diff --git a/Formula/msodbcsql17.rb b/Formula/msodbcsql17.rb index 41f6aaf..1cbdafd 100644 --- a/Formula/msodbcsql17.rb +++ b/Formula/msodbcsql17.rb @@ -1,13 +1,11 @@ class Msodbcsql17 < Formula desc "ODBC Driver for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" - url "http://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.0.1.1.tar.gz" - version "17.0.1.1" + url "https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.0.1.1.tar.gz" sha256 "4cb8e283896fba583a48215305edc0fd97120de42d804a0a2440e9e8e4b9bbe2" option "without-registration", "Don't register the driver in odbcinst.ini" - depends_on "unixodbc" depends_on "openssl" @@ -22,9 +20,9 @@ class Msodbcsql17 < Formula puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp if accept_eula - if accept_eula.upcase == "YES" + if accept_eula.casecmp("YES").zero? break - elsif accept_eula.upcase == "NO" + elsif accept_eula.casecmp("NO").zero? puts "Installation terminated: License terms not accepted." return false else @@ -54,8 +52,8 @@ class Msodbcsql17 < Formula cp_r ".", prefix.to_s if build.with? "registration" - system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 17 for SQL Server\"" - system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" + system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 17 for SQL Server\"" + system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" end end diff --git a/Formula/msodbcsql17@17.0.1.1.rb b/Formula/msodbcsql17@17.0.1.1.rb index 6a52765..f38db2e 100644 --- a/Formula/msodbcsql17@17.0.1.1.rb +++ b/Formula/msodbcsql17@17.0.1.1.rb @@ -1,15 +1,13 @@ class Msodbcsql17AT17011 < Formula desc "ODBC Driver for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" - url "http://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.0.1.1.tar.gz" - version "17.0.1.1" + url "https://download.microsoft.com/download/1/9/A/19AF548A-6DD3-4B48-88DC-724E9ABCEB9A/msodbcsql-17.0.1.1.tar.gz" sha256 "4cb8e283896fba583a48215305edc0fd97120de42d804a0a2440e9e8e4b9bbe2" - option "without-registration", "Don't register the driver in odbcinst.ini" - - keg_only :versioned_formula + option "without-registration", "Don't register the driver in odbcinst.ini" + depends_on "unixodbc" depends_on "openssl" @@ -24,9 +22,9 @@ class Msodbcsql17AT17011 < Formula puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp if accept_eula - if accept_eula.upcase == "YES" + if accept_eula.casecmp("YES").zero? break - elsif accept_eula.upcase == "NO" + elsif accept_eula.casecmp("NO").zero? puts "Installation terminated: License terms not accepted." return false else @@ -56,8 +54,8 @@ class Msodbcsql17AT17011 < Formula cp_r ".", prefix.to_s if build.with? "registration" - system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 17 for SQL Server\"" - system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" + system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 17 for SQL Server\"" + system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" end end diff --git a/Formula/msodbcsql@13.1.7.0.rb b/Formula/msodbcsql@13.1.7.0.rb old mode 100755 new mode 100644 index beca17f..61e2626 --- a/Formula/msodbcsql@13.1.7.0.rb +++ b/Formula/msodbcsql@13.1.7.0.rb @@ -1,45 +1,34 @@ class MsodbcsqlAT13170 < Formula desc "ODBC Driver for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" - url "http://download.microsoft.com/download/4/9/5/495639C0-79E4-45A7-B65A-B264071C3D9A/msodbcsql-13.1.7.0.tar.gz" - version "13.1.7.0" + url "https://download.microsoft.com/download/4/9/5/495639C0-79E4-45A7-B65A-B264071C3D9A/msodbcsql-13.1.7.0.tar.gz" sha256 "2f9dd8f3baeab18539ab35e2ec83a3d87a81a056244408edc242696f3314f566" - option "without-registration", "Don't register the driver in odbcinst.ini" - - def caveats; <<~EOS - If you installed this formula with the registration option (default), you'll - need to manually remove [ODBC Driver 13 for SQL Server] section from - odbcinst.ini after the formula is uninstalled. This can be done by executing - the following command: - odbcinst -u -d -n "ODBC Driver 13 for SQL Server" - EOS - end - keg_only :versioned_formula + option "without-registration", "Don't register the driver in odbcinst.ini" + depends_on "unixodbc" depends_on "openssl" - def check_eula_acceptance - if ENV["ACCEPT_EULA"] != "y" and ENV["ACCEPT_EULA"] != "Y" then + def check_eula_acceptance? + if ENV["ACCEPT_EULA"] != "y" && ENV["ACCEPT_EULA"] != "Y" puts "The license terms for this product can be downloaded from" puts "https://aka.ms/odbc131eula and found in" puts "/usr/local/share/doc/msodbcsql/LICENSE.txt . By entering 'YES'," puts "you indicate that you accept the license terms." puts "" - while true do + loop do puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp - if accept_eula then - if accept_eula == "YES" then - break - elsif accept_eula == "NO" then + if accept_eula + break if accept_eula == "YES" + if accept_eula == "NO" puts "Installation terminated: License terms not accepted." return false else puts "Please enter YES or NO" - end + end else puts "Installation terminated: Could not prompt for license acceptance." puts "If you are performing an unattended installation, you may set" @@ -48,13 +37,11 @@ class MsodbcsqlAT13170 < Formula end end end - return true + true end def install - if !check_eula_acceptance - return false - end + return false unless check_eula_acceptance? chmod 0444, "lib/libmsodbcsql.13.dylib" chmod 0444, "share/msodbcsql/resources/en_US/msodbcsqlr13.rll" @@ -62,11 +49,27 @@ class MsodbcsqlAT13170 < Formula chmod 0644, "odbcinst.ini" chmod 0644, "share/doc/msodbcsql/LICENSE.txt" - cp_r ".", "#{prefix}" + cp_r ".", prefix.to_s - if !build.without? "registration" - system "odbcinst -u -d -n \"ODBC Driver 13 for SQL Server\"" - system "odbcinst -i -d -f ./odbcinst.ini" + if build.with? "registration" + system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 13 for SQL Server\"" + system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" + end + end + + def caveats; <<~EOS + If you installed this formula with the registration option (default), you'll + need to manually remove [ODBC Driver 13 for SQL Server] section from + odbcinst.ini after the formula is uninstalled. This can be done by executing + the following command: + odbcinst -u -d -n "ODBC Driver 13 for SQL Server" + EOS + end + + test do + if build.with? "registration" + out = shell_output("#{Formula["unixodbc"].opt_bin}/odbcinst -q -d") + assert_match "ODBC Driver 13 for SQL Server", out end end end diff --git a/Formula/msodbcsql@13.1.9.2.rb b/Formula/msodbcsql@13.1.9.2.rb index df2c8d7..9dfaf49 100644 --- a/Formula/msodbcsql@13.1.9.2.rb +++ b/Formula/msodbcsql@13.1.9.2.rb @@ -1,45 +1,34 @@ class MsodbcsqlAT13192 < Formula desc "ODBC Driver for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/mt654048(v=sql.1).aspx" - url "http://download.microsoft.com/download/4/9/5/495639C0-79E4-45A7-B65A-B264071C3D9A/msodbcsql-13.1.9.2.tar.gz" - version "13.1.9.2" + url "https://download.microsoft.com/download/4/9/5/495639C0-79E4-45A7-B65A-B264071C3D9A/msodbcsql-13.1.9.2.tar.gz" sha256 "06f4f45bbf16438d681227c6eeada89cbf03a78c61338bdc5eda51ab0e314e5d" - option "without-registration", "Don't register the driver in odbcinst.ini" - - def caveats; <<~EOS - If you installed this formula with the registration option (default), you'll - need to manually remove [ODBC Driver 13 for SQL Server] section from - odbcinst.ini after the formula is uninstalled. This can be done by executing - the following command: - odbcinst -u -d -n "ODBC Driver 13 for SQL Server" - EOS - end - keg_only :versioned_formula + option "without-registration", "Don't register the driver in odbcinst.ini" + depends_on "unixodbc" depends_on "openssl" - def check_eula_acceptance - if ENV["ACCEPT_EULA"] != "y" and ENV["ACCEPT_EULA"] != "Y" then + def check_eula_acceptance? + if ENV["ACCEPT_EULA"] != "y" && ENV["ACCEPT_EULA"] != "Y" puts "The license terms for this product can be downloaded from" puts "https://aka.ms/odbc131eula and found in" puts "/usr/local/share/doc/msodbcsql/LICENSE.txt . By entering 'YES'," puts "you indicate that you accept the license terms." puts "" - while true do + loop do puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp - if accept_eula then - if accept_eula == "YES" then - break - elsif accept_eula == "NO" then + if accept_eula + break if accept_eula == "YES" + if accept_eula == "NO" puts "Installation terminated: License terms not accepted." return false else puts "Please enter YES or NO" - end + end else puts "Installation terminated: Could not prompt for license acceptance." puts "If you are performing an unattended installation, you may set" @@ -48,13 +37,11 @@ class MsodbcsqlAT13192 < Formula end end end - return true + true end def install - if !check_eula_acceptance - return false - end + return false unless check_eula_acceptance? chmod 0444, "lib/libmsodbcsql.13.dylib" chmod 0444, "share/msodbcsql/resources/en_US/msodbcsqlr13.rll" @@ -63,11 +50,27 @@ class MsodbcsqlAT13192 < Formula chmod 0644, "share/doc/msodbcsql/LICENSE.txt" chmod 0644, "share/doc/msodbcsql/RELEASE_NOTES" - cp_r ".", "#{prefix}" + cp_r ".", prefix.to_s - if !build.without? "registration" - system "odbcinst -u -d -n \"ODBC Driver 13 for SQL Server\"" - system "odbcinst -i -d -f ./odbcinst.ini" + if build.with? "registration" + system "odbcinst", "-u", "-d", "-n", "\"ODBC Driver 13 for SQL Server\"" + system "odbcinst", "-i", "-d", "-f", "./odbcinst.ini" + end + end + + def caveats; <<~EOS + If you installed this formula with the registration option (default), you'll + need to manually remove [ODBC Driver 13 for SQL Server] section from + odbcinst.ini after the formula is uninstalled. This can be done by executing + the following command: + odbcinst -u -d -n "ODBC Driver 13 for SQL Server" + EOS + end + + test do + if build.with? "registration" + out = shell_output("#{Formula["unixodbc"].opt_bin}/odbcinst -q -d") + assert_match "ODBC Driver 13 for SQL Server", out end end end diff --git a/Formula/mssql-tools.rb b/Formula/mssql-tools.rb index fc7ba01..e8ae72f 100644 --- a/Formula/mssql-tools.rb +++ b/Formula/mssql-tools.rb @@ -1,28 +1,26 @@ class MssqlTools < Formula desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx" - url "http://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.0.1.1.tar.gz" - version "17.0.1.1" + url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.0.1.1.tar.gz" sha256 "61fe8c34e6695b04ac12008c697c888bf9a85dad5490d3cf8b535d358c258a5d" depends_on "unixodbc" depends_on "openssl" depends_on "msodbcsql17" - def check_eula_acceptance - if ENV["ACCEPT_EULA"] != "y" and ENV["ACCEPT_EULA"] != "Y" then + def check_eula_acceptance? + if ENV["ACCEPT_EULA"] != "y" && ENV["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 "" - while true do + loop do puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp - if accept_eula then - if accept_eula.upcase == "YES" then - break - elsif accept_eula.upcase == "NO" then + 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 @@ -36,13 +34,11 @@ class MssqlTools < Formula end end end - return true + true end def install - if !check_eula_acceptance - return false - end + return false unless check_eula_acceptance? chmod 0444, "bin/sqlcmd" chmod 0444, "bin/bcp" @@ -53,6 +49,13 @@ class MssqlTools < Formula chmod 0644, "usr/share/doc/mssql-tools/LICENSE.txt" chmod 0644, "usr/share/doc/mssql-tools/THIRDPARTYNOTICES.txt" - cp_r ".", "#{prefix}" + 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 diff --git a/Formula/mssql-tools@14.0.6.0.rb b/Formula/mssql-tools@14.0.6.0.rb index 5c45946..98a8834 100644 --- a/Formula/mssql-tools@14.0.6.0.rb +++ b/Formula/mssql-tools@14.0.6.0.rb @@ -9,20 +9,19 @@ class MssqlToolsAT14060 < Formula depends_on "openssl" depends_on "msodbcsql" - def check_eula_acceptance - if ENV["ACCEPT_EULA"] != "y" and ENV["ACCEPT_EULA"] != "Y" then + def check_eula_acceptance? + if ENV["ACCEPT_EULA"] != "y" && ENV["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 "" - while true do + loop do puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp - if accept_eula then - if accept_eula == "YES" then - break - elsif accept_eula == "NO" then + if accept_eula + break if accept_eula == "YES" + if accept_eula == "NO" puts "Installation terminated: License terms not accepted." return false else @@ -36,13 +35,11 @@ class MssqlToolsAT14060 < Formula end end end - return true + true end def install - if !check_eula_acceptance - return false - end + return false unless check_eula_acceptance? chmod 0444, "bin/sqlcmd" chmod 0444, "bin/bcp" @@ -53,6 +50,13 @@ class MssqlToolsAT14060 < Formula chmod 0644, "usr/share/doc/mssql-tools/LICENSE.txt" chmod 0644, "usr/share/doc/mssql-tools/THIRDPARTYNOTICES.txt" - cp_r ".", "#{prefix}" + cp_r ".", prefix.to_s end -end \ No newline at end of file + + 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 diff --git a/Formula/mssql-tools@17.0.1.1.rb b/Formula/mssql-tools@17.0.1.1.rb index 509a946..2b323fa 100644 --- a/Formula/mssql-tools@17.0.1.1.rb +++ b/Formula/mssql-tools@17.0.1.1.rb @@ -1,28 +1,26 @@ class MssqlToolsAT17011 < Formula desc "Sqlcmd and Bcp for Microsoft(R) SQL Server(R)" homepage "https://msdn.microsoft.com/en-us/library/ms162773.aspx" - url "http://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.0.1.1.tar.gz" - version "17.0.1.1" + url "https://download.microsoft.com/download/F/D/1/FD16AA69-F27D-440E-A15A-6C521A1972E6/mssql-tools-17.0.1.1.tar.gz" sha256 "61fe8c34e6695b04ac12008c697c888bf9a85dad5490d3cf8b535d358c258a5d" depends_on "unixodbc" depends_on "openssl" depends_on "msodbcsql17" - def check_eula_acceptance - if ENV["ACCEPT_EULA"] != "y" and ENV["ACCEPT_EULA"] != "Y" then + def check_eula_acceptance? + if ENV["ACCEPT_EULA"] != "y" && ENV["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 "" - while true do + loop do puts "Do you accept the license terms? (Enter YES or NO)" accept_eula = STDIN.gets.chomp - if accept_eula then - if accept_eula.upcase == "YES" then - break - elsif accept_eula.upcase == "NO" then + if accept_eula + break if accept_eula == "YES" + if accept_eula == "NO" puts "Installation terminated: License terms not accepted." return false else @@ -36,13 +34,11 @@ class MssqlToolsAT17011 < Formula end end end - return true + true end def install - if !check_eula_acceptance - return false - end + return false unless check_eula_acceptance? chmod 0444, "bin/sqlcmd" chmod 0444, "bin/bcp" @@ -53,6 +49,13 @@ class MssqlToolsAT17011 < Formula chmod 0644, "usr/share/doc/mssql-tools/LICENSE.txt" chmod 0644, "usr/share/doc/mssql-tools/THIRDPARTYNOTICES.txt" - cp_r ".", "#{prefix}" + 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