diff --git a/Formula/sqitch.rb b/Formula/sqitch.rb index 4ad7611..310af3f 100644 --- a/Formula/sqitch.rb +++ b/Formula/sqitch.rb @@ -1,44 +1,42 @@ -require 'formula' -require_relative '../requirements/snowflake_req' -require_relative '../requirements/firebird_req' -require_relative '../requirements/oracle_req' -require_relative '../requirements/vertica_req' -require_relative '../requirements/exasol_req' +require_relative "../requirements/snowflake_req" +require_relative "../requirements/firebird_req" +require_relative "../requirements/oracle_req" +require_relative "../requirements/vertica_req" +require_relative "../requirements/exasol_req" class Sqitch < Formula - homepage 'https://sqitch.org/' - version 'v1.4.0' - url "https://www.cpan.org/authors/id/D/DW/DWHEELER/App-Sqitch-#{stable.version}.tar.gz" - sha256 'b0db387031f77562662e003bc55d7a102a26380b4ad7fdb9a8a3bad5769e501c' - head 'https://github.com/sqitchers/sqitch.git', branch: 'main' - depends_on 'perl' - depends_on 'cpm' => :build - - option 'with-postgres-support', "Support for managing PostgreSQL-compatible databases" - option 'with-sqlite-support', "Support for managing SQLite databases" - option 'with-mysql-support', "Support for managing MySQL databases" - option 'with-firebird-support', "Support for managing Firbird databases" - option 'with-oracle-support', "Support for managing Oracle databases" - option 'with-vertica-support', "Support for managing Vertica databases" - option 'with-exasol-support', "Support for managing Exasol databases" - option 'with-snowflake-support', "Support for managing Snowflake databases" - option 'with-std-env', "Build against custom non-Homebrew dependencies" - - if build.with? "std-env" - env :std - end + desc "Sensible database change management" + homepage "https://sqitch.org/" + url "https://www.cpan.org/authors/id/D/DW/DWHEELER/App-Sqitch-v1.4.0.tar.gz" + sha256 "b0db387031f77562662e003bc55d7a102a26380b4ad7fdb9a8a3bad5769e501c" + license "MIT" + head "https://github.com/sqitchers/sqitch.git", branch: "develop" + + option "with-postgres-support", "Support for managing PostgreSQL-compatible databases" + option "with-sqlite-support", "Support for managing SQLite databases" + option "with-mysql-support", "Support for managing MySQL databases" + option "with-firebird-support", "Support for managing Firbird databases" + option "with-oracle-support", "Support for managing Oracle databases" + option "with-vertica-support", "Support for managing Vertica databases" + option "with-exasol-support", "Support for managing Exasol databases" + option "with-snowflake-support", "Support for managing Snowflake databases" + option "with-std-env", "Build against custom non-Homebrew dependencies" + + depends_on "cpm" => :build + depends_on FirebirdReq if build.with? "firebird-support" + depends_on "libpq" if build.with? "postgres-support" + depends_on "mysql-client" if build.with? "mysql-support" + depends_on OracleReq if build.with? "oracle-support" + depends_on "perl" + depends_on "sqlite" if build.with? "sqlite-support" + + env :std if build.with? "std-env" if build.head? - depends_on 'gettext' => :build + depends_on "gettext" => :build depends_on "openssl@3" => :build end - depends_on 'libpq' if build.with? "postgres-support" - depends_on 'sqlite' if build.with? "sqlite-support" - depends_on 'mysql-client' if build.with? "mysql-support" - depends_on FirebirdReq if build.with? "firebird-support" - depends_on OracleReq if build.with? "oracle-support" - if build.with? "vertica-support" depends_on "libiodbc" depends_on VerticaReq @@ -56,33 +54,33 @@ class Sqitch < Formula def install # Download Module::Build and Menlo::CLI::Compat. - cpmArgs = %W[install --local-lib-contained instutil --no-test]; - cpmArgs.push("--verbose") if verbose? - # cpmArgs.push("--quiet") if quiet? - system 'cpm', *cpmArgs, 'Menlo::CLI::Compat', 'Module::Build' + cpan_args = %w[install --local-lib-contained instutil --no-test] + cpan_args.push("--verbose") if verbose? + # cpan_args.push("--quiet") if quiet? + system "cpm", *cpan_args, "Menlo::CLI::Compat", "Module::Build" - ENV['PERL5LIB'] = "#{buildpath}/instutil/lib/perl5" - ENV['PERL_MM_OPT'] = 'INSTALLDIRS=vendor' - ENV['PERL_MB_OPT'] = '--installdirs vendor' + ENV["PERL5LIB"] = "#{buildpath}/instutil/lib/perl5" + ENV["PERL_MM_OPT"] = "INSTALLDIRS=vendor" + ENV["PERL_MB_OPT"] = "--installdirs vendor" if build.head? # Need to tell the compiler where to find Gettext. ENV.prepend_path "PATH", Formula["gettext"].opt_bin # Download Dist::Zilla and plugins, then make and cd into a build dir. - system 'cpm', *cpmArgs, 'Dist::Zilla' - system './instutil/bin/dzil authordeps --missing | xargs cpm ' + cpmArgs.join(' ') - system './instutil/bin/dzil', 'build', '--in', '.brew' - Dir.chdir '.brew' + system "cpm", *cpan_args, "Dist::Zilla" + system "./instutil/bin/dzil authordeps --missing | xargs cpm " + cpan_args.join(" ") + system "./instutil/bin/dzil", "build", "--in", ".brew" + Dir.chdir ".brew" end # Pull together features. args = %W[Build.PL --install_base #{prefix} --etcdir #{etc}/sqitch] args.push("--verbose") if verbose? args.push("--quiet") if quiet? - %w{postgres sqlite mysql firebird oracle vertica exasol snowflake}.each { |f| - args.push("--with", f) if build.with? "#{ f }-support" - } + %w[postgres sqlite mysql firebird oracle vertica exasol snowflake].each do |f| + args.push("--with", f) if build.with? "#{f}-support" + end # Build and bundle (install). # XXX Fix for wayward Data::Dump in v1.4.0. @@ -94,29 +92,27 @@ def install # https://github.com/orgs/Homebrew/discussions/4391 if build.with?("postgres-support") || build.with?("mysql-support") paths = [] - if build.with? "postgres-support" - paths.push(Formula["libpq"].opt_bin) - end - if build.with? "mysql-support" - paths.push(Formula["mysql-client"].opt_bin) - end + paths.push(Formula["libpq"].opt_bin) if build.with? "postgres-support" + paths.push(Formula["mysql-client"].opt_bin) if build.with? "mysql-support" mkdir_p libexec mv bin/"sqitch", libexec/"sqitch" (bin/"sqitch").write_env_script libexec/"sqitch", PATH: "#{paths.join(":")}:$PATH" end - # Move the man pages from #{prefix}/man to #{prefix}/share/man. - mkdir "#{prefix}/share" - mv "#{prefix}/man", "#{prefix}/share/man" + # Move the man pages from #{prefix}/man to man. + mkdir share + mv "#{prefix}/man", man end def post_install # Show notes from requirements. requirements.each do |req| - if req.respond_to? :notes - ohai "#{ req.name } Support Notes", req.notes - end + ohai "#{req.name} Support Notes", req.notes if req.respond_to? :notes end end + + test do + system bin/"sqitch", "--version" + end end diff --git a/Formula/sqitch_firebird.rb b/Formula/sqitch_firebird.rb index 1150ace..6f736d1 100644 --- a/Formula/sqitch_firebird.rb +++ b/Formula/sqitch_firebird.rb @@ -1,9 +1,8 @@ -require 'formula' - class SqitchFirebird < Formula - homepage 'https://sqitch.org/' - version '0' - url "file://#{HOMEBREW_REPOSITORY}/README.md", :using => :nounzip + desc "Replaced by `brew install sqitch --with-firebird-support`" + homepage "https://sqitch.org/" + url "file://#{HOMEBREW_REPOSITORY}/README.md", using: :nounzip + version "0" sha256 Pathname.new("#{HOMEBREW_REPOSITORY}/README.md").sha256 def install @@ -19,5 +18,4 @@ def install EOS end - end diff --git a/Formula/sqitch_mysql.rb b/Formula/sqitch_mysql.rb index cfdcc1e..892c9ae 100644 --- a/Formula/sqitch_mysql.rb +++ b/Formula/sqitch_mysql.rb @@ -1,9 +1,8 @@ -require 'formula' - class SqitchMysql < Formula - homepage 'https://sqitch.org/' - version '0' - url "file://#{HOMEBREW_REPOSITORY}/README.md", :using => :nounzip + desc "Replaced by `brew install sqitch --with-mysql-support`" + homepage "https://sqitch.org/" + url "file://#{HOMEBREW_REPOSITORY}/README.md", using: :nounzip + version "0" sha256 Pathname.new("#{HOMEBREW_REPOSITORY}/README.md").sha256 def install @@ -19,5 +18,4 @@ def install EOS end - end diff --git a/Formula/sqitch_oracle.rb b/Formula/sqitch_oracle.rb index 0da651e..17c99db 100644 --- a/Formula/sqitch_oracle.rb +++ b/Formula/sqitch_oracle.rb @@ -1,9 +1,8 @@ -require 'formula' - class SqitchOracle < Formula - homepage 'https://sqitch.org/' - version '0' - url "file://#{HOMEBREW_REPOSITORY}/README.md", :using => :nounzip + desc "Replaced by `brew install sqitch --with-oracle-support`" + homepage "https://sqitch.org/" + url "file://#{HOMEBREW_REPOSITORY}/README.md", using: :nounzip + version "0" sha256 Pathname.new("#{HOMEBREW_REPOSITORY}/README.md").sha256 def install @@ -19,5 +18,4 @@ def install EOS end - end diff --git a/Formula/sqitch_pg.rb b/Formula/sqitch_pg.rb index d8cdaed..9f49faf 100644 --- a/Formula/sqitch_pg.rb +++ b/Formula/sqitch_pg.rb @@ -1,9 +1,8 @@ -require 'formula' - class SqitchPg < Formula - homepage 'https://sqitch.org/' - version '0' - url "file://#{HOMEBREW_REPOSITORY}/README.md", :using => :nounzip + desc "Replaced by `brew install sqitch --with-postgres-support`" + homepage "https://sqitch.org/" + url "file://#{HOMEBREW_REPOSITORY}/README.md", using: :nounzip + version "0" sha256 Pathname.new("#{HOMEBREW_REPOSITORY}/README.md").sha256 def install @@ -19,5 +18,4 @@ def install EOS end - end diff --git a/Formula/sqitch_sqlite.rb b/Formula/sqitch_sqlite.rb index bd03a7f..4870ed6 100644 --- a/Formula/sqitch_sqlite.rb +++ b/Formula/sqitch_sqlite.rb @@ -1,9 +1,8 @@ -require 'formula' - class SqitchSqlite < Formula - homepage 'https://sqitch.org/' - version '0' - url "file://#{HOMEBREW_REPOSITORY}/README.md", :using => :nounzip + desc "Replaced by `brew install sqitch --with-sqlite-support`" + homepage "https://sqitch.org/" + url "file://#{HOMEBREW_REPOSITORY}/README.md", using: :nounzip + version "0" sha256 Pathname.new("#{HOMEBREW_REPOSITORY}/README.md").sha256 def install @@ -19,5 +18,4 @@ def install EOS end - end diff --git a/Formula/sqitch_vertica.rb b/Formula/sqitch_vertica.rb index 2c8cd91..9982051 100644 --- a/Formula/sqitch_vertica.rb +++ b/Formula/sqitch_vertica.rb @@ -1,9 +1,8 @@ -require 'formula' - class SqitchVertica < Formula - homepage 'https://sqitch.org/' - version '0' - url "file://#{HOMEBREW_REPOSITORY}/README.md", :using => :nounzip + desc "Replaced by `brew install sqitch --with-vertica-support`" + homepage "https://sqitch.org/" + url "file://#{HOMEBREW_REPOSITORY}/README.md", using: :nounzip + version "0" sha256 Pathname.new("#{HOMEBREW_REPOSITORY}/README.md").sha256 def install @@ -19,5 +18,4 @@ def install EOS end - end diff --git a/requirements/exasol_req.rb b/requirements/exasol_req.rb index 4f4794d..d758e6f 100644 --- a/requirements/exasol_req.rb +++ b/requirements/exasol_req.rb @@ -1,12 +1,10 @@ -require "requirement" - class ExasolReq < Requirement @@dylib = "/Library/ODBC/EXASolution\ ODBC.bundle/Contents/MacOS/libexaodbc-*.dylib" @@client = "/Applications/EXAplus.app/Contents/MacOS/EXAplus" @have_client = false @have_dylib = false fatal false - download "https://www.exasol.com/portal/display/DOWNLOAD/" + download "https://downloads.exasol.com" def initialize(tags = []) super @@ -20,7 +18,7 @@ def initialize(tags = []) def message <<~EOS Sqitch Exasol support requires the Exasol ODBC Driver and EXAplus client. - Downloads: #{ download } + Downloads: #{download} EOS end @@ -28,25 +26,25 @@ def notes msg = "Exasol support requires the ODBC Driver and EXAplus client\n\n" # Show found items. if @have_dylib - msg += "- Found Driver matching:\n #{ @@dylib }\n\n" + msg += "- Found Driver matching:\n #{@@dylib}\n\n" end if @have_client - msg += "- Found EXAplus:\n #{ @@client }\n" \ + msg += "- Found EXAplus:\n #{@@client}\n" \ " Make sure it's in your \$PATH or tell Sqitch where to find it by running:\n\n" \ - " sqitch config --user engine.exasol.client \"#{ @@client }\"\n\n" + " sqitch config --user engine.exasol.client \"#{@@client}\"\n\n" end # Show missing items. if !@have_dylib msg += "- Cannot find ODBC Driver: No file found matching\n\n" \ - " #{ @@dylib }\n\n" \ + " #{@@dylib}\n\n" \ " Download from:\n\n" \ - " #{ download }\n\n" + " #{download}\n\n" end if !@have_client - msg += "- Cannot find client binary:\n #{ @@client }\n" \ + msg += "- Cannot find client binary:\n #{@@client}\n" \ " Download from:\n\n" \ - " #{ download }\n\n" \ + " #{download}\n\n" \ " Once it's installed, make sure it's in your \$PATH or tell Sqitch\n" \ " where to find it by running:\n\n" \ " sqitch config --user engine.exasol.client /path/to/exaplus\n\n" diff --git a/requirements/firebird_req.rb b/requirements/firebird_req.rb index 3a0627d..7420e27 100644 --- a/requirements/firebird_req.rb +++ b/requirements/firebird_req.rb @@ -1,5 +1,3 @@ -require "requirement" - class FirebirdReq < Requirement @@framework = "/Library/Frameworks/Firebird.framework" @@isql = "/Library/Frameworks/Firebird.framework/Resources/bin/isql" @@ -20,17 +18,17 @@ def initialize(tags = []) def message <<~EOS Sqitch Firebird support requires the Firebird Server Package. - Download from: #{ download } + Download from: #{download} EOS end def notes msg = "Firebird support requires the Firebird Server Framework\n\n" \ - "- Found Framework #{ @@framework }\n" + "- Found Framework #{@@framework}\n" if @have_isql - msg += "- Found isql binary: #{ @@isql }\n" \ + msg += "- Found isql binary: #{@@isql}\n" \ " Make sure it's in your \$PATH or tell Sqitch where to find it by running:\n\n" \ - " sqitch config --user engine.firebird.client #{ @@isql }\n\n" + " sqitch config --user engine.firebird.client #{@@isql}\n\n" else msg += "- Cannot find isql binary in framework; installation instructions:\n\n" \ " https://www.firebirdsql.org/file/documentation/reference_manuals/user_manuals/html/qsg3-installing.html\n\n" \ diff --git a/requirements/oracle_req.rb b/requirements/oracle_req.rb index e9b358c..6330b82 100644 --- a/requirements/oracle_req.rb +++ b/requirements/oracle_req.rb @@ -1,5 +1,3 @@ -require "requirement" - class OracleReq < Requirement @have_home = false @oracle_home = "" @@ -10,7 +8,7 @@ class OracleReq < Requirement @have_sdk = false @have_sqlplus = false fatal true - download "http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html" + download "https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html" def initialize(tags = []) super @@ -42,12 +40,12 @@ def message msg = <<~EOS Sqitch Oracle support requires the Oracle Instant Client Basic, SQL*Plus, and SDK packages. The following are packages missing - from HOMEBREW_ORACLE_HOME #{ @oracle_home }: + from HOMEBREW_ORACLE_HOME #{@oracle_home}: EOS msg += "\n - instantclient-basic" if !@have_dylib msg += "\n - instantclient-sdk" if !@have_sdk msg += "\n - instantclient-sqlplus" if !@have_sqlplus - msg + "\n\nDownload from here:\n\n #{ download }\n" + msg + "\n\nDownload from here:\n\n #{download}\n" else <<~EOS Sqitch Oracle support requires the Oracle Instant Client Basic, SQL*Plus, @@ -59,16 +57,16 @@ def message def notes msg = "Oracle support requires the Oracle Instant Client Basic, SQL*Plus,\n" \ "and SDK packages.\n\n" \ - "- Found Basic: #{ @dylib }\n" \ - "- Found SDK: #{ @sdk }\n" + "- Found Basic: #{@dylib}\n" \ + "- Found SDK: #{@sdk}\n" if @have_sqlplus - msg += "- Found SQL*Plus: #{ @sqlplus }\n\n" \ + msg += "- Found SQL*Plus: #{@sqlplus}\n\n" \ " Make sure SQL*Plus is in your \$PATH or tell Sqitch where to find\n" \ " it by running:\n\n" \ - " sqitch config --user engine.oracle.client #{ @sqlplus }\n\n" + " sqitch config --user engine.oracle.client #{@sqlplus}\n\n" else msg += "- SQL*Plus not found; download it from here:\n\n" \ - " #{ download }\n\n" + " #{download}\n\n" " Once it's installed, make sure it's in your \$PATH or tell Sqitch\n" \ " where to find it by running:\n\n" \ " sqitch config --user engine.oracle.client /path/to/snowsl\n\n" diff --git a/requirements/snowflake_req.rb b/requirements/snowflake_req.rb index fb30691..5bf75ea 100644 --- a/requirements/snowflake_req.rb +++ b/requirements/snowflake_req.rb @@ -1,12 +1,10 @@ -require "requirement" - class SnowflakeReq < Requirement @@dylib = "/opt/snowflake/snowflakeodbc/lib/universal/libSnowflake.dylib" @@client = "/Applications/SnowSQL.app/Contents/MacOS/snowsql" @have_client = false @have_dylib = false fatal false - download "https://docs.snowflake.net/manuals/user-guide/odbc-mac.html" + download "https://docs.snowflake.com/developer-guide/odbc/odbc-mac" def initialize(tags = []) super @@ -20,7 +18,7 @@ def initialize(tags = []) def message <<~EOS Sqitch Snowflake support requires the Snowflake ODBC driver. - Installation: #{ download } + Installation: #{download} EOS end @@ -28,20 +26,20 @@ def notes msg = "Snowflake support requires the Snowflake ODBC driver and SnowSQL\n\n" \ # Show found items. if @have_dylib - msg += "- Found ODBC Driver #{ @@dylib }\n" + msg += "- Found ODBC Driver #{@@dylib}\n" end if @have_client - msg += "- Found SnowSQL binary: #{ @@client }\n" \ + msg += "- Found SnowSQL binary: #{@@client}\n" \ " Make sure it's in your \$PATH or tell Sqitch where to find it by running:\n\n" \ - " sqitch config --user engine.snowflake.client #{ @@client }\n\n" + " sqitch config --user engine.snowflake.client #{@@client}\n\n" end # Show missing items. if !@have_dylib msg += "- Cannot find ODBC Driver: File not found:\n\n" \ - " #{ @@dylib }\n\n" \ + " #{@@dylib}\n\n" \ " Download from:\n\n" \ - " #{ download }\n\n" + " #{download}\n\n" end if !@have_client msg += "- SnowSQL not found; installation instructions:\n\n" \ diff --git a/requirements/vertica_req.rb b/requirements/vertica_req.rb index 35f68e8..afc881d 100644 --- a/requirements/vertica_req.rb +++ b/requirements/vertica_req.rb @@ -1,12 +1,10 @@ -require "requirement" - class VerticaReq < Requirement @@dylib = "/Library/Vertica/ODBC/lib/libverticaodbc.dylib" @@client = "/opt/vertica/bin/vsql" @have_client = false @have_dylib = false fatal false - download "https://my.vertica.com/download/vertica/client-drivers/" + download "https://www.vertica.com/download/vertica/client-drivers/" def initialize(tags = []) super @@ -20,7 +18,7 @@ def initialize(tags = []) def message <<~EOS Sqitch Vertica support requires the Vertica ODBC Driver and vsql client. - Downloads: #{ download } + Downloads: #{download} EOS end @@ -28,25 +26,25 @@ def notes msg = "Vertica support requires the ODBC Driver and vsql client\n\n" # Show found items. if @have_dylib - msg += "- Found Driver #{ @@dylib }\n" + msg += "- Found Driver #{@@dylib}\n" end if @have_client - msg += "- Found vsql: #{ @@client }\n" \ + msg += "- Found vsql: #{@@client}\n" \ " Make sure it's in your \$PATH or tell Sqitch where to find it by running:\n\n" \ - " sqitch config --user engine.vertica.client #{ @@client }\n\n" + " sqitch config --user engine.vertica.client #{@@client}\n\n" end # Show missing items. if !@have_dylib msg += "- Cannot find ODBC Driver: File not found:\n\n" \ - " #{ @@dylib }\n\n" \ + " #{@@dylib}\n\n" \ " Download from:\n\n" \ - " #{ download }\n\n" + " #{download}\n\n" end if !@have_client - msg += "- Cannot find client binary: #{ @@client }\n" \ + msg += "- Cannot find client binary: #{@@client}\n" \ " Download from:\n\n" \ - " #{ download }\n\n" \ + " #{download}\n\n" \ " Once it's installed, make sure it's in your \$PATH or tell Sqitch\n" \ " where to find it by running:\n\n" \ " sqitch config --user engine.vertica.client /path/to/vsql\n\n"