From 3e4767a983499b83257acc5b6fb6bcdfc7a87d34 Mon Sep 17 00:00:00 2001 From: Mario Kozjak Date: Tue, 20 Jun 2017 18:26:52 +0200 Subject: [PATCH] goose 2.0.0 (new formula) Closes #14724. Signed-off-by: ilovezfs --- Formula/goose.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Formula/goose.rb diff --git a/Formula/goose.rb b/Formula/goose.rb new file mode 100644 index 0000000000..0ebd7ea316 --- /dev/null +++ b/Formula/goose.rb @@ -0,0 +1,37 @@ +require "language/go" + +class Goose < Formula + desc "Go Language's command-line interface for database migrations" + homepage "https://github.com/pressly/goose" + url "https://github.com/pressly/goose/archive/v2.0.0.tar.gz" + sha256 "ebb5036ce89bfbb8e0594149454293fab6c2639873be824b0746994ab5a8668b" + + depends_on "go" => :build + + go_resource "github.com/golang/dep" do + url "https://github.com/golang/dep.git", + :revision => "20e24628a053fd5da9d32598e75e80734717cb5f" + end + + def install + ENV["GOPATH"] = buildpath + + (buildpath/"src/github.com/pressly/goose").install buildpath.children + Language::Go.stage_deps resources, buildpath/"src" + + cd "src/github.com/golang/dep" do + system "go", "install", ".../cmd/dep" + end + + cd "src/github.com/pressly/goose" do + system buildpath/"bin/dep", "ensure" + system "go", "build", "-o", bin/"goose", ".../cmd/goose" + end + end + + test do + output = shell_output("#{bin}/goose sqlite3 foo.db status create") + assert_match "Migration", output + assert_predicate testpath/"foo.db", :exist?, "Failed to create foo.db!" + end +end